factor-connector-chef 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- N2YxNDgyYzg1YWE0NTYzODc0NjdkYjBjMjE0MDEwODViZGNhODgyOA==
4
+ M2YwNzhjMWUwNjU5MzllMDMzNmQyZDJhMDkwMjQ0MTVlNGFlMzBhZA==
5
5
  data.tar.gz: !binary |-
6
- YmFmNWVlZjExNzVlNjM1MjViYmQ5ZmNiNGEzZTIzNjQwODBiZmZkYw==
6
+ MTQ0ZjgyN2NlMmEwNWY5MTRmOGYwOGE3NWNjN2QyYmY0NTBkODgwMg==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- MWM5MDlmNDJjNzYzM2FlYTczNjc5N2Y1ZTQzZGNlNTU4ZjUxYjRjZWExMGU1
10
- MTdiOTQzNGVhN2ZlNmY2NjBlZGE3ZmI1ZjY0YWZlZTk4MzEyYTE5NTE1NmJm
11
- YjY0YTE4YTIzMGRhM2VhNjA2MjViMTgwOTg0Y2ZiMDI2MjJiYzM=
9
+ ZDJhY2IwYThiNWFiMjQzYWNhMWQ2OWZiMjQ3OWMzZDM3OWEyMDQ4ZDdmNGQx
10
+ ZjMyNGFlYThlZTk3MjY5MTM5ODVmYjUxYzliZmQ4MDk0ODllMDljZDFmYTA0
11
+ MmJkMGJhMDE2NzI0YWI1MGUxOTZmNDJkMDI1MGQ4OWY4MmZlZGY=
12
12
  data.tar.gz: !binary |-
13
- MjAyODc1NDFiNjBmNGZjYWM3YzdjYWNjOWUxZmI2MzZhN2FiNjMxZTVmNzY4
14
- NGFhOGFiM2FmODU2NjMxNWUxYzIyNmU5ZjFlYzM4ZTc3MmRhNTdiYjI4MTE3
15
- NGY0YjE1ODliZTQ4M2Q3MDhiMDUzZjJiNTQ2OWI0ZThlOWY0MWU=
13
+ MDZkZWJiMTllNDI1MzJkODBhN2ZlNzEwMTVkMmUxODc4Y2JhMzIxNGIzZGZj
14
+ NGI1ZWQ0ZTJkNGVjMmEzNWE1NTM5NmIxNTQyMjIyN2MwZDI3YzgwNGU5NzZh
15
+ ODJlOGM3YWUxZjU5ODQwNzIyMDU4ZDAwN2UwOWE1YzkwNTk5Nzg=
@@ -31,6 +31,7 @@ Factor::Connector.service 'chef_clients' do
31
31
  }
32
32
 
33
33
  begin
34
+ info "Fetching all clients"
34
35
  chef = ChefAPI::Connection.new connection_settings
35
36
  clients = chef.clients.all
36
37
  rescue => ex
@@ -71,6 +72,7 @@ Factor::Connector.service 'chef_clients' do
71
72
  }
72
73
 
73
74
  begin
75
+ info "Fetching client '#{id}'"
74
76
  chef = ChefAPI::Connection.new connection_settings
75
77
  content = chef.clients.fetch(id)
76
78
  rescue => ex
@@ -159,8 +161,10 @@ Factor::Connector.service 'chef_clients' do
159
161
  }
160
162
 
161
163
  begin
164
+ info "Fetching client '#{id}'"
162
165
  chef = ChefAPI::Connection.new connection_settings
163
166
  content = chef.clients.fetch(id)
167
+ info "Destroying client '#{id}'"
164
168
  content.destroy
165
169
  rescue => ex
166
170
  fail ex.message
@@ -32,6 +32,7 @@ Factor::Connector.service 'chef_databags' do
32
32
  }
33
33
 
34
34
  begin
35
+ info "Fetching all data bags"
35
36
  chef = ChefAPI::Connection.new connection_settings
36
37
  contents = chef.data_bags.all
37
38
  rescue => ex
@@ -72,6 +73,7 @@ Factor::Connector.service 'chef_databags' do
72
73
  }
73
74
 
74
75
  begin
76
+ info "Fetching data bag '#{id}'"
75
77
  chef = ChefAPI::Connection.new connection_settings
76
78
  data_bag = chef.data_bags.fetch(id)
77
79
  content = data_bag.to_hash
@@ -115,6 +117,7 @@ Factor::Connector.service 'chef_databags' do
115
117
  }
116
118
 
117
119
  begin
120
+ info "Creating new data bag '#{name}'"
118
121
  chef = ChefAPI::Connection.new connection_settings
119
122
  data_bag = chef.data_bags.create(name: name)
120
123
  content = chef.data_bags.fetch(name)
@@ -158,6 +161,7 @@ Factor::Connector.service 'chef_databags' do
158
161
  }
159
162
 
160
163
  begin
164
+ info "Updating data bag name from '#{id}' to '#{name}'"
161
165
  chef = ChefAPI::Connection.new connection_settings
162
166
  data_bag = chef.data_bags.update(id, name:name)
163
167
  content = data_bag.to_hash
@@ -200,8 +204,10 @@ Factor::Connector.service 'chef_databags' do
200
204
  }
201
205
 
202
206
  begin
207
+ info "Fetching data bag '#{id}'"
203
208
  chef = ChefAPI::Connection.new connection_settings
204
209
  content = chef.data_bags.fetch(id)
210
+ info "Destroying data bag '#{id}'"
205
211
  content.destroy
206
212
  rescue => ex
207
213
  fail ex.message
@@ -241,10 +247,12 @@ Factor::Connector.service 'chef_databags' do
241
247
  }
242
248
 
243
249
  begin
250
+ info "Fetching Data Bag '#{id}'"
244
251
  chef = ChefAPI::Connection.new connection_settings
245
252
  data_bag = chef.data_bags.fetch(id)
246
253
  data_bag_items =
247
254
  contents = {}
255
+ info "Fetching all items for Data Bag '#{id}'"
248
256
  data_bag.items.all.each do |item|
249
257
  contents[item.id.to_s] = item.data
250
258
  end
@@ -288,8 +296,10 @@ Factor::Connector.service 'chef_databags' do
288
296
  }
289
297
 
290
298
  begin
299
+ info "Fetching data bag '#{databag_id}'"
291
300
  chef = ChefAPI::Connection.new connection_settings
292
301
  data_bag = chef.data_bags.fetch(databag_id)
302
+ info "Fetching items for data bag '#{databag_id}'"
293
303
  item = data_bag.items.fetch(id)
294
304
  content = item.data
295
305
  rescue => ex
@@ -335,10 +345,13 @@ Factor::Connector.service 'chef_databags' do
335
345
  }
336
346
 
337
347
  begin
348
+ info "Fetching data bag '#{databag_id}'"
338
349
  chef = ChefAPI::Connection.new connection_settings
339
350
  data_bag = chef.data_bags.fetch(databag_id)
351
+ info "Fetching data bag item '#{id}'"
340
352
  item = data_bag.items.fetch(id)
341
353
  item.data.deep_merge! data
354
+ info "Saving data bag item '#{id}'"
342
355
  item.save
343
356
  content = data_bag.items.fetch(id).data.to_hash
344
357
  rescue => ex
@@ -381,9 +394,12 @@ Factor::Connector.service 'chef_databags' do
381
394
  }
382
395
 
383
396
  begin
397
+ info "Fetching Data Bag '#{databag_id}'"
384
398
  chef = ChefAPI::Connection.new connection_settings
385
399
  data_bag = chef.data_bags.fetch(databag_id)
400
+ info "Fetching Data Bag Item '#{id}'"
386
401
  item = data_bag.items.fetch(id)
402
+ info "Destroying Data Bag Item '#{id}'"
387
403
  item.destroy
388
404
  rescue => ex
389
405
  fail ex.message
@@ -428,8 +444,10 @@ Factor::Connector.service 'chef_databags' do
428
444
  }
429
445
 
430
446
  begin
447
+ info "Fetching Data Bag '#{databag_id}'"
431
448
  chef = ChefAPI::Connection.new connection_settings
432
449
  data_bag = chef.data_bags.fetch(databag_id)
450
+ info "Creating new Data Bag Item '#{id}'"
433
451
  item = data_bag.items.create({id:id}.merge(data))
434
452
  content = item.to_hash
435
453
  rescue => ex
@@ -32,6 +32,7 @@ Factor::Connector.service 'chef_environments' do
32
32
  }
33
33
 
34
34
  begin
35
+ info "Pulling up all envioronments"
35
36
  chef = ChefAPI::Connection.new connection_settings
36
37
  contents = chef.environments.all
37
38
  rescue => ex
@@ -72,6 +73,7 @@ Factor::Connector.service 'chef_environments' do
72
73
  }
73
74
 
74
75
  begin
76
+ info "Fetching environment '#{id}'"
75
77
  chef = ChefAPI::Connection.new connection_settings
76
78
  content = chef.environments.fetch(id)
77
79
  rescue => ex
@@ -170,16 +172,32 @@ Factor::Connector.service 'chef_environments' do
170
172
  end
171
173
 
172
174
  begin
173
- info "Creating new environment '#{env_params['name']}'"
174
175
  chef = ChefAPI::Connection.new connection_settings
175
- environment = chef.environments.update(id, env_params) if env_params != {}
176
+
177
+ if env_params != {}
178
+ info "Updating environment name from '#{id}' to '#{env_params[:name]}'" if env_params[:name]
179
+ info "Updating environment description" if env_params[:description]
180
+ chef.environments.update(id, env_params)
181
+ end
176
182
 
177
183
  if params['default_attributes'] || params['override_attributes'] || params['cookbook_versions']
178
184
  environment = chef.environments.fetch(id)
179
- environment.default_attributes.deep_merge!(params['default_attributes']) if params['default_attributes']
180
- environment.override_attributes.deep_merge!(params['override_attributes']) if params['override_attributes']
181
- environment.cookbook_versions.deep_merge!(params['cookbook_versions']) if params['cookbook_versions']
182
- environment.save
185
+ if params['default_attributes']
186
+ info "Updating default_attributes"
187
+ environment.default_attributes.deep_merge!(params['default_attributes'])
188
+ end
189
+ if params['override_attributes']
190
+ info "Updating override_attributes"
191
+ environment.override_attributes.deep_merge!(params['override_attributes'])
192
+ end
193
+ if params['cookbook_versions']
194
+ info "Updating cookbook_versions"
195
+ environment.cookbook_versions.deep_merge!(params['cookbook_versions'])
196
+ end
197
+
198
+ info "Saving changes to attributes"
199
+ saved = environment.save
200
+ fail "Couldn't save the environment" unless saved
183
201
  end
184
202
  content = chef.environments.fetch(id)
185
203
  rescue => ex
@@ -220,8 +238,10 @@ Factor::Connector.service 'chef_environments' do
220
238
  }
221
239
 
222
240
  begin
241
+ info "Fetching environment '#{id}'"
223
242
  chef = ChefAPI::Connection.new connection_settings
224
243
  content = chef.environments.fetch(id)
244
+ info "Destroying environment '#{id}'"
225
245
  content.destroy
226
246
  rescue => ex
227
247
  fail ex.message
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: factor-connector-chef
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Maciej Skierkowski
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-23 00:00:00.000000000 Z
11
+ date: 2015-01-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: net-ssh