permit blank chef_client_options
This commit is contained in:
parent
80ca2d7ad1
commit
f079363fe4
@ -31,8 +31,7 @@ module Devops
|
|||||||
::Validators::FieldValidator::Expires]
|
::Validators::FieldValidator::Expires]
|
||||||
|
|
||||||
set_field_validators :chef_client_options, [::Validators::FieldValidator::Nil,
|
set_field_validators :chef_client_options, [::Validators::FieldValidator::Nil,
|
||||||
::Validators::FieldValidator::FieldType::String,
|
::Validators::FieldValidator::FieldType::String]
|
||||||
::Validators::FieldValidator::NotEmpty]
|
|
||||||
|
|
||||||
def initialize d={}
|
def initialize d={}
|
||||||
self.identifier = d["identifier"]
|
self.identifier = d["identifier"]
|
||||||
|
|||||||
@ -394,7 +394,7 @@ module Devops
|
|||||||
@out.flush
|
@out.flush
|
||||||
cmd << " -j http://#{DevopsConfig.config[:address]}:#{DevopsConfig.config[:port]}/#{DevopsConfig.config[:url_prefix]}/v2.0/deploy/data/#{file}"
|
cmd << " -j http://#{DevopsConfig.config[:address]}:#{DevopsConfig.config[:port]}/#{DevopsConfig.config[:url_prefix]}/v2.0/deploy/data/#{file}"
|
||||||
else
|
else
|
||||||
if @deploy_env.chef_client_options
|
if @deploy_env.chef_client_options && !@deploy_env.chef_client_options.empty?
|
||||||
cmd << " #{@deploy_env.chef_client_options}"
|
cmd << " #{@deploy_env.chef_client_options}"
|
||||||
else
|
else
|
||||||
cmd << " -r #{deploy_info["run_list"].join(",")}" unless @server.stack.nil?
|
cmd << " -r #{deploy_info["run_list"].join(",")}" unless @server.stack.nil?
|
||||||
|
|||||||
@ -581,6 +581,12 @@ RSpec.describe Devops::Executor::ServerExecutor, type: :executor, stubbed_connec
|
|||||||
expect(stubbed_knife).to receive(:ssh_stream).with(anything, 'chef-client --no-color -r role', any_args)
|
expect(stubbed_knife).to receive(:ssh_stream).with(anything, 'chef-client --no-color -r role', any_args)
|
||||||
deploy_server
|
deploy_server
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "doesn't use deploy_env's chef_client_options if it's blank string" do
|
||||||
|
deploy_env.chef_client_options = ''
|
||||||
|
expect(stubbed_knife).to receive(:ssh_stream).with(anything, 'chef-client --no-color', any_args)
|
||||||
|
deploy_server
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
it "uses server's key" do
|
it "uses server's key" do
|
||||||
|
|||||||
@ -10,7 +10,7 @@ RSpec.shared_examples 'deploy env' do
|
|||||||
include_examples 'field type validation', :run_list, :not_nil, :maybe_empty_array, :run_list, :field_validator
|
include_examples 'field type validation', :run_list, :not_nil, :maybe_empty_array, :run_list, :field_validator
|
||||||
include_examples 'field type validation', :users, :not_nil, :maybe_empty_array, :field_validator
|
include_examples 'field type validation', :users, :not_nil, :maybe_empty_array, :field_validator
|
||||||
include_examples 'field type validation', :expires, :maybe_nil, :non_empty_string, :field_validator
|
include_examples 'field type validation', :expires, :maybe_nil, :non_empty_string, :field_validator
|
||||||
include_examples 'field type validation', :chef_client_options, :maybe_nil, :non_empty_string, :field_validator
|
include_examples 'field type validation', :chef_client_options, :maybe_nil, :maybe_empty_string, :field_validator
|
||||||
|
|
||||||
it 'should be valid only with all users available' do
|
it 'should be valid only with all users available' do
|
||||||
expect(build(validated_model_name, users: ['root'])).to be_valid
|
expect(build(validated_model_name, users: ['root'])).to be_valid
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user