Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support for automatic steps #40

Open
UnquietCode opened this issue Oct 30, 2019 · 1 comment
Open

support for automatic steps #40

UnquietCode opened this issue Oct 30, 2019 · 1 comment
Assignees
Labels

Comments

@UnquietCode
Copy link
Owner

UnquietCode commented Oct 30, 2019

In the path towards automation, the idea of the runbook is to slowly swap out individual steps / methods in the class for automated actions, eventually cutting out the humans entirely. To facilitate this we need the concept of an automated step, one which does not prompt but performs an action and logs it.

Considerations include acceptance criteria, whether the user should confirm the action or just let it happen, repeatability, etc. Also right now the methods are invoked to return dynamic doc strings, so this behavior might be in conflict if the method has to run.

Some possible implementations:

def _deploy_cf_stack():
    pass

def deploy_cf_stack(action='_deploy_cf_stack'):
    """
    Deploys the CloudFormation stack with parameters
    derived from the previous steps.
    """
def deploy_cf_stack(auto=True):
    """
    Deploys the CloudFormation stack with parameters
    derived from the previous steps.
    """
    def action_fn():
        self.helper.deployStack()

    return StepInfo(description="dynamic docs!", action=action_fn)
def deploy_cf_stack(with_action):
    """
    Deploys the CloudFormation stack with parameters
    derived from the previous steps.
    """
    def action_fn():
        self.helper.deployStack()
    
    with_action(action_fn)
    return "dynamic docs"
def deploy_cf_stack(action):
    """
    Deploys the CloudFormation stack with parameters
    derived from the previous steps.
    """
    @action
    def do_deploy():
        self.helper.deployStack()
    
    return "dynamic docs"
@UnquietCode UnquietCode self-assigned this Oct 30, 2019
@brhodes77
Copy link

I've just recently discovered this repo, after experimenting with the Ruby runbook implementation out of braintree. Having the ability to easily mix manual and automated steps is a key feature for us and I'm wondering if you'd consider an implementation where the method simply IS the automated implementation when auto=True. I think this would be very intuitive and make it about as simple as possible to add in automated steps, keeping runbooks pretty clean. The downside is that you would loose support for dynamic doc generation, but I didn't totally follow the use case around that and how important that is. Here's what it would look like, given your examples above:

def deploy_cf_stack(auto=True):
    """
    Deploys the CloudFormation stack with parameters
    derived from the previous steps.
    """
    self.helper.deployStack()

With all this said, if the dynamic doc feature is important (or if I'm missing something else), then I'd vote for the 2nd option you posted above, which is fairly similar. It adds more required boilerplate to turn on the automation, which can add up and potentially take away from runbook readability, but perhaps a reasonable trade off. In our use case, I'm not anticipating using the dynamic doc feature.

def deploy_cf_stack(auto=True):
    """
    Deploys the CloudFormation stack with parameters
    derived from the previous steps.
    """
    def action_fn():
        self.helper.deployStack()

    return StepInfo(description="dynamic docs!", action=action_fn)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants