diff options
author | Gonéri Le Bouder <goneri@lebouder.net> | 2020-01-14 10:45:37 -0500 |
---|---|---|
committer | Daniel Watkins <oddbloke@ubuntu.com> | 2020-01-14 10:45:37 -0500 |
commit | 863394ba0b5f18483b350daec30af8434be8811b (patch) | |
tree | dbbc925359190ef13c7baf12bc2ccb900de5552b /cloudinit | |
parent | 3f6192b39894761e8ddecefa3736ea0abbc35b90 (diff) | |
download | vyos-cloud-init-863394ba0b5f18483b350daec30af8434be8811b.tar.gz vyos-cloud-init-863394ba0b5f18483b350daec30af8434be8811b.zip |
freebsd: remove superflu exception mapping (#166)
We often map exception when is not necessary. This commit clean up
the FreeBSD distro file.
Diffstat (limited to 'cloudinit')
-rw-r--r-- | cloudinit/distros/freebsd.py | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/cloudinit/distros/freebsd.py b/cloudinit/distros/freebsd.py index 8936bd24..40e435e7 100644 --- a/cloudinit/distros/freebsd.py +++ b/cloudinit/distros/freebsd.py @@ -67,9 +67,9 @@ class Distro(distros.Distro): try: util.subp(group_add_cmd) LOG.info("Created new group %s", name) - except Exception as e: + except Exception: util.logexc(LOG, "Failed to create group %s", name) - raise e + raise if not members: members = [] @@ -129,9 +129,9 @@ class Distro(distros.Distro): LOG.info("Adding user %s", name) try: util.subp(pw_useradd_cmd, logstring=log_pw_useradd_cmd) - except Exception as e: + except Exception: util.logexc(LOG, "Failed to create user %s", name) - raise e + raise # Set the password if it is provided # For security consideration, only hashed passwd is assumed passwd_val = kwargs.get('passwd', None) @@ -141,9 +141,9 @@ class Distro(distros.Distro): def expire_passwd(self, user): try: util.subp(['pw', 'usermod', user, '-p', '01-Jan-1970']) - except Exception as e: + except Exception: util.logexc(LOG, "Failed to set pw expiration for %s", user) - raise e + raise def set_passwd(self, user, passwd, hashed=False): if hashed: @@ -154,16 +154,16 @@ class Distro(distros.Distro): try: util.subp(['pw', 'usermod', user, hash_opt, '0'], data=passwd, logstring="chpasswd for %s" % user) - except Exception as e: + except Exception: util.logexc(LOG, "Failed to set password for %s", user) - raise e + raise def lock_passwd(self, name): try: util.subp(['pw', 'usermod', name, '-h', '-']) - except Exception as e: + except Exception: util.logexc(LOG, "Failed to lock user %s", name) - raise e + raise def create_user(self, name, **kwargs): self.add_user(name, **kwargs) |