Commit 84191b93 authored by Xavier Thompson's avatar Xavier Thompson

slapformat: WIP: Rename raise_on_error into throw

parent ccd58b6a
......@@ -482,7 +482,7 @@ class User(object):
parameters.append(self.name)
if self.userExists(self.name):
# if the user is already created and used we should not fail
call(['usermod'] + parameters, raise_on_error=False)
call(['usermod'] + parameters, throw=False)
else:
parameters.append('-r')
call(['useradd'] + parameters)
......@@ -512,7 +512,7 @@ class User(object):
# Utilities
def call(args, raise_on_error=True):
def call(args, throw=True):
popen = subprocess.Popen(
args,
stdout=subprocess.PIPE,
......@@ -520,7 +520,7 @@ def call(args, raise_on_error=True):
universal_newlines=True,
)
result = popen.communicate()[0]
if raise_on_error and popen.returncode != 0:
if throw and popen.returncode != 0:
raise ValueError(
"Issue while invoking %r, result was:\n%s" % (args, result)
)
......@@ -591,17 +591,17 @@ class WrappedSystem(object):
)
if conf.dry_run:
conf.abort = conf.dryError
def dry_call(args, raise_on_error=True):
def dry_call(args, throw=True):
conf.logger.debug(' '.join(args))
it = iter(args)
if all(w in it for w in ('ip', 'addr', 'show')): # subsequence test
return self.call(args, raise_on_error=False)
return self.call(args, throw=False)
return 0, ''
call = dry_call
else:
def tracing_call(args, raise_on_error=True):
def tracing_call(args, throw=True):
conf.logger.debug(' '.join(args))
return self.call(args, raise_on_error)
return self.call(args, throw)
call = tracing_call
def __exit__(self, *exc):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment