We should not require that users use the Dashboard for node classification on order to bootstrap their nodes.
Classification with the Dashboard is only performed when node_group is set. Node group has also been updated to not be required. Unit tests that expect node_group to be required have been removed. Signed-off-by: Dan Bode <[email protected]> --- lib/puppet/cloudpack.rb | 9 ++++++++- spec/unit/puppet/face/node/bootstrap_spec.rb | 6 ------ spec/unit/puppet/face/node/classify_spec.rb | 13 +++++++------ spec/unit/puppet/face/node/init_spec.rb | 7 ------- 4 files changed, 15 insertions(+), 20 deletions(-) diff --git a/lib/puppet/cloudpack.rb b/lib/puppet/cloudpack.rb index 02c5a3d..0f74af6 100644 --- a/lib/puppet/cloudpack.rb +++ b/lib/puppet/cloudpack.rb @@ -295,7 +295,6 @@ module Puppet::CloudPack def add_classify_options(action) action.option '--node-group=', '--as=' do summary 'The Puppet Dashboard node group to add to.' - required end end @@ -310,6 +309,14 @@ module Puppet::CloudPack end def classify(certname, options) + if options[:node_group] + dashboard_classify(certname, options) + else + Puppet.info('No classification method selected') + end + end + + def dashboard_classify(certname, options) Puppet.info "Using http://#{Puppet[:report_server]}:#{Puppet[:report_port]} as Dashboard." http = Puppet::Network::HttpPool.http_instance(Puppet[:report_server], Puppet[:report_port]) diff --git a/spec/unit/puppet/face/node/bootstrap_spec.rb b/spec/unit/puppet/face/node/bootstrap_spec.rb index 4528ae5..9554c11 100644 --- a/spec/unit/puppet/face/node/bootstrap_spec.rb +++ b/spec/unit/puppet/face/node/bootstrap_spec.rb @@ -67,11 +67,5 @@ describe Puppet::Face[:node, :current] do end end - describe '(node-group)' do - it 'should require a provider' do - @options.delete(:node_group) - expect { subject.bootstrap(@options) }.to raise_error ArgumentError, /required/ - end - end end end diff --git a/spec/unit/puppet/face/node/classify_spec.rb b/spec/unit/puppet/face/node/classify_spec.rb index 20dad2c..96e0629 100644 --- a/spec/unit/puppet/face/node/classify_spec.rb +++ b/spec/unit/puppet/face/node/classify_spec.rb @@ -9,14 +9,15 @@ describe Puppet::Face[:node, :current] do end describe 'option validation' do - before :each do - Puppet::CloudPack.expects(:classify).never - end - describe '(node-group)' do - it 'should require a provider' do + it 'should not call dashboard_classify if node_group is not supplied' do @options.delete(:node_group) - expect { subject.classify('server', @options) }.to raise_error ArgumentError, /required/ + subject.expects(:dashboard_classify).never + subject.classify('server', @options) + end + it 'should call dashboard_classify if a node_group is specified' do + Puppet::CloudPack.expects(:dashboard_classify).with('server', @options).once + subject.classify('server', @options) end end end diff --git a/spec/unit/puppet/face/node/init_spec.rb b/spec/unit/puppet/face/node/init_spec.rb index cf1dee9..4b5e833 100644 --- a/spec/unit/puppet/face/node/init_spec.rb +++ b/spec/unit/puppet/face/node/init_spec.rb @@ -31,12 +31,5 @@ describe Puppet::Face[:node, :current] do end end - - describe '(node-group)' do - it 'should require a provider' do - @options.delete(:node_group) - expect { subject.init('server', @options) }.to raise_error ArgumentError, /required/ - end - end end end -- 1.7.5.4 -- You received this message because you are subscribed to the Google Groups "Puppet Developers" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/puppet-dev?hl=en.
