diff options
author | GenPage <dpage@digitalocean.com> | 2016-03-10 17:23:00 -0500 |
---|---|---|
committer | Tim Smith <tsmith@chef.io> | 2017-02-23 12:54:50 -0800 |
commit | bc969d5c54ac859f7da027d3372a06608d35ab0b (patch) | |
tree | 423f5b5be4770ccf4ec39ade8477d221ee66a26f | |
parent | bb08248c57f038aec147232298b9461c3db1eaa0 (diff) | |
download | ohai-bc969d5c54ac859f7da027d3372a06608d35ab0b.tar.gz |
Remove debug code/add proper has_do_init check. Attempt to fix failing tests
-rw-r--r-- | lib/ohai/plugins/digital_ocean.rb | 7 | ||||
-rw-r--r-- | spec/unit/plugins/digital_ocean_spec.rb | 17 |
2 files changed, 21 insertions, 3 deletions
diff --git a/lib/ohai/plugins/digital_ocean.rb b/lib/ohai/plugins/digital_ocean.rb index 19cb087b..f64f1760 100644 --- a/lib/ohai/plugins/digital_ocean.rb +++ b/lib/ohai/plugins/digital_ocean.rb @@ -30,9 +30,10 @@ Ohai.plugin(:DigitalOcean) do def has_do_init? if File.exist?(DO_CLOUD_INIT_FILE) datasource = YAML.load_file(DO_CLOUD_INIT_FILE) - puts datasource.inspect - Ohai::Log.debug("digital_ocean plugin: has_do_init? == true") - true + if datasource['datasource_list'].include?("DigitalOcean") + Ohai::Log.debug("digital_ocean plugin: has_do_init? == true") + true + end else Ohai::Log.debug("digital_ocean plugin: has_do_init? == false") false diff --git a/spec/unit/plugins/digital_ocean_spec.rb b/spec/unit/plugins/digital_ocean_spec.rb index a593451a..682ea73a 100644 --- a/spec/unit/plugins/digital_ocean_spec.rb +++ b/spec/unit/plugins/digital_ocean_spec.rb @@ -157,6 +157,7 @@ describe Ohai::System, "plugin digital_ocean" do allow(plugin).to receive(:hint?).with("digital_ocean").and_return(false) end +<<<<<<< HEAD describe "with the /etc/digitalocean file" do before do allow(File).to receive(:exist?).with(digitalocean_path).and_return(true) @@ -170,6 +171,22 @@ describe Ohai::System, "plugin digital_ocean" do allow(File).to receive(:exist?).with(digitalocean_path).and_return(false) end it_behaves_like "!digital_ocean" +======= + yaml_example = <<-EOF + datasource_list: [ DigitalOcean, None ] + datasource: + DigitalOcean: + retries: 5 + timeout: 10 + + vendor_data: + enabled: True + EOF + + before(:each) do + expect(File).to receive(:exist?).with("/etc/cloud/cloud.cfg").and_return(true) + allow(File).to receive(:read).with("/etc/cloud/cloud.cfg").and_return(yaml_example) +>>>>>>> Remove debug code/add proper has_do_init check. Attempt to fix failing tests end end end |