class Krane::CLI::GlobalDeployCommand
Constants
- DEFAULT_DEPLOY_TIMEOUT
- OPTIONS
Public Class Methods
from_options(context, options)
click to toggle source
# File lib/krane/cli/global_deploy_command.rb, line 28 def self.from_options(context, options) require 'krane/global_deploy_task' require 'krane/options_helper' require 'krane/label_selector' require 'krane/duration_parser' selector = ::Krane::LabelSelector.parse(options[:selector]) selector_as_filter = options['selector-as-filter'] if selector_as_filter && !selector raise(Thor::RequiredArgumentMissingError, '--selector must be set when --selector-as-filter is set') end filenames = options[:filenames].dup filenames << "-" if options[:stdin] if filenames.empty? raise(Thor::RequiredArgumentMissingError, '--filenames must be set and not empty') end ::Krane::OptionsHelper.with_processed_template_paths(filenames) do |paths| deploy = ::Krane::GlobalDeployTask.new( context: context, filenames: paths, global_timeout: ::Krane::DurationParser.new(options["global-timeout"]).parse!.to_i, selector: selector, selector_as_filter: selector_as_filter, ) deploy.run!( verify_result: options["verify-result"], prune: options[:prune], ) end end