Mitch Garnaat

Updated README a bit, added some informational output to various commands.

......@@ -33,7 +33,7 @@ Where ``command`` is one of:
* deploy - deploy the CloudFormation template containing the IAM roles and zip the function and upload it to AWS Lambda
* test - send test data to the new Lambda function
* tail - display the most recent log events for the function
* tail - display the most recent log events for the function (remember that it can take several minutes before log events are available from CloudWatch)
* add-event-source - hook up an event source to your Lambda function
* delete - delete the CloudFormation stack containing the IAM roles and delete the Lambda function
......
......@@ -56,31 +56,33 @@ def set_debug_logger(logger_names=['kappa'], stream=None):
default=False,
help='Turn on debugging output'
)
@click.option(
'--dryrun/--no-dryrun',
default=False,
help='Do not send the email'
)
@click.argument(
'command',
required=True,
type=click.Choice(['deploy', 'test', 'tail', 'add-event-source', 'delete'])
)
def main(config=None, debug=False, dryrun=False, command=None):
def main(config=None, debug=False, command=None):
if debug:
set_debug_logger()
config = yaml.load(config)
kappa = Kappa(config)
if command == 'deploy':
click.echo('Deploying ...')
kappa.deploy()
elif command == 'test':
click.echo('Sending test data ...')
kappa.test()
click.echo('...done')
elif command == 'tail':
kappa.tail()
elif command == 'delete':
click.echo('Deleting ...')
kappa.delete()
click.echo('...done')
elif command == 'add-event-source':
click.echo('Adding event source ...')
kappa.add_event_source()
click.echo('...done')
if __name__ == '__main__':
......
......@@ -57,12 +57,12 @@ class Kappa(object):
Capabilities=['CAPABILITY_IAM'])
done = False
while not done:
time.sleep(1)
response = cfn.describe_stacks(StackName=stack_name)
status = response['Stacks'][0]['StackStatus']
LOG.debug('Stack status is: %s', status)
if status in self.completed_states:
done = True
time.sleep(1)
def get_role_arn(self, role_name):
role_arn = None
......