Skip to content

Commit

Permalink
Rebase fix ups
Browse files Browse the repository at this point in the history
  • Loading branch information
dturn committed Nov 16, 2019
1 parent b6277a4 commit b4d3edf
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 15 deletions.
2 changes: 1 addition & 1 deletion lib/krane/cli/deploy_command.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def self.from_options(namespace, context, options)
namespace: namespace,
context: context,
current_sha: options['current-sha'],
filenames: filenames,
filenames: paths,
bindings: bindings_parser.parse,
logger: logger,
global_timeout: ::Krane::DurationParser.new(options["global-timeout"]).parse!.to_i,
Expand Down
18 changes: 8 additions & 10 deletions lib/krane/deploy_task.rb
Original file line number Diff line number Diff line change
Expand Up @@ -84,33 +84,31 @@ def server_version

# Initializes the deploy task
#
# @param namespace [String] Kubernetes namespace
# @param context [String] Kubernetes context
# @param namespace [String] Kubernetes namespace (*required*)
# @param context [String] Kubernetes context (*required*)
# @param current_sha [String] The SHA of the commit
# @param logger [Object] Logger object (defaults to an instance of Krane::FormattedLogger)
# @param kubectl_instance [Kubectl] Kubectl instance
# @param bindings [Hash] Bindings parsed by Krane::BindingsParser
# @param max_watch_seconds [Integer] Timeout in seconds
# @param global_timeout [Integer] Timeout in seconds
# @param selector [Hash] Selector(s) parsed by Krane::LabelSelector
# @param template_paths [Array<String>] An array of template paths
# @param filenames [Array<String>] An array of filenames and/or directories containing templates (*required*)
# @param protected_namespaces [Array<String>] Array of protected Kubernetes namespaces (defaults
# to Krane::DeployTask::PROTECTED_NAMESPACES)
# @param render_erb [Boolean] Enable ERB rendering
def initialize(namespace:, context:, current_sha:, logger: nil, kubectl_instance: nil, bindings: {},
max_watch_seconds: nil, selector: nil, template_paths: [], protected_namespaces: nil,
global_timeout: nil, selector: nil, filenames: [], protected_namespaces: nil,
render_erb: true)
template_paths = (template_paths.map { |path| File.expand_path(path) }).compact

@logger = logger || Krane::FormattedLogger.build(namespace, context)
@template_sets = TemplateSets.from_dirs_and_files(paths: template_paths, logger: @logger)
@template_sets = TemplateSets.from_dirs_and_files(paths: filenames, logger: @logger)
@task_config = Krane::TaskConfig.new(context, namespace, @logger)
@bindings = bindings
@namespace = namespace
@namespace_tags = []
@context = context
@current_sha = current_sha
@kubectl = kubectl_instance
@max_watch_seconds = max_watch_seconds
@global_timeout = global_timeout
@selector = selector
@protected_namespaces = protected_namespaces || PROTECTED_NAMESPACES
@render_erb = render_erb
Expand Down Expand Up @@ -185,7 +183,7 @@ def run!(verify_result: true, prune: true)

def resource_deployer
@resource_deployer ||= Krane::ResourceDeployer.new(task_config: @task_config,
prune_whitelist: prune_whitelist, max_watch_seconds: @max_watch_seconds,
prune_whitelist: prune_whitelist, global_timeout: @global_timeout,
selector: @selector, statsd_tags: statsd_tags, current_sha: @current_sha)
end

Expand Down
4 changes: 2 additions & 2 deletions test/exe/deploy_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def test_deploy_parses_std_in_without_filenames
Dir.mktmpdir do |tmp_path|
$stdin.expects("read").returns("")
Dir.expects(:mktmpdir).with("krane").yields(tmp_path)
set_krane_deploy_expectations(new_args: { template_paths: [tmp_path] })
set_krane_deploy_expectations(new_args: { filenames: [tmp_path] })
krane_deploy!(flags: '--stdin')
end
end
Expand All @@ -79,7 +79,7 @@ def test_deploy_parses_std_in
Dir.mktmpdir do |tmp_path|
$stdin.expects("read").returns("")
Dir.expects(:mktmpdir).with("krane").yields(tmp_path)
set_krane_deploy_expectations(new_args: { template_paths: ['/my/file/path', tmp_path] })
set_krane_deploy_expectations(new_args: { filenames: ['/my/file/path', tmp_path] })
krane_deploy!(flags: '-f /my/file/path --stdin')
end
end
Expand Down
4 changes: 2 additions & 2 deletions test/exe/render_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def test_render_parses_std_in
file_path = "/dev/null"
$stdin.expects("read").returns("")
Dir.expects(:mktmpdir).with("krane").yields(tmp_path)
install_krane_render_expectations(template_paths: [file_path, tmp_path])
install_krane_render_expectations(filenames: [file_path, tmp_path])
krane_render!("--filenames #{file_path} --stdin")
end
end
Expand All @@ -31,7 +31,7 @@ def test_render_parses_std_in_without_filenames
Dir.mktmpdir do |tmp_path|
$stdin.expects("read").returns("")
Dir.expects(:mktmpdir).with("krane").yields(tmp_path).once
install_krane_render_expectations(template_paths: [tmp_path])
install_krane_render_expectations(filenames: [tmp_path])
krane_render!("--stdin")
end
end
Expand Down

0 comments on commit b4d3edf

Please sign in to comment.