~cjwatson/mojo/snap-exclude-systemd

« back to all changes in this revision

Viewing changes to mojo/contain.py

  • Committer: mergebot at canonical
  • Author(s): "Tom Haddon"
  • Date: 2021-04-15 12:46:23 UTC
  • mfrom: (585.1.3 error-on-deploy)
  • Revision ID: mergebot@juju-139df4-prod-is-toolbox-0.canonical.com-20210415124623-vkut2l891llb0wbd
Correctly deal with output from juju status, fixes lp#1902546

Reviewed-on: https://code.launchpad.net/~mthaddon/mojo/error-on-deploy/+merge/401190
Reviewed-by: Benjamin Allot <benjamin.allot@canonical.com>

Show diffs side-by-side

added added

removed removed

Lines of Context:
842
842
 
843
843
    def create_user(self, user):
844
844
        getent_command, _ = get_command("getent")
845
 
        (username, shadow, uid, gid, name, home, shell) = subprocess.check_output(
846
 
            [getent_command, "passwd", user]
847
 
        ).decode("utf-8").strip().split(":")
 
845
        (username, shadow, uid, gid, name, home, shell) = (
 
846
            subprocess.check_output([getent_command, "passwd", user]).decode("utf-8").strip().split(":")
 
847
        )
848
848
        # if the uid exists update the name to match the caller
849
849
        try:
850
850
            command = "useradd --home {} --create-home --uid {} {}".format(home, uid, username)