pep8, use which rather than hard coded path
This commit is contained in:
parent
dbf5d00e6b
commit
7c3a12d516
@ -113,9 +113,10 @@ class ResizeGrowPart(object):
|
|||||||
|
|
||||||
return (before, get_size(partdev))
|
return (before, get_size(partdev))
|
||||||
|
|
||||||
|
|
||||||
class ResizeGpart(object):
|
class ResizeGpart(object):
|
||||||
def available(self):
|
def available(self):
|
||||||
if not os.path.exists('/usr/local/sbin/gpart'):
|
if not util.which('gpart'):
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
@ -138,7 +139,7 @@ class ResizeGpart(object):
|
|||||||
try:
|
try:
|
||||||
util.subp(["gpart", "resize", "-i", partnum, diskdev])
|
util.subp(["gpart", "resize", "-i", partnum, diskdev])
|
||||||
except util.ProcessExecutionError as e:
|
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)
|
raise ResizeFailedException(e)
|
||||||
|
|
||||||
# Since growing the FS requires a reboot, make sure we reboot
|
# Since growing the FS requires a reboot, make sure we reboot
|
||||||
@ -147,6 +148,7 @@ class ResizeGpart(object):
|
|||||||
|
|
||||||
return (before, get_size(partdev))
|
return (before, get_size(partdev))
|
||||||
|
|
||||||
|
|
||||||
def get_size(filename):
|
def get_size(filename):
|
||||||
fd = os.open(filename, os.O_RDONLY)
|
fd = os.open(filename, os.O_RDONLY)
|
||||||
try:
|
try:
|
||||||
|
@ -30,12 +30,10 @@ frequency = PER_INSTANCE
|
|||||||
|
|
||||||
EXIT_FAIL = 254
|
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):
|
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:
|
try:
|
||||||
# Example output from procstat -c 1
|
# Example output from procstat -c 1
|
||||||
# PID COMM ARGS
|
# PID COMM ARGS
|
||||||
@ -50,6 +48,7 @@ def givecmdline(pid):
|
|||||||
except IOError:
|
except IOError:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
def handle(_name, cfg, _cloud, log, _args):
|
def handle(_name, cfg, _cloud, log, _args):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user