Pass the timeout to the deploy workflow

Change-Id: I2a99c4804ffeaa2bd02d8d4098f4268bc86081a3
Closes-Bug: #1623546
This commit is contained in:
Dougal Matthews 2016-09-14 15:55:20 +01:00
parent c0f79d4477
commit c689fc03da
3 changed files with 17 additions and 4 deletions

View File

@ -272,7 +272,7 @@ class DeployOvercloud(command.Command):
workflow_client)
deployment.deploy_and_wait(self.log, clients, stack, stack_name,
self.app_args.verbose_level)
self.app_args.verbose_level, timeout)
def _load_environment_directories(self, directories):
if os.environ.get('TRIPLEO_ENVIRONMENT_DIRECTORY'):

View File

@ -123,6 +123,9 @@ class DeployPlan(command.Command):
def get_parser(self, prog_name):
parser = super(DeployPlan, self).get_parser(prog_name)
parser.add_argument('name', help=_('The name of the plan to deploy.'))
parser.add_argument('--timeout', '-t', metavar='<TIMEOUT>',
type=int,
help=_('Deployment timeout in minutes.'))
return parser
def take_action(self, parsed_args):
@ -134,4 +137,5 @@ class DeployPlan(command.Command):
print("Starting to deploy plan: {}".format(parsed_args.name))
deployment.deploy_and_wait(self.log, clients, stack, parsed_args.name,
self.app_args.verbose_level)
self.app_args.verbose_level,
timeout=parsed_args.timeout)

View File

@ -37,10 +37,19 @@ def deploy(clients, **workflow_input):
assert message['status'] == "SUCCESS", pprint.pformat(message)
def deploy_and_wait(log, clients, stack, plan_name, verbose_level):
def deploy_and_wait(log, clients, stack, plan_name, verbose_level,
timeout=None):
"""Start the deploy and wait for it to finish"""
deploy(clients, container=plan_name, queue_name=str(uuid.uuid4()))
workflow_input = {
"container": plan_name,
"queue_name": str(uuid.uuid4()),
}
if timeout is not None:
workflow_input['timeout'] = timeout
deploy(clients, **workflow_input)
orchestration_client = clients.orchestration