Skip to content
This repository has been archived by the owner on Apr 12, 2021. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #530 from conjure-up/fix-521
Fix 521
  • Loading branch information
mikemccracken committed Dec 19, 2016
2 parents 3789f4d + 04b5db4 commit 829d5b2
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 15 deletions.
2 changes: 1 addition & 1 deletion Makefile
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion conjureup/controllers/newcloud/gui.py
Expand Up @@ -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, "
Expand Down
22 changes: 10 additions & 12 deletions conjureup/ui/views/lxdsetup.py
Expand Up @@ -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)

Expand Down
11 changes: 10 additions & 1 deletion conjureup/utils.py
Expand Up @@ -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
"""
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 829d5b2

Please sign in to comment.