示例#1
0
 def Run(self, args):
     project = properties.VALUES.core.project.Get(required=True)
     info = yaml_parsing.ConfigYamlInfo.FromFile(args.index_file)
     if not info or info.name != yaml_parsing.ConfigYamlInfo.INDEX:
         raise exceptions.InvalidArgumentException(
             'index_file',
             'You must provide the path to a valid index.yaml file.')
     output_helpers.DisplayProposedConfigDeployments(project, [info])
     console_io.PromptContinue(default=True,
                               throw_if_unattended=False,
                               cancel_on_no=True)
     received_indexes = index_api.NormalizeIndexes(info.parsed.indexes
                                                   or [])
     indexes_to_delete_ids = set()
     current_indexes = index_api.ListIndexes(project)
     for index_id, index in current_indexes:
         if index in received_indexes:
             continue
         msg = (
             'This index is no longer defined in your index.yaml file.\n{0}'
             .format(index.ToYAML()))
         prompt = 'Do you want to delete this index'
         if console_io.PromptContinue(msg, prompt, default=True):
             indexes_to_delete_ids.add(index_id)
     index_api.DeleteIndexes(project, indexes_to_delete_ids)
示例#2
0
  def Run(self, args):
    project = properties.VALUES.core.project.Get(required=True)
    info = yaml_parsing.ConfigYamlInfo.FromFile(args.index_file)
    if not info or info.name != yaml_parsing.ConfigYamlInfo.INDEX:
      raise exceptions.InvalidArgumentException(
          'index_file', 'You must provide the path to a valid index.yaml file.')
    output_helpers.DisplayProposedConfigDeployments(project, [info])
    console_io.PromptContinue(default=True, throw_if_unattended=False,
                              cancel_on_no=True)

    client = appengine_client.AppengineClient()
    client.UpdateIndexes(info.parsed)