abiquo-chef-agent 2.0.4 → 2.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/Gemfile CHANGED
@@ -1,6 +1,9 @@
1
+ source 'https://rubygems.org'
2
+
1
3
  group :development do
2
- gem "rspec", ">= 0"
3
- gem "bundler", "~> 1.0.0"
4
+ gem "rspec"
5
+ gem "rspec-collection_matchers"
4
6
  gem "jeweler"
5
7
  gem "simplecov", ">= 0"
8
+ gem "xml-simple"
6
9
  end
data/bin/abiquo-chef-run CHANGED
@@ -163,9 +163,7 @@ else
163
163
  log "done"
164
164
 
165
165
  #
166
- # Everything in place, no run the client
167
- #
168
- # first, we run it once to register and apply recipes
166
+ # Everything in place, so run the client
169
167
  cmd = "chef-client -N #{node_name} --once -j /etc/chef/first-boot.json -L /var/log/chef-client.log"
170
168
  log "Running chef-client first time"
171
169
  log cmd
@@ -184,22 +182,5 @@ else
184
182
  if $? != 0
185
183
  log "chef-client run failed", :error
186
184
  log output, :info
187
- else
188
- log "Running chef-client in daemon mode"
189
- # Run the chef-client if not already running
190
- if not (`ps aux|grep "chef-client "| grep -v grep|wc -l`.to_i > 0)
191
- # Now we run it in daemon mode
192
- cmd = "chef-client -N #{node_name} -i 1800 -d -L /var/log/chef-client.log"
193
- output = `#{cmd}`
194
- if $? != 0
195
- log "Running chef-client in daemon mode failed.", :error
196
- log output
197
- else
198
- log "Success."
199
- end
200
- else
201
- log "chef-client already running."
202
- log `ps aux|grep "chef-client "| grep -v grep`
203
- end
204
185
  end
205
186
  end
data/install.sh CHANGED
@@ -7,7 +7,7 @@ fi
7
7
 
8
8
  DIST="dist/centos"
9
9
 
10
- echo "Installing ntp..."
10
+ echo "Installing NTP..."
11
11
  yum --quiet --assumeyes install ntp
12
12
 
13
13
  echo "Installing Chef..."
@@ -23,6 +23,11 @@ chmod +x /etc/init.d/abiquo-chef-run
23
23
  chkconfig --add abiquo-chef-run
24
24
  chkconfig abiquo-chef-run on
25
25
 
26
+ echo "Configuring DHCP..."
26
27
  cp ${DIST}/dhclient.conf /etc/dhcp/
28
+ IFACES=`ip link show | grep ^[0-9]: | grep -iv loopback | cut -d: -f2 | tr -d ' '`
29
+ for IFACE in ${IFACES}; do
30
+ cp ${DIST}/dhclient.conf /etc/dhcp/dhclient-${IFACE}.conf
31
+ done
27
32
 
28
33
  echo "Done!"
@@ -5,7 +5,7 @@ require 'time'
5
5
  module Abiquo
6
6
  module Chef
7
7
 
8
- VERSION="2.0.4"
8
+ VERSION="2.0.5"
9
9
 
10
10
  class Config
11
11
  def self.chef_config_dir
data/spec/spec_helper.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  require 'rubygems'
2
- require 'rspec/autorun'
3
2
  require 'simplecov'
3
+ require 'rspec/collection_matchers'
4
4
 
5
5
  SimpleCov.start do
6
6
  add_filter '/spec/'
@@ -83,16 +83,16 @@ describe "Bootstrap Config Parser" do
83
83
 
84
84
  describe "name" do
85
85
  it "should be a string" do
86
- @cp.node_name.should be_a(String)
86
+ expect(@cp.node_name).to be_a(String)
87
87
  end
88
88
  it "should start with ABQ-" do
89
- @cp.node_name.should match(/^ABQ-/)
89
+ expect(@cp.node_name).to match(/^ABQ-/)
90
90
  end
91
91
  end
92
92
 
93
93
  describe "node_config" do
94
94
  it "should be a Hash" do
95
- @cp.node_config.should be_a(Hash)
95
+ expect(@cp.node_config).to be_a(Hash)
96
96
  end
97
97
 
98
98
  it "runlist should be an empty missing" do
@@ -101,22 +101,22 @@ describe "Bootstrap Config Parser" do
101
101
  end
102
102
 
103
103
  it "should have three elements" do
104
- @cp.node_config.should have(3).items
104
+ expect(@cp.node_config).to have(3).items
105
105
  end
106
106
 
107
107
  it "runlist should have a two items in the runlist" do
108
- @cp.node_config["run_list"].should have(2).items
108
+ expect(@cp.node_config["run_list"]).to have(2).items
109
109
  end
110
110
 
111
111
  it "should be an array of strings" do
112
112
  @cp.node_config["run_list"].each do |i|
113
- i.should be_a(String)
113
+ expect(i).to be_a(String)
114
114
  end
115
115
  end
116
116
 
117
117
  it "should have a recipe and a role" do
118
- @cp.node_config["run_list"].first.should match(/role\[/)
119
- @cp.node_config["run_list"].last.should match(/recipe\[/)
118
+ expect(@cp.node_config["run_list"].first).to match(/role\[/)
119
+ expect(@cp.node_config["run_list"].last).to match(/recipe\[/)
120
120
  end
121
121
 
122
122
  it "should contains boundary and newrelic" do
@@ -133,29 +133,29 @@ describe "Bootstrap Config Parser" do
133
133
 
134
134
  it "attributes should be missing" do
135
135
  cp = BootstrapConfigParser.new(File.read(data_dir + "bootstrap_empty_runlist_no_attributes.xml"))
136
- cp.node_config.size.should be(0)
136
+ expect(cp.node_config.size).to be(0)
137
137
  end
138
138
 
139
139
  end
140
140
 
141
141
  describe "chef-server-url" do
142
142
  it "should be a URL" do
143
- @cp.chef_server_url.should match(/^http(s)?:\/\//)
143
+ expect(@cp.chef_server_url).to match(/^http(s)?:\/\//)
144
144
  end
145
145
  end
146
146
 
147
147
  describe "validation-client-name" do
148
148
  it "should be a String" do
149
- @cp.validation_client_name.should be_a(String)
149
+ expect(@cp.validation_client_name).to be_a(String)
150
150
  end
151
151
  end
152
152
 
153
153
  describe "validation_cert" do
154
154
  it 'should start with -----BEGIN RSA PRIVATE KEY' do
155
- @cp.validation_cert.should match(/^-----BEGIN RSA PRIVATE KEY/)
155
+ expect(@cp.validation_cert).to match(/^-----BEGIN RSA PRIVATE KEY/)
156
156
  end
157
157
  it 'should end with END RSA PRIVATE KEY-----' do
158
- @cp.validation_cert.should match(/END RSA PRIVATE KEY-----$/)
158
+ expect(@cp.validation_cert).to match(/END RSA PRIVATE KEY-----$/)
159
159
  end
160
160
  end
161
161
 
@@ -8,31 +8,31 @@ describe Abiquo::Chef::Config do
8
8
  describe "default options" do
9
9
 
10
10
  it "should have a valid chef_config_dir" do
11
- @config.chef_config_dir.should be_a(String)
11
+ expect(@config.chef_config_dir).to be_a(String)
12
12
  end
13
13
 
14
14
  it "should have a valid ntp_server" do
15
- @config.ntp_server.should be_a(String)
15
+ expect(@config.ntp_server).to be_a(String)
16
16
  end
17
17
 
18
18
  it "should have a valid log_file" do
19
- @config.log_file.should be_a(String)
19
+ expect(@config.log_file).to be_a(String)
20
20
  end
21
21
 
22
22
  it "should have a valid bootstrap_backup_file" do
23
- @config.bootstrap_backup_file.should be_a(String)
23
+ expect(@config.bootstrap_backup_file).to be_a(String)
24
24
  end
25
25
 
26
26
  it "should have a valid validation_cert" do
27
- @config.validation_cert.should be_a(String)
27
+ expect(@config.validation_cert).to be_a(String)
28
28
  end
29
29
 
30
30
  it "should have a valid client_cert_file" do
31
- @config.client_cert_file.should be_a(String)
31
+ expect(@config.client_cert_file).to be_a(String)
32
32
  end
33
33
 
34
34
  it "should have a valid bootstrap xml mediatype" do
35
- @config.bootstrap_mediatype.should match(/^application\/vnd.abiquo.[a-z]+\+xml(;version=[0-9](\.[0-9]+)+)?$/)
35
+ expect(@config.bootstrap_mediatype).to match(/^application\/vnd.abiquo.[a-z]+\+xml(;version=[0-9](\.[0-9]+)+)?$/)
36
36
  end
37
37
 
38
38
  end
@@ -11,39 +11,39 @@ describe Util do
11
11
 
12
12
  describe 'parse_leases_file' do
13
13
  it 'parse leases file without error' do
14
- @leases.should be_a(Hash)
14
+ expect(@leases).to be_a(Hash)
15
15
  end
16
16
 
17
17
  it 'should not be empty' do
18
- @leases.should_not be_empty
18
+ expect(@leases).to_not be_empty
19
19
  end
20
20
 
21
21
  it 'should find a valid ip address' do
22
- @leases[:ip].should match(/([0-9]{1,3}\.){3}[0-9]{1,3}/)
22
+ expect(@leases[:ip]).to match(/([0-9]{1,3}\.){3}[0-9]{1,3}/)
23
23
  end
24
24
 
25
25
  it 'should have a valid API URL' do
26
- @leases[:abiquo_api_url].should match(/http(s)?:\/\//)
26
+ expect(@leases[:abiquo_api_url]).to match(/http(s)?:\/\//)
27
27
  end
28
28
 
29
29
  it 'should return latest lease' do
30
- @leases[:renew].should eql(Time.parse('2012-11-18 05:48:45 +0100'))
30
+ expect(@leases[:renew]).to eql(Time.parse('2012-11-18 05:48:45 +0100'))
31
31
  end
32
32
 
33
33
  it 'should have a valid token' do
34
- @leases[:abiquo_api_token].should have_at_least(5).characters
34
+ expect(@leases[:abiquo_api_token]).to have_at_least(5).characters
35
35
  end
36
36
 
37
37
  end
38
38
 
39
39
  describe 'find_leases_file' do
40
40
  it 'should find a lease file' do
41
- Util.find_leases_file([data_dir + "dhclient/"]).should have(1).item
41
+ expect(Util.find_leases_file([data_dir + "dhclient/"])).to have(1).item
42
42
  end
43
43
 
44
44
  it 'should return an empty list' do
45
- Util.find_leases_file([]).should have(0).items
46
- Util.find_leases_file(['/tmp']).should have(0).items
45
+ expect(Util.find_leases_file([])).to have(0).items
46
+ expect(Util.find_leases_file(['/tmp'])).to have(0).items
47
47
  end
48
48
  end
49
49
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: abiquo-chef-agent
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.4
4
+ version: 2.0.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2014-05-28 00:00:00.000000000 Z
15
+ date: 2015-02-11 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: rspec
@@ -31,21 +31,21 @@ dependencies:
31
31
  - !ruby/object:Gem::Version
32
32
  version: '0'
33
33
  - !ruby/object:Gem::Dependency
34
- name: bundler
34
+ name: rspec-collection_matchers
35
35
  requirement: !ruby/object:Gem::Requirement
36
36
  none: false
37
37
  requirements:
38
- - - ~>
38
+ - - ! '>='
39
39
  - !ruby/object:Gem::Version
40
- version: 1.0.0
40
+ version: '0'
41
41
  type: :development
42
42
  prerelease: false
43
43
  version_requirements: !ruby/object:Gem::Requirement
44
44
  none: false
45
45
  requirements:
46
- - - ~>
46
+ - - ! '>='
47
47
  - !ruby/object:Gem::Version
48
- version: 1.0.0
48
+ version: '0'
49
49
  - !ruby/object:Gem::Dependency
50
50
  name: jeweler
51
51
  requirement: !ruby/object:Gem::Requirement
@@ -78,6 +78,22 @@ dependencies:
78
78
  - - ! '>='
79
79
  - !ruby/object:Gem::Version
80
80
  version: '0'
81
+ - !ruby/object:Gem::Dependency
82
+ name: xml-simple
83
+ requirement: !ruby/object:Gem::Requirement
84
+ none: false
85
+ requirements:
86
+ - - ! '>='
87
+ - !ruby/object:Gem::Version
88
+ version: '0'
89
+ type: :development
90
+ prerelease: false
91
+ version_requirements: !ruby/object:Gem::Requirement
92
+ none: false
93
+ requirements:
94
+ - - ! '>='
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
81
97
  - !ruby/object:Gem::Dependency
82
98
  name: run-as-root
83
99
  requirement: !ruby/object:Gem::Requirement
@@ -225,6 +241,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
225
241
  - - ! '>='
226
242
  - !ruby/object:Gem::Version
227
243
  version: '0'
244
+ segments:
245
+ - 0
246
+ hash: 2626624219569308421
228
247
  required_rubygems_version: !ruby/object:Gem::Requirement
229
248
  none: false
230
249
  requirements: