Skip to content

Commit

Permalink
Merge remote-tracking branch 'mitchellrj/customizable-state-dir'
Browse files Browse the repository at this point in the history
  • Loading branch information
Jc2k committed Apr 3, 2015
2 parents f412dc1 + 1b41d7f commit 289c57e
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion fuselage/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,13 @@ class Runner(object):

state_path = "/var/run/yaybu"

def __init__(self, resources, resume=False, no_resume=False, no_changes_ok=False, simulate=False, verbosity=logging.INFO):
def __init__(self, resources, resume=False, no_resume=False, no_changes_ok=False, simulate=False, verbosity=logging.INFO, state_path=None):
if resume and no_resume:
raise error.ParseError("'resume' and 'no_resume' cannot both be True")

if state_path is not None:
self.state_path = state_path

self.resources = resources
self.resume = resume
self.no_resume = no_resume
Expand All @@ -51,6 +54,7 @@ def get_resources(cls):
@classmethod
def setup_from_cmdline(cls, argv=sys.argv, resources=None):
p = optparse.OptionParser()
p.add_option("--state", default=None)
p.add_option("-s", "--simulate", action="store_true", default=False)
p.add_option("--resume", action="store_true", default=False)
p.add_option("--no-resume", action="store_true", default=False)
Expand All @@ -66,6 +70,7 @@ def setup_from_cmdline(cls, argv=sys.argv, resources=None):
no_changes_ok=opts.no_changes_ok,
simulate=opts.simulate,
verbosity=logging.INFO - (10 * (opts.verbose - opts.quiet)),
state_path=opts.state,
)

def run(self):
Expand Down

0 comments on commit 289c57e

Please sign in to comment.