diff options
author | Scott Moser <smoser@ubuntu.com> | 2014-01-23 16:13:09 -0500 |
---|---|---|
committer | Scott Moser <smoser@ubuntu.com> | 2014-01-23 16:13:09 -0500 |
commit | 5323320a7251b124c231ba6be25b8583535f1b62 (patch) | |
tree | 57881ca56a9bc1fdfafcddbae713fd1552fb6d53 | |
parent | c2b41f399778213414aa8a9a7f39a03a15ed79df (diff) | |
download | vyos-cloud-init-5323320a7251b124c231ba6be25b8583535f1b62.tar.gz vyos-cloud-init-5323320a7251b124c231ba6be25b8583535f1b62.zip |
pep8, use which rather than hard coded path
-rw-r--r-- | cloudinit/config/cc_growpart.py | 6 | ||||
-rw-r--r-- | cloudinit/config/cc_power_state_change.py | 7 |
2 files changed, 7 insertions, 6 deletions
diff --git a/cloudinit/config/cc_growpart.py b/cloudinit/config/cc_growpart.py index 1d3a4412..b81951ad 100644 --- a/cloudinit/config/cc_growpart.py +++ b/cloudinit/config/cc_growpart.py @@ -113,9 +113,10 @@ class ResizeGrowPart(object): return (before, get_size(partdev)) + class ResizeGpart(object): def available(self): - if not os.path.exists('/usr/local/sbin/gpart'): + if not util.which('gpart'): return False return True @@ -138,7 +139,7 @@ class ResizeGpart(object): try: util.subp(["gpart", "resize", "-i", partnum, diskdev]) except util.ProcessExecutionError as e: - util.logexc(LOG, "Failed: gpart resize -i %s %s", partnum, diskdev) + util.logexc(LOG, "Failed: gpart resize -i %s %s", partnum, diskdev) raise ResizeFailedException(e) # Since growing the FS requires a reboot, make sure we reboot @@ -147,6 +148,7 @@ class ResizeGpart(object): return (before, get_size(partdev)) + def get_size(filename): fd = os.open(filename, os.O_RDONLY) try: diff --git a/cloudinit/config/cc_power_state_change.py b/cloudinit/config/cc_power_state_change.py index 6bd14b7e..561c5abd 100644 --- a/cloudinit/config/cc_power_state_change.py +++ b/cloudinit/config/cc_power_state_change.py @@ -30,12 +30,10 @@ frequency = PER_INSTANCE EXIT_FAIL = 254 -# -# Returns the cmdline for the given process id. In Linux we can use procfs for -# this but on BSD there is /usr/bin/procstat. -# def givecmdline(pid): + # Returns the cmdline for the given process id. In Linux we can use procfs + # for this but on BSD there is /usr/bin/procstat. try: # Example output from procstat -c 1 # PID COMM ARGS @@ -50,6 +48,7 @@ def givecmdline(pid): except IOError: return None + def handle(_name, cfg, _cloud, log, _args): try: |