diff --git a/Makefile b/Makefile index cc89f0cc..52c244f5 100644 --- a/Makefile +++ b/Makefile @@ -10,7 +10,7 @@ VERSION := 2.1.0 .PHONY: install-dependencies install-dependencies: - sudo apt-get -yy install devscripts equivs pandoc bsdtar charm charm-tools jq libsystemd-dev + sudo apt-get -yy install devscripts equivs pandoc bsdtar jq libsystemd-dev sudo mk-build-deps -i -t "apt-get --no-install-recommends -y" debian/control .PHONY: uninstall-dependencies diff --git a/conjureup/controllers/newcloud/gui.py b/conjureup/controllers/newcloud/gui.py index c02cc9d6..4564d1bd 100644 --- a/conjureup/controllers/newcloud/gui.py +++ b/conjureup/controllers/newcloud/gui.py @@ -147,7 +147,8 @@ def render(self): # information. if app.current_cloud == 'localhost': - if not utils.check_bridge_exists(): + if not utils.check_bridge_exists() or \ + not utils.check_user_in_group('lxd'): return controllers.use('lxdsetup').render() app.log.debug("Found an IPv4 address, " diff --git a/conjureup/ui/views/lxdsetup.py b/conjureup/ui/views/lxdsetup.py index f9362af4..1fc5b598 100644 --- a/conjureup/ui/views/lxdsetup.py +++ b/conjureup/ui/views/lxdsetup.py @@ -106,20 +106,18 @@ def buttons(self): def build_info(self): items = [ - Text("There was no LXD bridge found on your system " - "which usually means this is your first time running " - "LXD."), + Text("There was no LXD bridge found on your system or " + "not part of the 'lxd' group which usually " + "means this is your first time running LXD."), Padding.line_break(""), - # Text("If you wish to do so now pressing confirm will drop you out " # noqa - # "of the installer and walk you through configuring your " - # "network for LXD. Once complete the installer will " - # "start again from the beginning where you can choose " - # "to deploy the bundle via LXD.") Text("If you wish to do so now pressing confirm will drop you out " - "of the installer and you will be required to run " - "`lxd init` to configure the network for LXD. Once complete " - "re-run conjure-up and continue the installation.") - + "of the installer and you will be required to run the " + "following: \n\n" + " $ sudo lxd init\n" + " $ newgrp lxd\n" + " $ lxc finger\n\n" + "If `lxc finger` does not fail with an error you are ready " + "to re-run conjure-up and continue the installation.") ] return Pile(items) diff --git a/conjureup/utils.py b/conjureup/utils.py index 278b21be..51271528 100644 --- a/conjureup/utils.py +++ b/conjureup/utils.py @@ -136,6 +136,15 @@ def check_bridge_exists(): return False +def check_user_in_group(group): + """ Checks if a user is associated with `group` + """ + groups = run_script('groups').stdout.decode() + if group in groups.split(): + return True + return False + + def check_deb_installed(pkg): """ Checks if a debian package is installed """ @@ -238,7 +247,7 @@ def slurp(path): def install_user(): - """ returns sudo user + """ returns current user """ user = os.getenv('USER', None) if user is None: