Beispiel #1
0
    def _kubectl_call(self,
                      args,
                      std_input=None,
                      retry_delay_sec=_KUBECTL_RETRY_DELAY_SEC,
                      retries=_KUBECTL_RETRIES):
        """Make a kubectl CLI call.

    Args:
      args: (list)  A list of arguments (type string) to pass to Popen call.
      std_input: (str) standard input to be passed.
      retry_delay_sec: (int) delay in retries.
      retries: (int) number of retries.

    Returns:
      stdout of process call.
    """
        return process_util.run_command(args,
                                        std_input=std_input,
                                        retry_delay_sec=retry_delay_sec,
                                        retries=retries)
Beispiel #2
0
  def _gcloud_call(self,
                   args,
                   retry_delay_sec=_GCLOUD_RETRY_DELAY_SEC,
                   retries=_GCLOUD_RETRIES):
    """Make a gcloud CLI call.

    Args:
      args: (list)  A list of arguments (type string) to pass to Popen  call.
      retry_delay_sec: (int) delay in retries.
      retries: (int) number of retries.

    Returns:
      stdout of process call.
    """
    if self._cluster_region:
      args.extend(['--region', self._cluster_region])
    if self._cluster_zone:
      args.extend(['--zone', self._cluster_zone])
    return process_util.run_command(
        args, retry_delay_sec=retry_delay_sec, retries=retries)