chef-apply 0.2.2 → 0.2.4

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: 47763f0152ecf082b519b5e8f19aee5616d37bbf96693b0751e74f51632be7f8
4
- data.tar.gz: 55feba8903fa01cab32672129689d34ead1e005750db15505cd5fbae9ab54366
3
+ metadata.gz: 3452a6c94fdf5d7605ec66ca32cc4a08127a4ff7eb9c471e7aff1748b68c66a5
4
+ data.tar.gz: d2d7543d20acaa3f03311f6ef9c68f80bb216c8056c36371618adbbfb7281cc9
5
5
  SHA512:
6
- metadata.gz: 16ce92eeadd92a96cf00a56d4c2faaa551fef3b442eee4ba54cda7f81671f8af876090611e59f2ece3b7ded1ec04f29bb56baa1f6e183c5db2bfc919915703c5
7
- data.tar.gz: de6f1bd15e8e62c54332089364cfe1a3c9989e903403913667fa77ebd15af96479654ed279c6c4ce04d345864a50a2ad9c844481f8f7771b4a59d3b26d266f6a
6
+ metadata.gz: cd7642f35d6a960c4f461afac548807bbffe395ef2d6e8d922938f5a6c3045c01ede76ed35b70fde10aa0faf19fc4ae333597b3f9c795888aa8cb53119367af0
7
+ data.tar.gz: 48765499c4ccf446475cdc80f8f078a5398c22e1244f364ebb51177a8cffbfd443ae8dae85b3cbe62f1f1b024ca201281c024acf85ff479e3ac68285f8e59070
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- chef-apply (0.2.2)
4
+ chef-apply (0.2.4)
5
5
  chef (>= 14.0)
6
6
  chef-dk (>= 3.0)
7
7
  chef-telemetry
@@ -21,13 +21,13 @@ GEM
21
21
  addressable (2.5.2)
22
22
  public_suffix (>= 2.0.2, < 4.0)
23
23
  ast (2.4.0)
24
- aws-sdk (2.11.153)
25
- aws-sdk-resources (= 2.11.153)
26
- aws-sdk-core (2.11.153)
24
+ aws-sdk (2.11.178)
25
+ aws-sdk-resources (= 2.11.178)
26
+ aws-sdk-core (2.11.178)
27
27
  aws-sigv4 (~> 1.0)
28
28
  jmespath (~> 1.0)
29
- aws-sdk-resources (2.11.153)
30
- aws-sdk-core (= 2.11.153)
29
+ aws-sdk-resources (2.11.178)
30
+ aws-sdk-core (= 2.11.178)
31
31
  aws-sigv4 (1.0.3)
32
32
  azure_graph_rbac (0.17.0)
33
33
  ms_rest_azure (~> 0.11.0)
@@ -39,10 +39,10 @@ GEM
39
39
  debug_inspector (>= 0.0.1)
40
40
  builder (3.2.3)
41
41
  byebug (10.0.2)
42
- chef (14.3.37)
42
+ chef (14.7.17)
43
43
  addressable
44
44
  bundler (>= 1.10)
45
- chef-config (= 14.3.37)
45
+ chef-config (= 14.7.17)
46
46
  chef-zero (>= 13.0)
47
47
  diff-lcs (~> 1.2, >= 1.2.4)
48
48
  erubis (~> 2.7)
@@ -50,12 +50,11 @@ GEM
50
50
  ffi-yajl (~> 2.2)
51
51
  highline (~> 1.6, >= 1.6.9)
52
52
  iniparse (~> 1.4)
53
- iso8601 (~> 0.9.1)
54
53
  mixlib-archive (~> 0.4)
55
54
  mixlib-authentication (~> 2.1)
56
55
  mixlib-cli (~> 1.7)
57
56
  mixlib-log (~> 2.0, >= 2.0.3)
58
- mixlib-shellout (~> 2.0)
57
+ mixlib-shellout (~> 2.4)
59
58
  net-sftp (~> 2.1, >= 2.1.2)
60
59
  net-ssh (~> 4.2)
61
60
  net-ssh-multi (~> 1.2, >= 1.2.1)
@@ -70,13 +69,13 @@ GEM
70
69
  specinfra (~> 2.10)
71
70
  syslog-logger (~> 1.6)
72
71
  uuidtools (~> 2.1.5)
73
- chef-config (14.3.37)
72
+ chef-config (14.7.17)
74
73
  addressable
75
74
  fuzzyurl
76
75
  mixlib-config (>= 2.2.12, < 3.0)
77
76
  mixlib-shellout (~> 2.0)
78
77
  tomlrb (~> 1.2)
79
- chef-dk (3.3.23)
78
+ chef-dk (3.5.13)
80
79
  addressable (>= 2.3.5, < 2.6)
81
80
  chef (~> 14.0)
82
81
  chef-provisioning (~> 2.0)
@@ -103,20 +102,20 @@ GEM
103
102
  concurrent-ruby (~> 1.0)
104
103
  ffi-yajl (~> 2.2)
105
104
  http (~> 2.2)
106
- chef-zero (14.0.6)
105
+ chef-zero (14.0.11)
107
106
  ffi-yajl (~> 2.2)
108
107
  hashie (>= 2.0, < 4.0)
109
108
  mixlib-log (~> 2.0)
110
- rack (~> 2.0)
109
+ rack (~> 2.0, >= 2.0.6)
111
110
  uuidtools (~> 2.1)
112
- cheffish (14.0.1)
111
+ cheffish (14.0.4)
113
112
  chef-zero (~> 14.0)
114
113
  net-ssh
115
- chefstyle (0.10.0)
114
+ chefstyle (0.11.0)
116
115
  rubocop (= 0.55.0)
117
116
  citrus (3.0.2)
118
117
  coderay (1.1.2)
119
- concurrent-ruby (1.0.5)
118
+ concurrent-ruby (1.1.3)
120
119
  cookbook-omnifetch (0.8.0)
121
120
  mixlib-archive (~> 0.4)
122
121
  debug_inspector (0.0.3)
@@ -132,7 +131,7 @@ GEM
132
131
  equatable (0.5.0)
133
132
  erubis (2.7.0)
134
133
  excon (0.62.0)
135
- faraday (0.15.3)
134
+ faraday (0.15.4)
136
135
  multipart-post (>= 1.2, < 3)
137
136
  faraday-cookie_jar (0.0.6)
138
137
  faraday (>= 0.7.4)
@@ -175,7 +174,6 @@ GEM
175
174
  inifile (3.0.0)
176
175
  iniparse (1.4.4)
177
176
  ipaddress (0.8.3)
178
- iso8601 (0.9.1)
179
177
  jmespath (1.4.0)
180
178
  json (2.1.0)
181
179
  jwt (2.1.0)
@@ -185,11 +183,11 @@ GEM
185
183
  little-plugger (~> 1.1)
186
184
  multi_json (~> 1.10)
187
185
  memoist (0.16.0)
188
- method_source (0.9.0)
186
+ method_source (0.9.2)
189
187
  mime-types (3.2.2)
190
188
  mime-types-data (~> 3.2015)
191
189
  mime-types-data (3.2018.0812)
192
- minitar (0.6.1)
190
+ minitar (0.7)
193
191
  mixlib-archive (0.4.18)
194
192
  mixlib-log
195
193
  mixlib-authentication (2.1.1)
@@ -242,7 +240,7 @@ GEM
242
240
  os (1.0.0)
243
241
  paint (1.0.1)
244
242
  parallel (1.12.1)
245
- parser (2.5.1.2)
243
+ parser (2.5.3.0)
246
244
  ast (~> 2.4.0)
247
245
  pastel (0.7.2)
248
246
  equatable (~> 0.5.0)
@@ -250,20 +248,20 @@ GEM
250
248
  plist (3.4.0)
251
249
  powerpack (0.1.2)
252
250
  proxifier (1.0.3)
253
- pry (0.11.3)
251
+ pry (0.12.2)
254
252
  coderay (~> 1.1.0)
255
253
  method_source (~> 0.9.0)
256
254
  pry-byebug (3.6.0)
257
255
  byebug (~> 10.0)
258
256
  pry (~> 0.10)
259
- pry-stack_explorer (0.4.9.2)
257
+ pry-stack_explorer (0.4.9.3)
260
258
  binding_of_caller (>= 0.7)
261
259
  pry (>= 0.9.11)
262
260
  public_suffix (3.0.3)
263
- r18n-core (3.1.2)
264
- r18n-desktop (3.1.2)
265
- r18n-core (= 3.1.2)
266
- rack (2.0.5)
261
+ r18n-core (3.2.0)
262
+ r18n-desktop (3.2.0)
263
+ r18n-core (= 3.2.0)
264
+ rack (2.0.6)
267
265
  rainbow (3.0.0)
268
266
  rake (12.3.1)
269
267
  representable (3.0.4)
@@ -297,7 +295,7 @@ GEM
297
295
  rainbow (>= 2.2.2, < 4.0)
298
296
  ruby-progressbar (~> 1.7)
299
297
  unicode-display_width (~> 1.0, >= 1.0.1)
300
- ruby-progressbar (1.9.0)
298
+ ruby-progressbar (1.10.0)
301
299
  rubyntlm (0.6.2)
302
300
  rubyzip (1.2.2)
303
301
  semverse (2.0.0)
@@ -320,19 +318,19 @@ GEM
320
318
  solve (4.0.0)
321
319
  molinillo (~> 0.6)
322
320
  semverse (>= 1.1, < 3.0)
323
- specinfra (2.76.2)
321
+ specinfra (2.76.3)
324
322
  net-scp
325
323
  net-ssh (>= 2.7)
326
324
  net-telnet (= 0.1.1)
327
325
  sfl
328
326
  syslog-logger (1.6.8)
329
327
  systemu (2.6.5)
330
- thor (0.20.0)
328
+ thor (0.20.3)
331
329
  timeliness (0.3.8)
332
330
  toml-rb (1.1.2)
333
331
  citrus (~> 3.0, > 3.0)
334
332
  tomlrb (1.2.7)
335
- train (1.5.4)
333
+ train (1.5.6)
336
334
  aws-sdk (~> 2)
337
335
  azure_graph_rbac (~> 0.16)
338
336
  azure_mgmt_key_vault (~> 0.17)
@@ -392,4 +390,4 @@ DEPENDENCIES
392
390
  simplecov
393
391
 
394
392
  BUNDLED WITH
395
- 1.16.6
393
+ 1.17.1
data/Rakefile CHANGED
@@ -17,7 +17,7 @@
17
17
 
18
18
  require "bundler/gem_tasks"
19
19
 
20
- task :default => [:spec, :style]
20
+ task default: [:spec, :style]
21
21
 
22
22
  require "rspec/core/rake_task"
23
23
  RSpec::Core::RakeTask.new(:spec)
@@ -29,4 +29,4 @@ RuboCop::RakeTask.new(:chefstyle) do |t|
29
29
  t.options = %w{--display-cop-names}
30
30
  end
31
31
 
32
- task :style => :chefstyle
32
+ task style: :chefstyle
@@ -63,8 +63,8 @@ module ChefApply
63
63
  delete_folder: {
64
64
  windows: "Remove-Item -Recurse -Force –Path",
65
65
  other: "rm -rf",
66
- }
67
- }
66
+ },
67
+ }.freeze
68
68
 
69
69
  # TODO - I'd like to consider PATH_MAPPING in action::base
70
70
  # to platform subclasses/mixins for target_host. This way our 'target host'
@@ -24,11 +24,11 @@ module ChefApply::Action
24
24
  attr_reader :generated_cookbook
25
25
 
26
26
  def self.from_options(opts)
27
- if opts.has_key?(:recipe_spec)
27
+ if opts.key?(:recipe_spec)
28
28
  GenerateCookbookFromRecipe.new(opts)
29
- elsif opts.has_key?(:resource_name) &&
30
- opts.has_key?(:resource_type) &&
31
- opts.has_key?(:resource_properties)
29
+ elsif opts.key?(:resource_name) &&
30
+ opts.key?(:resource_type) &&
31
+ opts.key?(:resource_properties)
32
32
  GenerateCookbookFromResource.new(opts)
33
33
  else
34
34
  raise MissingOptions.new(opts)
@@ -74,7 +74,7 @@ module ChefApply::Action::InstallChef
74
74
  product_name: "chef",
75
75
  product_version: :latest,
76
76
  channel: :stable,
77
- platform_version_compatibility_mode: true
77
+ platform_version_compatibility_mode: true,
78
78
  }
79
79
  case platform.name
80
80
  when /windows/
@@ -25,7 +25,7 @@ module ChefApply::Action::InstallChef
25
25
  product_name: "chef",
26
26
  channel: :stable,
27
27
  shell_type: :ps1,
28
- version: "13"
28
+ version: "13",
29
29
  })
30
30
  target_host.run_command! installer.install_command
31
31
  end
@@ -28,7 +28,7 @@ module ChefApply
28
28
  Chef::Log.info("Creating run report")
29
29
  end
30
30
 
31
- #ensure start time and end time are output in the json properly in the event activesupport happens to be on the system
31
+ # ensure start time and end time are output in the json properly in the event activesupport happens to be on the system
32
32
  run_data = data
33
33
  run_data[:start_time] = run_data[:start_time].to_s
34
34
  run_data[:end_time] = run_data[:end_time].to_s
@@ -1,5 +1,5 @@
1
1
  #
2
- #p
2
+ # p
3
3
  # Copyright:: Copyright (c) 2018 Chef Software Inc.
4
4
  # License:: Apache License, Version 2.0
5
5
  #
@@ -137,10 +137,12 @@ module ChefApply
137
137
  @temp_cookbook = generate_temp_cookbook(arguments, reporter)
138
138
  end
139
139
  UI::Terminal.render_job("...", job)
140
+ handle_failed_job(job)
140
141
  job = UI::Terminal::Job.new("", nil) do |reporter|
141
142
  @archive_file_location = generate_local_policy(reporter)
142
143
  end
143
144
  UI::Terminal.render_job("...", job)
145
+ handle_failed_job(job)
144
146
  end
145
147
 
146
148
  def render_converge(target_hosts)
@@ -154,7 +156,7 @@ module ChefApply
154
156
  end
155
157
  header = TS.converge.header(target_hosts.length, temp_cookbook.descriptor, temp_cookbook.from)
156
158
  UI::Terminal.render_parallel_jobs(header, jobs)
157
- handle_job_failures(jobs)
159
+ handle_failed_jobs(jobs)
158
160
  end
159
161
 
160
162
  # Accepts a target_host and establishes the connection to that host
@@ -286,7 +288,7 @@ module ChefApply
286
288
  # job to avoid interrupting other jobs in process. This function
287
289
  # collects them and raises directly (in the case of just one job in the list)
288
290
  # or raises a MultiJobFailure (when more than one job was being run)
289
- def handle_job_failures(jobs)
291
+ def handle_failed_jobs(jobs)
290
292
  failed_jobs = jobs.select { |j| !j.exception.nil? }
291
293
  return if failed_jobs.empty?
292
294
  if jobs.length == 1
@@ -297,6 +299,10 @@ module ChefApply
297
299
  raise ChefApply::MultiJobFailure.new(failed_jobs)
298
300
  end
299
301
 
302
+ def handle_failed_job(job)
303
+ raise job.exception unless job.exception.nil?
304
+ end
305
+
300
306
  # A handler for common action messages
301
307
  def handle_message(message, data, reporter)
302
308
  if message == :error # data[0] = exception
@@ -21,7 +21,7 @@ module ChefApply
21
21
  class CLI
22
22
  module Validation
23
23
  PROPERTY_MATCHER = /^([a-zA-Z0-9_]+)=(.+)$/
24
- CB_MATCHER = '[\w\-]+'
24
+ CB_MATCHER = '[\w\-]+'.freeze
25
25
 
26
26
  # The first param is always hostname. Then we either have
27
27
  # 1. A recipe designation
@@ -25,7 +25,7 @@ require "chef-config/workstation_config_loader"
25
25
  module ChefApply
26
26
  class Config
27
27
  WS_BASE_PATH = File.join(Dir.home, ".chef-workstation/")
28
- SUPPORTED_PROTOCOLS = %w{ssh winrm}
28
+ SUPPORTED_PROTOCOLS = %w{ssh winrm}.freeze
29
29
 
30
30
  class << self
31
31
  @custom_location = nil
@@ -23,13 +23,13 @@ module ChefApply
23
23
  CONSTRAINTS = {
24
24
  windows: {
25
25
  13 => Gem::Version.new("13.10.4"),
26
- 14 => Gem::Version.new("14.4.22")
26
+ 14 => Gem::Version.new("14.4.22"),
27
27
  },
28
28
  linux: {
29
29
  13 => Gem::Version.new("13.10.4"),
30
- 14 => Gem::Version.new("14.1.1")
31
- }
32
- }
30
+ 14 => Gem::Version.new("14.1.1"),
31
+ },
32
+ }.freeze
33
33
 
34
34
  def self.check!(target, check_only)
35
35
  begin
@@ -24,7 +24,7 @@ module ChefApply
24
24
  # These values may exist in .ssh/config but will be ignored by train
25
25
  # in favor of its defaults unless we specify them explicitly.
26
26
  # See #apply_ssh_config
27
- SSH_CONFIG_OVERRIDE_KEYS = [:user, :port, :proxy]
27
+ SSH_CONFIG_OVERRIDE_KEYS = [:user, :port, :proxy].freeze
28
28
 
29
29
  def self.instance_for_url(target, opts = {})
30
30
  opts = { target: @url }
@@ -52,13 +52,13 @@ module ChefApply
52
52
  connection_retries: 2,
53
53
  connection_retry_sleep: 0.15,
54
54
  logger: ChefApply::Log }
55
- if opts_in.has_key? :ssl
55
+ if opts_in.key? :ssl
56
56
  connection_opts[:ssl] = opts_in[:ssl]
57
57
  connection_opts[:self_signed] = (opts_in[:ssl_verify] === false ? true : false)
58
58
  end
59
59
 
60
60
  [:sudo_password, :sudo, :sudo_command, :password, :user].each do |key|
61
- connection_opts[key] = opts_in[key] if opts_in.has_key? key
61
+ connection_opts[key] = opts_in[key] if opts_in.key? key
62
62
  end
63
63
 
64
64
  Train.target_config(connection_opts)
@@ -73,7 +73,7 @@ module ChefApply
73
73
  # been explicitly given.
74
74
  host_cfg = ssh_config_for_host(config[:host])
75
75
  SSH_CONFIG_OVERRIDE_KEYS.each do |key|
76
- if host_cfg.has_key?(key) && opts_in[key].nil?
76
+ if host_cfg.key?(key) && opts_in[key].nil?
77
77
  config[key] = host_cfg[key]
78
78
  end
79
79
  end
@@ -166,8 +166,8 @@ module ChefApply
166
166
  # on a virtualbox windows vm:
167
167
  # (over winrm) Get-WmiObject Win32_Product | Where {$_.Name -match 'Chef Client'}
168
168
  windows: "c:\\opscode\\chef\\version-manifest.json",
169
- linux: "/opt/chef/version-manifest.json"
170
- }
169
+ linux: "/opt/chef/version-manifest.json",
170
+ }.freeze
171
171
 
172
172
  def get_chef_version_manifest
173
173
  path = MANIFEST_PATHS[base_os()]
@@ -207,7 +207,7 @@ module ChefApply
207
207
  "(Join-Path $parent $name);" +
208
208
  "$tmp.FullName"
209
209
 
210
- MKTMP_LINUX_CMD = "d=$(mktemp -d -p${TMPDIR:-/tmp} chef_XXXXXX); echo $d"
210
+ MKTMP_LINUX_CMD = "d=$(mktemp -d -p${TMPDIR:-/tmp} chef_XXXXXX); echo $d".freeze
211
211
 
212
212
  # Create temporary dir and return the path.
213
213
  # This will also set ownership to the connecting user instead of default of
@@ -33,7 +33,7 @@ module ChefApply
33
33
  # a main 'timed_capture', and it would be good to see ordering within nested calls.
34
34
  class Telemeter
35
35
  include Singleton
36
- DEFAULT_INSTALLATION_GUID = "00000000-0000-0000-0000-000000000000"
36
+ DEFAULT_INSTALLATION_GUID = "00000000-0000-0000-0000-000000000000".freeze
37
37
 
38
38
  class << self
39
39
  extend Forwardable
@@ -102,8 +102,8 @@ module ChefApply
102
102
  installation_id: installation_id,
103
103
  run_timestamp: run_timestamp,
104
104
  host_platform: host_platform,
105
- event_data: data
106
- }
105
+ event_data: data,
106
+ },
107
107
  }
108
108
  end
109
109
 
@@ -95,7 +95,7 @@ module ChefApply
95
95
  {
96
96
  name: m.name,
97
97
  recipe_name: File.basename(existing_recipe_path, File.extname(existing_recipe_path)),
98
- path: File.expand_path(File.join(metadata, "../"))
98
+ path: File.expand_path(File.join(metadata, "../")),
99
99
  }
100
100
  else
101
101
  nil
@@ -18,7 +18,7 @@
18
18
  module ChefApply
19
19
  module Text
20
20
  class ErrorTranslation
21
- ATTRIBUTES = :decorations, :header, :footer, :stack, :log
21
+ ATTRIBUTES = [:decorations, :header, :footer, :stack, :log].freeze
22
22
  attr_reader :message, *ATTRIBUTES
23
23
 
24
24
  def initialize(id, params: [])
@@ -33,7 +33,7 @@ module ChefApply::UI
33
33
  ChefApply::Text.errors
34
34
  end
35
35
 
36
- DEFAULT_ERROR_NO = "CHEFINT001"
36
+ DEFAULT_ERROR_NO = "CHEFINT001".freeze
37
37
 
38
38
  def self.show_error(e)
39
39
  # Name is misleading - it's unwrapping but also doing further
@@ -32,7 +32,7 @@ module ChefApply
32
32
  # Some of this is particular to our usage -
33
33
  # prefix does not cause a text update, but does
34
34
  # change the prefix for future messages.
35
- if params.has_key?(:prefix)
35
+ if params.key?(:prefix)
36
36
  @format = @orig_format.gsub(":prefix", params[:prefix])
37
37
  return
38
38
  end
@@ -16,5 +16,5 @@
16
16
  #
17
17
 
18
18
  module ChefApply
19
- VERSION = "0.2.2"
19
+ VERSION = "0.2.4".freeze
20
20
  end
@@ -50,6 +50,6 @@ def fixture_content(name)
50
50
  # Replace $VERSION if present - this is updated automatically, so we can't include
51
51
  # the literal version value in the fixture without
52
52
  # having expeditor update it there too...
53
- content.gsub("$VERSION", ChefApply::VERSION).
54
- gsub("$HOME", Dir.home)
53
+ content.gsub("$VERSION", ChefApply::VERSION)
54
+ .gsub("$HOME", Dir.home)
55
55
  end
@@ -73,13 +73,13 @@ def assert_string_lookup(key, retval = "testvalue")
73
73
  # we need to add this individually instead of using
74
74
  # `receive_messages`, which doesn't appear to give a way to
75
75
  # guarantee ordering
76
- expect(ChefApply::Text).to receive(top_level_method).
77
- and_return(tmock)
76
+ expect(ChefApply::Text).to receive(top_level_method)
77
+ .and_return(tmock)
78
78
  call_seq.each do |m|
79
79
  expect(tmock).to receive(m).ordered.and_return(tmock)
80
80
  end
81
- expect(tmock).to receive(terminal_method).
82
- ordered.and_return(retval)
81
+ expect(tmock).to receive(terminal_method)
82
+ .ordered.and_return(retval)
83
83
  subject.call
84
84
  end
85
85
  end
@@ -299,8 +299,8 @@ RSpec.describe ChefApply::Action::ConvergeTarget do
299
299
  let(:report_result) { double("report result", exit_status: 0, stdout: '{ "exception": "thing" }') }
300
300
  let(:exception_mapper) { double("mapper") }
301
301
  before do
302
- expect(ChefApply::Errors::CCRFailureMapper).to receive(:new).
303
- and_return exception_mapper
302
+ expect(ChefApply::Errors::CCRFailureMapper).to receive(:new)
303
+ .and_return exception_mapper
304
304
  end
305
305
 
306
306
  it "reports back failure and reads the remote report" do
@@ -69,7 +69,7 @@ RSpec.describe ChefApply::CLI::Validation do
69
69
  "key5" => "0777",
70
70
  "key6" => "https://some.website",
71
71
  "key7" => "num1and2digit",
72
- "key_8" => "underscore"
72
+ "key_8" => "underscore",
73
73
  }
74
74
  expect(subject.properties_from_string(provided)).to eq(expected)
75
75
  end
@@ -160,8 +160,8 @@ RSpec.describe ChefApply::CLI do
160
160
  let(:host) { double("TargetHost", config: {}, user: "root" ) }
161
161
  let(:reporter) { double("reporter", update: :ok, success: :ok) }
162
162
  it "invokes do_connect with correct options" do
163
- expect(subject).to receive(:do_connect).
164
- with(host, reporter)
163
+ expect(subject).to receive(:do_connect)
164
+ .with(host, reporter)
165
165
  subject.connect_target(host, reporter)
166
166
  end
167
167
  end
@@ -28,8 +28,8 @@ RSpec.describe ChefApply::MinimumChefVersion do
28
28
  context "#check!" do
29
29
  context "when chef is not already installed on target" do
30
30
  before do
31
- expect(target).to receive(:installed_chef_version).
32
- and_raise ChefApply::TargetHost::ChefNotInstalled.new
31
+ expect(target).to receive(:installed_chef_version)
32
+ .and_raise ChefApply::TargetHost::ChefNotInstalled.new
33
33
  end
34
34
 
35
35
  it "should return :client_not_installed" do
@@ -71,7 +71,7 @@ RSpec.describe ChefApply::MinimumChefVersion do
71
71
  Gem::Version.new("12.1.1") => ChefApply::MinimumChefVersion::Client13Outdated,
72
72
  Gem::Version.new("13.9.0") => ChefApply::MinimumChefVersion::Client13Outdated,
73
73
  Gem::Version.new("14.1.0") => ChefApply::MinimumChefVersion::Client14Outdated,
74
- }
74
+ },
75
75
  }
76
76
  [:windows, :linux].each do |os|
77
77
  context "on #{os}" do
@@ -177,12 +177,12 @@ RSpec.describe ChefApply::Startup do
177
177
  it "touches the configuration file to create it and notifies that it has done so" do
178
178
  expected_config_path = ChefApply::Config.default_location
179
179
  expected_message = ChefApply::Text.cli.creating_config(expected_config_path)
180
- expect(ChefApply::UI::Terminal).to receive(:output).
181
- with(expected_message)
182
- expect(ChefApply::UI::Terminal).to receive(:output).
183
- with("")
184
- expect(FileUtils).to receive(:touch).
185
- with(expected_config_path)
180
+ expect(ChefApply::UI::Terminal).to receive(:output)
181
+ .with(expected_message)
182
+ expect(ChefApply::UI::Terminal).to receive(:output)
183
+ .with("")
184
+ expect(FileUtils).to receive(:touch)
185
+ .with(expected_config_path)
186
186
  subject.create_default_config
187
187
 
188
188
  end
@@ -192,8 +192,8 @@ RSpec.describe ChefApply::Startup do
192
192
  let(:mock_guid) { "1234" }
193
193
  it "sets up a telemetry installation id and notifies the operator that telemetry is enabled" do
194
194
  expect(SecureRandom).to receive(:uuid).and_return(mock_guid)
195
- expect(File).to receive(:write).
196
- with(ChefApply::Config.telemetry_installation_identifier_file, mock_guid)
195
+ expect(File).to receive(:write)
196
+ .with(ChefApply::Config.telemetry_installation_identifier_file, mock_guid)
197
197
  subject.setup_telemetry
198
198
  end
199
199
  end
@@ -303,10 +303,10 @@ RSpec.describe ChefApply::Startup do
303
303
  end
304
304
 
305
305
  it "sets up the logging for ChefApply and Chef" do
306
- expect(ChefApply::Log).to receive(:setup).
307
- with(log_path, log_level)
308
- expect(Chef::Log).to receive(:init).
309
- with(ChefApply::Log.location)
306
+ expect(ChefApply::Log).to receive(:setup)
307
+ .with(log_path, log_level)
308
+ expect(Chef::Log).to receive(:init)
309
+ .with(ChefApply::Log.location)
310
310
  subject.setup_logging
311
311
  expect(ChefConfig.logger).to eq(ChefApply::Log)
312
312
  end
@@ -145,16 +145,16 @@ RSpec.describe ChefApply::TargetHost do
145
145
  let(:expected_manifest_path) do
146
146
  {
147
147
  windows: "c:\\opscode\\chef\\version-manifest.json",
148
- linux: "/opt/chef/version-manifest.json"
148
+ linux: "/opt/chef/version-manifest.json",
149
149
  }
150
150
  end
151
151
  let(:base_os) { :unknown }
152
152
  before do
153
153
  remote_file_mock = double("remote_file", file?: manifest_exists, content: manifest_content)
154
154
  backend_mock = double("backend")
155
- expect(backend_mock).to receive(:file).
156
- with(expected_manifest_path[base_os]).
157
- and_return(remote_file_mock)
155
+ expect(backend_mock).to receive(:file)
156
+ .with(expected_manifest_path[base_os])
157
+ .and_return(remote_file_mock)
158
158
  allow(subject).to receive(:backend).and_return backend_mock
159
159
  allow(subject).to receive(:base_os).and_return base_os
160
160
  end
@@ -278,9 +278,9 @@ RSpec.describe ChefApply::TargetHost do
278
278
  let(:base_os) { :windows }
279
279
  let(:path) { "C:\\temp\\blah" }
280
280
  it "creates the temporary directory using the correct PowerShell command and returns the path" do
281
- expect(subject).to receive(:run_command!).
282
- with(ChefApply::TargetHost::MKTMP_WIN_CMD).
283
- and_return(instance_double("result", stdout: path))
281
+ expect(subject).to receive(:run_command!)
282
+ .with(ChefApply::TargetHost::MKTMP_WIN_CMD)
283
+ .and_return(instance_double("result", stdout: path))
284
284
  expect(subject.mktemp()).to eq(path)
285
285
  end
286
286
  end
@@ -289,9 +289,9 @@ RSpec.describe ChefApply::TargetHost do
289
289
  let(:base_os) { :linux }
290
290
  let(:path) { "/tmp/blah" }
291
291
  it "creates the directory using a properly formed mktemp, changes ownership to connecting user, and returns the path" do
292
- expect(subject).to receive(:run_command!).
293
- with("bash -c '#{ChefApply::TargetHost::MKTMP_LINUX_CMD}'").
294
- and_return(instance_double("result", stdout: "/tmp/blah"))
292
+ expect(subject).to receive(:run_command!)
293
+ .with("bash -c '#{ChefApply::TargetHost::MKTMP_LINUX_CMD}'")
294
+ .and_return(instance_double("result", stdout: "/tmp/blah"))
295
295
  expect(subject).to receive(:chown).with(path)
296
296
  expect(subject.mktemp()).to eq path
297
297
  end
@@ -340,7 +340,7 @@ RSpec.describe ChefApply::TargetResolver do
340
340
  "ssh://user@example.com" => { password: nil, url: "ssh://example.com", user: "user" },
341
341
  "ssh://user:password@example.com" => { password: "password", user: "user", url: "ssh://example.com" },
342
342
  "ssh://user:pas:sw:ord@example.com" => { password: "pas:sw:ord", user: "user", url: "ssh://example.com" },
343
- "ssh://user:!@#$%^&*()|\'\";:/?><.,{}[]+=`~@example.com" => { password: "!@#$%^&*()|\'\";:/?><.,{}[]+=`~", user: "user", url: "ssh://example.com" }
343
+ "ssh://user:!@#$%^&*()|\'\";:/?><.,{}[]+=`~@example.com" => { password: "!@#$%^&*()|\'\";:/?><.,{}[]+=`~", user: "user", url: "ssh://example.com" },
344
344
  }.each do |values|
345
345
  it "resolves #{values[0]} to #{values[1]}" do
346
346
  expect(subject.config_for_target(values[0])).to eq values[1]
@@ -370,8 +370,8 @@ RSpec.describe ChefApply::TargetResolver do
370
370
  end
371
371
  context "and it is not valid" do
372
372
  it "raises an error" do
373
- expect { subject.prefix_from_target("bad://host.com") }.
374
- to raise_error(ChefApply::TargetResolver::UnsupportedProtocol)
373
+ expect { subject.prefix_from_target("bad://host.com") }
374
+ .to raise_error(ChefApply::TargetResolver::UnsupportedProtocol)
375
375
  end
376
376
  end
377
377
  end
@@ -75,11 +75,11 @@ RSpec.describe ChefApply::Telemeter do
75
75
  platform: {
76
76
  name: "windows",
77
77
  version: "10.0.0",
78
- architecture: "x86_64"
78
+ architecture: "x86_64",
79
79
  },
80
80
  hostname_sha1: Digest::SHA1.hexdigest("my_host"),
81
- transport_type: "winrm"
82
- }
81
+ transport_type: "winrm",
82
+ },
83
83
  }
84
84
  expect(subject).to receive(:timed_capture).with(:action, expected_data)
85
85
  subject.timed_action_capture(action) { :ok }
@@ -90,8 +90,8 @@ RSpec.describe ChefApply::Telemeter do
90
90
  expected_data = { action: "Base", target: { platform: {},
91
91
  hostname_sha1: nil,
92
92
  transport_type: nil } }
93
- expect(subject).to receive(:timed_capture).
94
- with(:action, expected_data)
93
+ expect(subject).to receive(:timed_capture)
94
+ .with(:action, expected_data)
95
95
  subject.timed_action_capture(
96
96
  ChefApply::Action::Base.new(target_host: nil)
97
97
  ) { :ok }
@@ -135,8 +135,8 @@ RSpec.describe ChefApply::Telemeter do
135
135
  context "#timed_run_capture" do
136
136
  it "invokes timed_capture with run data" do
137
137
  expected_data = { arguments: [ "arg1" ] }
138
- expect(subject).to receive(:timed_capture).
139
- with(:run, expected_data)
138
+ expect(subject).to receive(:timed_capture)
139
+ .with(:run, expected_data)
140
140
  subject.timed_run_capture(["arg1"])
141
141
  end
142
142
  end
@@ -182,8 +182,8 @@ RSpec.describe ChefApply::Telemeter do
182
182
  installation_id: "0000",
183
183
  run_timestamp: subject.run_timestamp,
184
184
  host_platform: host_platform,
185
- event_data: { hello: "world" }
186
- }
185
+ event_data: { hello: "world" },
186
+ },
187
187
  }
188
188
  expect(payload).to eq expected_payload
189
189
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chef-apply
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chef Software, Inc
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-10-19 00:00:00.000000000 Z
11
+ date: 2018-11-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mixlib-cli