Пример #1
0
 def Run(self, args):
     command_executor = anthoscli_backend.AnthosCliWrapper()
     response = command_executor(command='get',
                                 repo_uri=args.REPO_URI,
                                 local_dest=args.LOCAL_DIR,
                                 show_exec_error=args.show_exec_error,
                                 file_pattern=args.PATTERN)
     return self._DefaultOperationResponseHandler(response)
Пример #2
0
 def Run(self, args):
     command_executor = anthoscli_backend.AnthosCliWrapper()
     response = command_executor(
         command='desc',
         local_dir=args.LOCAL_DIR,
         env=anthoscli_backend.GetEnvArgsForCommand(),
         show_exec_error=args.show_exec_error)
     return self._DefaultOperationResponseHandler(response)
Пример #3
0
 def Run(self, args):
     command_executor = anthoscli_backend.AnthosCliWrapper()
     apply_project = args.project or properties.VALUES.core.project.Get()
     log.status.Print('Applying Package [{}] using project [{}]'.format(
         args.LOCAL_DIR, apply_project))
     response = command_executor(command='apply',
                                 apply_dir=args.LOCAL_DIR,
                                 project=apply_project,
                                 show_exec_error=args.show_exec_error)
     return self._DefaultOperationResponseHandler(response)
Пример #4
0
 def Run(self, args):
   command_executor = anthoscli_backend.AnthosCliWrapper()
   apply_project = properties.VALUES.core.project.Get()
   auth_cred = anthoscli_backend.GetAuthToken(
       account=properties.VALUES.core.account.Get(), operation='apply')
   log.status.Print('Starting apply of package [{}] using '
                    'project [{}]'.format(args.LOCAL_DIR, apply_project))
   response = command_executor(command='apply',
                               apply_dir=args.LOCAL_DIR,
                               project=apply_project,
                               show_exec_error=args.show_exec_error,
                               env=anthoscli_backend.GetEnvArgsForCommand(
                                   extra_vars={'GCLOUD_AUTH_PLUGIN': 'true'}),
                               stdin=auth_cred)
   return self._DefaultOperationResponseHandler(response)
Пример #5
0
 def Run(self, args):
     is_verbose = args.verbosity == 'debug'
     command_executor = anthoscli_backend.AnthosCliWrapper()
     log.status.Print('Syncing dir [{}]'.format(args.LOCAL_DIR))
     # kpt update requires relative path
     work_dir, at_symbol, git_ref = args.LOCAL_DIR.partition('@')
     pkg_dir = at_symbol.join(['.', git_ref]) if git_ref else '.'
     response = command_executor(command='update',
                                 local_dir=pkg_dir,
                                 repo_uri=args.REPO_URI,
                                 strategy=args.strategy,
                                 dry_run=args.dry_run,
                                 verbose=is_verbose,
                                 show_exec_error=args.show_exec_error,
                                 execution_dir=work_dir)
     return self._DefaultOperationResponseHandler(response)
Пример #6
0
 def Run(self, args):
     command_executor = anthoscli_backend.AnthosCliWrapper()
     apply_project = properties.VALUES.core.project.Get()
     auth_cred = anthoscli_backend.GetAuthToken(
         account=properties.VALUES.core.account.Get(), operation='apply')
     log.status.Print('Starting apply of package [{}] using '
                      'project [{}]'.format(args.LOCAL_DIR, apply_project))
     with progress_tracker.ProgressTracker('Apply Running ...',
                                           interruptable=True):
         response = command_executor(
             command='apply',
             apply_dir=args.LOCAL_DIR,
             project=apply_project,
             show_exec_error=args.show_exec_error,
             env=anthoscli_backend.GetEnvArgsForCommand(),
             stdin=auth_cred)
         return self._DefaultOperationResponseHandler(response)
Пример #7
0
    def Run(self, args):
        command_executor = anthoscli_backend.AnthosCliWrapper()
        export_project = args.project or properties.VALUES.core.project.Get()
        cluster = args.CLUSTER or properties.VALUES.compute.zone.Get()
        location = args.location
        output_dir = args.OUTPUT_DIRECTORY
        auth_cred = anthoscli_backend.GetAuthToken(
            account=properties.VALUES.core.account.Get(), operation='export')

        log.status.Print('Starting export of cluster [{}] using '
                         'project [{}]'.format(cluster, export_project))
        response = command_executor(
            command='export',
            cluster=cluster,
            project=export_project,
            location=location,
            output_dir=output_dir,
            show_exec_error=args.show_exec_error,
            env=anthoscli_backend.GetEnvArgsForCommand(
                extra_vars={'GCLOUD_AUTH_PLUGIN': 'true'}),
            stdin=auth_cred)
        return self._DefaultOperationResponseHandler(response)