diff --git a/bench/playbooks/roles/dns_caching/handlers/main.yml b/bench/playbooks/roles/dns_caching/handlers/main.yml index afe7ac3e..f3b1d4c4 100644 --- a/bench/playbooks/roles/dns_caching/handlers/main.yml +++ b/bench/playbooks/roles/dns_caching/handlers/main.yml @@ -1,4 +1,4 @@ --- -- name: Restart network manager +- name: restart network manager service: name=NetworkManager state=restarted ... \ No newline at end of file diff --git a/install.py b/install.py index bb3ac75f..d62f6ddf 100644 --- a/install.py +++ b/install.py @@ -78,7 +78,7 @@ def check_distribution_compatibility(): dist_name, dist_version = get_distribution_info() supported_dists = { 'macos': [10.9, 10.10, 10.11, 10.12], - 'ubuntu': [14, 15, 16, 18, 19], + 'ubuntu': [14, 15, 16, 18, 19, 20], 'debian': [8, 9, 10], 'centos': [7] } @@ -93,11 +93,36 @@ def check_distribution_compatibility(): else: log("Sorry, the installer doesn't support {0}. Aborting installation!".format(dist_name), level=2) +def import_with_install(package): + # copied from https://discuss.erpnext.com/u/nikunj_patel + # https://discuss.erpnext.com/t/easy-install-setup-guide-for-erpnext-installation-on-ubuntu-20-04-lts-with-some-modification-of-course/62375/5 + + # need to move to top said v13 for fully python3 era + import importlib + + try: + importlib.import_module(package) + except ImportError: + # caveat : pip3 must be installed + + import pip + + pip.main(['install', package]) + finally: + globals()[package] = importlib.import_module(package) + def get_distribution_info(): # return distribution name and major version if platform.system() == "Linux": - current_dist = platform.dist() + if sys.version_info.major == 3 and sys.version_info.minor > 7: + install_package('pip3', 'python3-pip') + + import_with_install('distro') + + current_dist = distro.linux_distribution(full_distribution_name=True) + else: + current_dist = platform.dist() return current_dist[0].lower(), current_dist[1].rsplit('.')[0] elif platform.system() == "Darwin": @@ -403,6 +428,7 @@ def parse_commandline_args(): parser.add_argument('--python', dest='python', default='python3', help=argparse.SUPPRESS) # LXC Support parser.add_argument('--container', dest='container', default=False, action='store_true', help='Use if you\'re creating inside LXC') + args = parser.parse_args() return args @@ -440,3 +466,4 @@ if __name__ == '__main__': install_bench(args) log("Bench + Frappe + ERPNext has been successfully installed!") + \ No newline at end of file