Exemplo n.º 1
0
 def Run(self, args):
   """Deploy a workflow."""
   client = workflows.WorkflowsClient()
   workflow_ref = flags.ParseWorkflow(args)
   old_workflow = client.Get(workflow_ref)
   first_deployment = old_workflow is None
   workflow, updated_fields = client.BuildWorkflowFromArgs(args)
   validate.ValidateWorkflow(workflow, first_deployment=first_deployment)
   if first_deployment:
     operation = client.Create(workflow_ref, workflow)
   else:
     if not updated_fields:
       log.status.Print('No updates provided, quitting as a no-op.')
       return None
     operation = client.Patch(workflow_ref, workflow, updated_fields)
   if args.async_:
     return operation
   else:
     return client.WaitForOperation(operation, workflow_ref)
Exemplo n.º 2
0
 def Run(self, args):
     """Deploy a workflow."""
     hooks.print_default_location_warning(None, args, None)
     api_version = workflows.ReleaseTrackToApiVersion(self.ReleaseTrack())
     client = workflows.WorkflowsClient(api_version)
     workflow_ref = flags.ParseWorkflow(args)
     validate.WorkflowNameConforms(workflow_ref.Name())
     old_workflow = client.Get(workflow_ref)
     first_deployment = old_workflow is None
     workflow, updated_fields = client.BuildWorkflowFromArgs(args)
     validate.ValidateWorkflow(workflow, first_deployment=first_deployment)
     if first_deployment:
         operation = client.Create(workflow_ref, workflow)
     else:
         if not updated_fields:
             log.status.Print('No updates provided, quitting as a no-op.')
             return None
         operation = client.Patch(workflow_ref, workflow, updated_fields)
     if args.async_:
         return operation
     else:
         return client.WaitForOperation(operation, workflow_ref)