chef-provisioning 2.7.4 → 2.7.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: be98ba3591f5661543e300193d910ac31af983e1564eb60f44010e8b7c5bc691
4
- data.tar.gz: 71c376d649ba9692240db91a4b08d9ab4e443cce264025f8507b5350750ca218
3
+ metadata.gz: 382aac8438b01f83a92adb659914230b51d5a9cf280dd4b110d388327ae3c47a
4
+ data.tar.gz: eae6bcdbc36572fab55ec52d12254c92985f1c32585de5c9db547b09f752cfca
5
5
  SHA512:
6
- metadata.gz: 2a32e6859a074b5069900801765670a4358d2a396bd9175d7da629bf3f27bbd4cf5c2f2d5d16551e8be617e039add23394e907ef2087d6f4651177f5c83eee84
7
- data.tar.gz: 545356781d8b0218b2613aa2d8e2baf4e2440b1713be66f464b3276608bd9369ad320656903c77e6ba579d5a16f643be646793076306b401a842488ae94fc2c6
6
+ metadata.gz: 52e7e47c41dab2f86a05ee7d1822de21b012e6006c3d157041206856d02db9ab8fb438bc518c8815e2645d22cea72923bae5f9f2fb3a42f69bb5785e52d5be6c
7
+ data.tar.gz: ec300c793c7a620be16cac9232a7eef8169b1fbd72d7e4d1779647bd7469b49141943bb4b18e505223c523b5e24afde2e897c4f148b257d454840f09d5ce1633
@@ -41,6 +41,12 @@ class Machine < Chef::Provider::LWRPBase
41
41
  machine
42
42
  end
43
43
 
44
+ action :ready_only do
45
+ machine = current_driver.ready_machine(action_handler, machine_spec, current_machine_options)
46
+ machine_spec.save(action_handler)
47
+ machine
48
+ end
49
+
44
50
  action :setup do
45
51
  machine = action_ready
46
52
  begin
@@ -38,6 +38,10 @@ class MachineBatch < Chef::Provider::LWRPBase
38
38
  action :ready do
39
39
  with_ready_machines
40
40
  end
41
+
42
+ action :ready_only do
43
+ with_ready_machines_only
44
+ end
41
45
 
42
46
  action :setup do
43
47
  with_ready_machines do |m|
@@ -110,8 +114,8 @@ class MachineBatch < Chef::Provider::LWRPBase
110
114
  end
111
115
  end
112
116
 
113
- def with_ready_machines
114
- action_allocate
117
+ def with_ready_machines(ready_only: false)
118
+ action_allocate unless ready_only
115
119
  parallel_do(by_new_driver) do |driver, specs_and_options|
116
120
  driver.ready_machines(action_handler, specs_and_options, parallelizer) do |machine|
117
121
  machine.machine_spec.save(action_handler)
@@ -131,6 +135,10 @@ class MachineBatch < Chef::Provider::LWRPBase
131
135
  end
132
136
  end
133
137
 
138
+ def with_ready_machines_only
139
+ with_ready_machines(ready_only: true)
140
+ end
141
+
134
142
  def by_id
135
143
  @by_id ||= @machines.inject({}) { |hash,m| hash[m[:spec].id] = m; hash }
136
144
  end
@@ -98,16 +98,22 @@ module Provisioning
98
98
 
99
99
  # Get file attributes { :mode, :owner, :group }
100
100
  def get_attributes(path)
101
- result = transport.execute("stat -c '%a %U %G %n' #{path}", :read_only => true)
101
+ os = transport.execute('uname -s')
102
+ result = if os.stdout =~ /darwin/i # macOS
103
+ transport.execute("stat -f '%Lp %Su %Sg %N' #{path}", read_only: true)
104
+ else
105
+ transport.execute("stat -c '%a %U %G %n' #{path}", read_only: true)
106
+ end
107
+
102
108
  return nil if result.exitstatus != 0
103
109
  file_info = result.stdout.split(/\s+/)
104
- if file_info.size <= 1
105
- raise "#{path} does not exist in set_attributes()"
106
- end
107
- result = {
108
- :mode => file_info[0],
109
- :owner => file_info[1],
110
- :group => file_info[2]
110
+
111
+ raise "#{path} does not exist in set_attributes()" if file_info.size <= 1
112
+
113
+ {
114
+ mode: file_info[0],
115
+ owner: file_info[1],
116
+ group: file_info[2]
111
117
  }
112
118
  end
113
119
 
@@ -1,5 +1,5 @@
1
1
  class Chef
2
2
  module Provisioning
3
- VERSION = "2.7.4".freeze
3
+ VERSION = "2.7.6".freeze
4
4
  end
5
5
  end
@@ -17,7 +17,7 @@ class Machine < Chef::Resource::LWRPBase
17
17
  @machine_options = run_context.chef_provisioning.current_machine_options
18
18
  end
19
19
 
20
- actions :allocate, :ready, :setup, :converge, :converge_only, :destroy, :stop
20
+ actions :allocate, :ready, :ready_only, :setup, :converge, :converge_only, :destroy, :stop
21
21
  default_action :converge
22
22
 
23
23
  # Driver attributes
@@ -15,7 +15,7 @@ class MachineBatch < Chef::Resource::LWRPBase
15
15
  @machine_options = run_context.chef_provisioning.current_machine_options
16
16
  end
17
17
 
18
- actions :allocate, :ready, :setup, :converge, :converge_only, :destroy, :stop
18
+ actions :allocate, :ready, :setup, :converge, :converge_only, :destroy, :stop, :ready_only
19
19
  default_action :converge
20
20
 
21
21
  attribute :machines, :kind_of => [ Array ]
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chef-provisioning
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.7.4
4
+ version: 2.7.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Keiser
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-12-06 00:00:00.000000000 Z
11
+ date: 2018-12-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: net-ssh
@@ -229,7 +229,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
229
229
  version: '0'
230
230
  requirements: []
231
231
  rubyforge_project:
232
- rubygems_version: 2.7.7
232
+ rubygems_version: 2.7.6
233
233
  signing_key:
234
234
  specification_version: 4
235
235
  summary: A library for creating machines and infrastructures idempotently in Chef.