chef-core-actions 0.0.3 → 0.0.5

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: d6ea4f754d54a9c308bbc0b9aec9a0f8f2e3544fee3075c08051afc81743a6e0
4
- data.tar.gz: 74e8b833d2815fb5c361e906960045afc95ce5455f57a5cbde1676f469e21a44
3
+ metadata.gz: 3c8ad0223c93694220d253edf7bd3c92d7435578a75f46313b5e35572a14d84d
4
+ data.tar.gz: 5b1227fc48164f7a57a0eb54d1dd50d2cbd54d9690abad917d235b897f1dabce
5
5
  SHA512:
6
- metadata.gz: d84eac2b08b6b3dfbb1b9944473d460f646bcfa9e257577cc70b01a4febc898ae840a1bda140684e745eb57173bfe9b43875644f9fb7b7fdc7f3fea60b7a6731
7
- data.tar.gz: 5fcf0bd49467bffe8d4aec6370de2d199bff167bf9f84b504806b781fc4aa234ad18ec48964d7a5dc4e4607a9be124018113f65c0c688fef8edd1776475b7d3c
6
+ metadata.gz: 3779819b725bad441a44eace230483a166c3cb1ae8f10506abca30edc242ea0ad28ad4b32d2a0dae12e5f79cc9d5910a74906383c5982c80f59b5e7c4cc6c43d
7
+ data.tar.gz: 1382e9fda96cd8436aa9f53468f333eee23b3c7f6ec3c4e5747acee7febf812931b09ee5ea4b65d41cef23e801a180845eeecfdc516a166d9bbcdbbc321b493f
@@ -93,6 +93,7 @@ module ChefCore
93
93
  # notification handler block.
94
94
  def notify(event, *args)
95
95
  return if @notification_handler.nil?
96
+
96
97
  ChefCore::Log.debug("[#{name}] Event: #{event}, Event Data: #{args}")
97
98
  @notification_handler.call(event, args) if @notification_handler
98
99
  end
@@ -28,7 +28,7 @@ module ChefCore
28
28
 
29
29
  def perform_action
30
30
  local_policy_path = config.delete :local_policy_path
31
- remote_tmp = target_host.temp_dir()
31
+ remote_tmp = target_host.temp_dir
32
32
  remote_dir_path = target_host.normalize_path(remote_tmp)
33
33
  # Ensure the directory is owned by the connecting user,
34
34
  # otherwise we won't be able to put things into it over scp as that user.
@@ -39,8 +39,8 @@ module ChefCore
39
39
 
40
40
  notify(:running_chef)
41
41
  cmd_str = run_chef_cmd(remote_dir_path,
42
- File.basename(remote_config_path),
43
- File.basename(remote_policy_path))
42
+ File.basename(remote_config_path),
43
+ File.basename(remote_policy_path))
44
44
  c = target_host.run_command(cmd_str)
45
45
  target_host.del_dir(remote_dir_path)
46
46
  if c.exit_status == 0
@@ -53,7 +53,7 @@ module ChefCore
53
53
  ChefCore::Log.error("Error running command [#{cmd_str}]")
54
54
  ChefCore::Log.error("stdout: #{c.stdout}")
55
55
  ChefCore::Log.error("stderr: #{c.stderr}")
56
- handle_ccr_error()
56
+ handle_ccr_error
57
57
  end
58
58
  end
59
59
 
@@ -64,7 +64,7 @@ module ChefCore
64
64
  target_host.upload_file(local_policy_path, remote_policy_path)
65
65
  rescue RuntimeError => e
66
66
  ChefCore::Log.error(e)
67
- raise PolicyUploadFailed.new()
67
+ raise PolicyUploadFailed.new
68
68
  end
69
69
  remote_policy_path
70
70
  end
@@ -86,7 +86,7 @@ module ChefCore
86
86
  # add the target host's log level value
87
87
  # (we don't set a location because we want output to
88
88
  # go in stdout for reporting back to chef-apply)
89
- if !config[:target_log_level].nil?
89
+ unless config[:target_log_level].nil?
90
90
  workstation_rb << <<~EOM
91
91
  log_level :#{config[:target_log_level]}
92
92
  EOM
@@ -108,7 +108,7 @@ module ChefCore
108
108
  config_file.close
109
109
  target_host.upload_file(config_file.path, remote_config_path)
110
110
  rescue RuntimeError
111
- raise ConfigUploadFailed.new()
111
+ raise ConfigUploadFailed.new
112
112
  ensure
113
113
  config_file.unlink
114
114
  end
@@ -120,7 +120,7 @@ module ChefCore
120
120
  target_host.upload_file(RUN_REPORTER_PATH, remote_handler_path)
121
121
  remote_handler_path
122
122
  rescue RuntimeError
123
- raise HandlerUploadFailed.new()
123
+ raise HandlerUploadFailed.new
124
124
  end
125
125
 
126
126
  def upload_trusted_certs(dir)
@@ -159,7 +159,7 @@ module ChefCore
159
159
  end
160
160
 
161
161
  mapper = ConvergeTarget::CCRFailureMapper.new(report["exception"],
162
- mapper_opts)
162
+ mapper_opts)
163
163
  mapper.raise_mapped_exception!
164
164
  end
165
165
 
@@ -38,9 +38,9 @@ module ChefCore
38
38
  if @cause_line.nil?
39
39
  raise RemoteChefRunFailedToResolveError.new(params[:failed_report_path])
40
40
  else
41
- errid, *args = exception_args_from_cause()
41
+ errid, *args = exception_args_from_cause
42
42
  if errid.nil?
43
- raise RemoteChefClientRunFailedUnknownReason.new()
43
+ raise RemoteChefClientRunFailedUnknownReason.new
44
44
  else
45
45
  raise RemoteChefClientRunFailed.new(errid, *args)
46
46
  end
@@ -39,7 +39,7 @@ module ChefCore
39
39
  end
40
40
 
41
41
  def perform_local_install
42
- package = lookup_artifact()
42
+ package = lookup_artifact
43
43
  notify(:downloading)
44
44
  local_path = download_to_workstation(package.url)
45
45
  notify(:uploading)
@@ -65,6 +65,7 @@ module ChefCore
65
65
 
66
66
  def lookup_artifact
67
67
  return @artifact_info if @artifact_info
68
+
68
69
  require "mixlib/install"
69
70
  c = train_to_mixlib(target_host.platform)
70
71
  Mixlib::Install.new(c).artifact_info
@@ -105,11 +106,11 @@ module ChefCore
105
106
  def download_to_workstation(url_path)
106
107
  require "chef_core/file_fetcher"
107
108
  ChefCore::FileFetcher.fetch(config[:cache_path],
108
- url_path)
109
+ url_path)
109
110
  end
110
111
 
111
112
  def upload_to_target(local_path)
112
- installer_dir = target_host.temp_dir()
113
+ installer_dir = target_host.temp_dir
113
114
  remote_path = File.join(installer_dir, File.basename(local_path))
114
115
  target_host.upload_file(local_path, remote_path)
115
116
  remote_path
@@ -40,8 +40,9 @@ module ChefCore
40
40
  installed_version = target.installed_chef_version
41
41
  rescue ChefCore::TargetHost::ChefNotInstalled
42
42
  if check_only
43
- raise ClientNotInstalled.new()
43
+ raise ClientNotInstalled.new
44
44
  end
45
+
45
46
  return :client_not_installed
46
47
  end
47
48
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chef-core-actions
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.5
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: 2019-04-23 00:00:00.000000000 Z
11
+ date: 2019-10-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mixlib-log
@@ -86,8 +86,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
86
86
  - !ruby/object:Gem::Version
87
87
  version: '0'
88
88
  requirements: []
89
- rubyforge_project:
90
- rubygems_version: 2.7.6
89
+ rubygems_version: 3.0.3
91
90
  signing_key:
92
91
  specification_version: 4
93
92
  summary: Common functionality for Chef ruby components