chef-apply 0.8.1 → 0.9.0

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: dcf42f06fe2a7733f4c9755f5cd02b965f45b31e7666db57345b48f0e9692d54
4
- data.tar.gz: f667eca9ca4afb06480ba754c3de012eb7435c3d1552142e7dbd491c124bf441
3
+ metadata.gz: 63379d32f224c7837c6b5bdef6ae3113f91b772e2438ff13ab19a9e8dee6c0b2
4
+ data.tar.gz: a78cfaf8135f28c6ba2c0ed2d81c302a3a2cf35064a9354fe982680b1f72c4b3
5
5
  SHA512:
6
- metadata.gz: 47f31dfb20d1562308d4b2735f8f3f225bf7de794e2fcbb47c7d6cff362d763df7681bf4ed005aec0d74816570e7caa39f164aabdaadca1172db25ab0b8fc7e4
7
- data.tar.gz: 7b4d37d955d6faa57c8314e6d9fd116b850ca76e78bbbdca506a4b51942fa5daed30d5b0cd310c6e89e34047583d5ab23f813c9775065da035c215095e7462f7
6
+ metadata.gz: 4985434b6d8c25d897f6c98e2abff60b79cb18510b86d61e445991fccec43dc6688be44d7ffe5bc68716f0132c8fd7c483a8490c964fb87e3db1c4a467b1bda2
7
+ data.tar.gz: 3c22ed6535c0f193b40f3202fae6bcf8a0f7021ac61f95989ba56c4330a1d56ea2ed4f8a11caa0df5eb0e3e8edf0690b804808d2e1216ed0c2ec615e9d9fb2ff
data/Gemfile CHANGED
@@ -19,7 +19,7 @@ source "https://rubygems.org"
19
19
  gemspec
20
20
 
21
21
  group :development do
22
- gem "chefstyle", "2.0.8"
22
+ gem "chefstyle", "2.2.0"
23
23
  gem "rake", ">= 10.1.0"
24
24
  gem "rspec", "~> 3.0"
25
25
  gem "simplecov"
@@ -51,7 +51,7 @@ module ChefApply
51
51
  @error = e
52
52
 
53
53
  end
54
- # Raise outside the block to ensure that the telemetry cpature completes
54
+ # Raise outside the block to ensure that the telemetry capture completes
55
55
  raise @error unless @error.nil?
56
56
  end
57
57
 
@@ -197,7 +197,7 @@ module ChefApply::Action
197
197
  "exit $LASTEXITCODE"
198
198
  else
199
199
  # cd is shell a builtin, so we'll invoke bash. This also means all commands are executed
200
- # with sudo (as long as we are hardcoding our sudo use)
200
+ # with sudo (as long as we are hard coding our sudo use)
201
201
  "bash -c 'cd #{working_dir}; /opt/chef/bin/chef-client -z --config #{File.join(working_dir, config_file)} --recipe-url #{File.join(working_dir, policy)}'"
202
202
  end
203
203
  end
@@ -69,7 +69,7 @@ module ChefApply
69
69
 
70
70
  def from_resource(resource_type, resource_name, properties)
71
71
  # Generate a cookbook containing a single default recipe with the specified
72
- # resource in it. Incloud the resource type in the cookbook name so hopefully
72
+ # resource in it. Include the resource type in the cookbook name so hopefully
73
73
  # this gives us better reporting info in the future.
74
74
  @descriptor = "#{resource_type}[#{resource_name}]"
75
75
  @from = "resource"
@@ -99,6 +99,8 @@ module ChefApply
99
99
  opts[:platform] = "sles"
100
100
  when "solaris"
101
101
  opts[:platform] = "solaris2"
102
+ when "aix"
103
+ opts[:platform] = "aix"
102
104
  when "amazon"
103
105
  opts[:platform] = "el"
104
106
  if platform.release.to_i > 2010 # legacy Amazon version 1
@@ -50,7 +50,7 @@ module ChefApply
50
50
 
51
51
  # Special note:
52
52
  # config_path is pre-processed in startup.rb, and is shown here only
53
- # for purpoess of rendering help text.
53
+ # for the purpose of rendering help text.
54
54
  klass.option :config_path,
55
55
  short: "-c PATH",
56
56
  long: "--config PATH",
@@ -138,7 +138,7 @@ module ChefApply
138
138
  end
139
139
 
140
140
  # I really don't like that mixlib-cli refers to the parsed command line flags in
141
- # a hash accesed via the `config` method. Thats just such an overloaded word.
141
+ # a hash accessed via the `config` method. Thats just such an overloaded word.
142
142
  def parsed_options
143
143
  config
144
144
  end
@@ -211,7 +211,7 @@ module ChefApply
211
211
  end
212
212
  end
213
213
 
214
- # Runs a GenerateCookbook action based on recipe/resource infoprovided
214
+ # Runs a GenerateCookbook action based on recipe/resource info provided
215
215
  # and renders UI updates as the action reports back
216
216
  def generate_temp_cookbook(arguments, reporter)
217
217
  opts = if arguments.length == 1
@@ -43,7 +43,7 @@ module ChefApply
43
43
 
44
44
  # Call this every time, so that if we add or change ~/.chef-workstation
45
45
  # directory structure, we can be sure that it exists. Even with a
46
- # custom configuration, the .chef-workstation directory and subdirs
46
+ # custom configuration, the .chef-workstation directory and sub-dirs
47
47
  # are required.
48
48
  setup_workstation_user_directories
49
49
 
@@ -65,7 +65,7 @@ module ChefApply
65
65
  start_chef_apply(enforce_license: enforce_license)
66
66
 
67
67
  # NOTE: Because these exceptions occur outside of the
68
- # CLI handling, they won't be tracked in telemtry.
68
+ # CLI handling, they won't be tracked in telemetry.
69
69
  # We can revisit this once the pending error handling rework
70
70
  # is underway.
71
71
  rescue ConfigPathInvalid => e
@@ -149,7 +149,7 @@ module ChefApply
149
149
  end
150
150
 
151
151
  def setup_error_handling
152
- # In Ruby 2.5+ threads print out to stdout when they raise an exception. This is an agressive
152
+ # In Ruby 2.5+ threads print out to stdout when they raise an exception. This is an aggressive
153
153
  # attempt to ensure debugging information is not lost, but in our case it is not necessary
154
154
  # because we handle all the errors ourself. So we disable this to keep output clean.
155
155
  # See https://ruby-doc.org/core-2.5.0/Thread.html#method-c-report_on_exception
@@ -168,7 +168,7 @@ module ChefApply
168
168
  # Look for a user-supplied config path by manually parsing the option.
169
169
  # Note that we can't use Mixlib::CLI for this.
170
170
  # To ensure that ChefApply::CLI initializes with correct
171
- # option defaults, we need to have configuraton loaded before initializing it.
171
+ # option defaults, we need to have configuration loaded before initializing it.
172
172
  def custom_config_path
173
173
  argv.each_with_index do |arg, index|
174
174
  if arg == "--config-path" || arg == "-c"
@@ -0,0 +1,55 @@
1
+ module ChefApply
2
+ class TargetHost
3
+ module Aix
4
+
5
+ def omnibus_manifest_path
6
+ # Note that we can't use File::Join, because that will render for the
7
+ # CURRENT platform - not the platform of the target.
8
+ "/opt/chef/version-manifest.json"
9
+ end
10
+
11
+ def mkdir(path)
12
+ run_command!("mkdir -p #{path}")
13
+ end
14
+
15
+ def chown(path, owner)
16
+ # owner ||= user
17
+ # run_command!("chown #{owner} '#{path}'")
18
+ nil
19
+ end
20
+
21
+ def make_temp_dir
22
+ # We will cache this so that we only run this once
23
+ @tempdir ||= begin
24
+ res = run_command!("bash -c '#{MKTEMP_COMMAND}'")
25
+ res.stdout.chomp.strip
26
+ end
27
+ end
28
+
29
+ def install_package(target_package_path)
30
+ command = "installp -aXYgd #{target_package_path} all"
31
+ run_command!(command)
32
+ end
33
+
34
+ def del_file(path)
35
+ run_command!("rm -rf #{path}")
36
+ end
37
+
38
+ def del_dir(path)
39
+ del_file(path)
40
+ end
41
+
42
+ def ws_cache_path
43
+ "/var/chef-workstation"
44
+ end
45
+
46
+ # Nothing to escape in a unix-based path
47
+ def normalize_path(path)
48
+ path
49
+ end
50
+
51
+ MKTEMP_COMMAND = "d=$(mktemp -d -p${TMPDIR:-/tmp} chef_XXXXXX); echo $d".freeze
52
+
53
+ end
54
+ end
55
+ end
@@ -29,7 +29,7 @@ module ChefApply
29
29
  # We're borrowing a page from train here - because setting up a
30
30
  # reliable connection for testing is a multi-step process,
31
31
  # we'll provide this method which instantiates a TargetHost connected
32
- # to a train mock backend. If the family/name provided resolves to a suported
32
+ # to a train mock backend. If the family/name provided resolves to a supported
33
33
  # OS, this instance will mix-in the supporting methods for the given platform;
34
34
  # otherwise those methods will raise NotImplementedError.
35
35
  def self.mock_instance(url, family: "unknown", name: "unknown",
@@ -144,6 +144,9 @@ module ChefApply
144
144
  when :solaris
145
145
  require_relative "target_host/solaris"
146
146
  class << self; include ChefApply::TargetHost::Solaris; end
147
+ when :aix
148
+ require_relative "target_host/aix"
149
+ class << self; include ChefApply::TargetHost::Aix; end
147
150
  when :other
148
151
  raise ChefApply::TargetHost::UnsupportedTargetOS.new(platform.name)
149
152
  end
@@ -178,12 +181,14 @@ module ChefApply
178
181
  :macos
179
182
  elsif platform.solaris?
180
183
  :solaris
184
+ elsif platform.aix?
185
+ :aix
181
186
  else
182
187
  :other
183
188
  end
184
189
  end
185
190
 
186
- # TODO 2019-01-29 not expose this, it's internal implemenation. Same with #backend.
191
+ # TODO 2019-01-29 not expose this, it's internal implementation. Same with #backend.
187
192
  def platform
188
193
  backend.platform
189
194
  end
@@ -59,7 +59,7 @@ module ChefApply
59
59
  if target =~ /(.*)@(.*)/
60
60
  inline_credentials = $1
61
61
  host = $2
62
- # We'll use a non-greedy match to grab everthinmg up to the first ':'
62
+ # We'll use a non-greedy match to grab everything up to the first ':'
63
63
  # as username if there is no :, credentials is just the username
64
64
  if inline_credentials =~ /(.+?):(.*)/
65
65
  inline_user = $1
@@ -111,7 +111,7 @@ module ChefApply
111
111
  # POSTFIX can contain further ranges itself
112
112
  # This uses a greedy match (.*) to get include every character
113
113
  # up to the last "[" in PREFIX
114
- # $1 - prefix; $2 - x, $3 - y, $4 unproccessed/remaining text
114
+ # $1 - prefix; $2 - x, $3 - y, $4 unprocessed/remaining text
115
115
  TARGET_WITH_RANGE = /^(.*)\[([\p{Alnum}]+):([\p{Alnum}]+)\](.*)/.freeze
116
116
 
117
117
  def do_parse(targets, depth = 0)
@@ -24,7 +24,7 @@ require_relative "text/error_translation"
24
24
  module ChefApply
25
25
  module Text
26
26
  def self._error_table
27
- # Though ther may be several translations, en.yml will be the only one with
27
+ # Though there may be several translations, en.yml will be the only one with
28
28
  # error metadata.
29
29
  path = File.join(_translation_path, "errors", "en.yml")
30
30
  raw_yaml = File.read(path)
@@ -16,5 +16,5 @@
16
16
  #
17
17
 
18
18
  module ChefApply
19
- VERSION = "0.8.1".freeze
19
+ VERSION = "0.9.0".freeze
20
20
  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.8.1
4
+ version: 0.9.0
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: 2021-08-18 00:00:00.000000000 Z
11
+ date: 2022-01-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mixlib-cli
@@ -250,6 +250,7 @@ files:
250
250
  - lib/chef_apply/startup.rb
251
251
  - lib/chef_apply/status_reporter.rb
252
252
  - lib/chef_apply/target_host.rb
253
+ - lib/chef_apply/target_host/aix.rb
253
254
  - lib/chef_apply/target_host/linux.rb
254
255
  - lib/chef_apply/target_host/macos.rb
255
256
  - lib/chef_apply/target_host/solaris.rb