Exemplo n.º 1
0
  def Run(self, args):
    env_ref = args.CONCEPTS.environment.Parse()

    if args.airflow_version:
      # Converts airflow_version arg to image_version arg
      args.image_version = (
          image_versions_command_util.ImageVersionFromAirflowVersion(
              args.airflow_version))

    # Checks validity of image_version upgrade request.
    if (args.image_version and
        not image_versions_command_util.IsValidImageVersionUpgrade(
            env_ref, args.image_version, self.ReleaseTrack())):
      raise command_util.InvalidUserInputError(
          'Invalid environment upgrade. [Requested: {}]'.format(
              args.image_version))

    # Checks validity of update_web_server_allow_ip
    if (self.ReleaseTrack() == base.ReleaseTrack.BETA and
        args.update_web_server_allow_ip):
      flags.ValidateIpRanges(
          [acl['ip_range'] for acl in args.update_web_server_allow_ip])

    field_mask, patch = self._ConstructPatch(
        env_ref, args, UpdateBeta.support_environment_upgrades,
        UpdateBeta.support_web_server_access_control, True, True)

    return patch_util.Patch(
        env_ref,
        field_mask,
        patch,
        args.async_,
        release_track=self.ReleaseTrack())
Exemplo n.º 2
0
    def Run(self, args):
        env_ref = args.CONCEPTS.environment.Parse()

        if args.airflow_version:
            # Converts airflow_version arg to image_version arg
            args.image_version = (
                image_versions_command_util.ImageVersionFromAirflowVersion(
                    args.airflow_version))

        # Checks validity of image_version upgrade request.
        if (args.image_version
                and not image_versions_command_util.IsValidImageVersionUpgrade(
                    env_ref, args.image_version, self.ReleaseTrack())):
            raise command_util.InvalidUserInputError(
                'Invalid environment upgrade. [Requested: {}]'.format(
                    args.image_version))

        field_mask, patch = self._ConstructPatch(
            env_ref, args, UpdateBeta.support_environment_upgrades)

        return patch_util.Patch(env_ref,
                                field_mask,
                                patch,
                                args.async_,
                                release_track=self.ReleaseTrack())