def Run(self, args): """Run 'rolling-updates resume'. Args: args: argparse.Namespace, The arguments that this command was invoked with. Raises: HttpException: An http error response was received while executing api request. ToolException: An error other than http error occured while executing the command. """ client = self.context['updater_api'] messages = self.context['updater_messages'] resources = self.context['updater_resources'] ref = resources.Parse( args.update, collection='replicapoolupdater.rollingUpdates') request = messages.ReplicapoolupdaterRollingUpdatesResumeRequest( project=ref.project, zone=ref.zone, rollingUpdate=ref.rollingUpdate) try: operation = client.rollingUpdates.Resume(request) operation_ref = resources.Parse( operation.name, collection='replicapoolupdater.zoneOperations') result = updater_util.WaitForOperation( client, operation_ref, 'Resuming the update') if result: log.status.write('Resumed [{0}].\n'.format(ref)) else: raise exceptions.ToolException('could not resume [{0}]'.format(ref)) except apitools_base.HttpError as error: raise exceptions.HttpException(updater_util.GetError(error))
def Run(self, args): """Run 'rolling-updates start'. Args: args: argparse.Namespace, The arguments that this command was invoked with. Raises: HttpException: An http error response was received while executing api request. ToolException: An error other than http error occured while executing the command. """ client = self.context['updater_api'] messages = self.context['updater_messages'] resources = self.context['updater_resources'] request = messages.ReplicapoolupdaterRollingUpdatesInsertRequest( project=properties.VALUES.core.project.Get(required=True), zone=properties.VALUES.compute.zone.Get(required=True), rollingUpdate=self._PrepareUpdate(args)) try: operation = client.rollingUpdates.Insert(request) operation_ref = resources.Parse( operation.name, collection='replicapoolupdater.zoneOperations') result = updater_util.WaitForOperation(client, operation_ref, 'Starting a new update') if result: log.status.write('Started [{0}].\n'.format( operation.targetLink)) else: raise exceptions.ToolException('could not start [{0}]'.format( operation.targetLink)) except apitools_base.HttpError as error: raise exceptions.HttpException(updater_util.GetError(error))