chef-apply 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +26 -0
- data/Gemfile.lock +423 -0
- data/LICENSE +201 -0
- data/README.md +41 -0
- data/Rakefile +32 -0
- data/bin/chef-run +23 -0
- data/chef-apply.gemspec +67 -0
- data/i18n/en.yml +513 -0
- data/lib/chef_apply.rb +20 -0
- data/lib/chef_apply/action/base.rb +158 -0
- data/lib/chef_apply/action/converge_target.rb +173 -0
- data/lib/chef_apply/action/install_chef.rb +30 -0
- data/lib/chef_apply/action/install_chef/base.rb +137 -0
- data/lib/chef_apply/action/install_chef/linux.rb +38 -0
- data/lib/chef_apply/action/install_chef/windows.rb +54 -0
- data/lib/chef_apply/action/reporter.rb +39 -0
- data/lib/chef_apply/cli.rb +470 -0
- data/lib/chef_apply/cli_options.rb +145 -0
- data/lib/chef_apply/config.rb +150 -0
- data/lib/chef_apply/error.rb +108 -0
- data/lib/chef_apply/errors/ccr_failure_mapper.rb +93 -0
- data/lib/chef_apply/file_fetcher.rb +70 -0
- data/lib/chef_apply/log.rb +42 -0
- data/lib/chef_apply/recipe_lookup.rb +117 -0
- data/lib/chef_apply/startup.rb +162 -0
- data/lib/chef_apply/status_reporter.rb +42 -0
- data/lib/chef_apply/target_host.rb +233 -0
- data/lib/chef_apply/target_resolver.rb +202 -0
- data/lib/chef_apply/telemeter.rb +162 -0
- data/lib/chef_apply/telemeter/patch.rb +32 -0
- data/lib/chef_apply/telemeter/sender.rb +121 -0
- data/lib/chef_apply/temp_cookbook.rb +159 -0
- data/lib/chef_apply/text.rb +77 -0
- data/lib/chef_apply/ui/error_printer.rb +261 -0
- data/lib/chef_apply/ui/plain_text_element.rb +75 -0
- data/lib/chef_apply/ui/terminal.rb +94 -0
- data/lib/chef_apply/version.rb +20 -0
- metadata +376 -0
data/LICENSE
ADDED
@@ -0,0 +1,201 @@
|
|
1
|
+
Apache License
|
2
|
+
Version 2.0, January 2004
|
3
|
+
http://www.apache.org/licenses/
|
4
|
+
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
6
|
+
|
7
|
+
1. Definitions.
|
8
|
+
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
11
|
+
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
13
|
+
the copyright owner that is granting the License.
|
14
|
+
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
16
|
+
other entities that control, are controlled by, or are under common
|
17
|
+
control with that entity. For the purposes of this definition,
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
19
|
+
direction or management of such entity, whether by contract or
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
22
|
+
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
24
|
+
exercising permissions granted by this License.
|
25
|
+
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
27
|
+
including but not limited to software source code, documentation
|
28
|
+
source, and configuration files.
|
29
|
+
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
31
|
+
transformation or translation of a Source form, including but
|
32
|
+
not limited to compiled object code, generated documentation,
|
33
|
+
and conversions to other media types.
|
34
|
+
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
36
|
+
Object form, made available under the License, as indicated by a
|
37
|
+
copyright notice that is included in or attached to the work
|
38
|
+
(an example is provided in the Appendix below).
|
39
|
+
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
46
|
+
the Work and Derivative Works thereof.
|
47
|
+
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
49
|
+
the original version of the Work and any modifications or additions
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
61
|
+
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
64
|
+
subsequently incorporated within the Work.
|
65
|
+
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
72
|
+
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
78
|
+
where such license applies only to those patent claims licensable
|
79
|
+
by such Contributor that are necessarily infringed by their
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
82
|
+
institute patent litigation against any entity (including a
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
85
|
+
or contributory patent infringement, then any patent licenses
|
86
|
+
granted to You under this License for that Work shall terminate
|
87
|
+
as of the date such litigation is filed.
|
88
|
+
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
91
|
+
modifications, and in Source or Object form, provided that You
|
92
|
+
meet the following conditions:
|
93
|
+
|
94
|
+
(a) You must give any other recipients of the Work or
|
95
|
+
Derivative Works a copy of this License; and
|
96
|
+
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
98
|
+
stating that You changed the files; and
|
99
|
+
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
102
|
+
attribution notices from the Source form of the Work,
|
103
|
+
excluding those notices that do not pertain to any part of
|
104
|
+
the Derivative Works; and
|
105
|
+
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
108
|
+
include a readable copy of the attribution notices contained
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
111
|
+
of the following places: within a NOTICE text file distributed
|
112
|
+
as part of the Derivative Works; within the Source form or
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
114
|
+
within a display generated by the Derivative Works, if and
|
115
|
+
wherever such third-party notices normally appear. The contents
|
116
|
+
of the NOTICE file are for informational purposes only and
|
117
|
+
do not modify the License. You may add Your own attribution
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
120
|
+
that such additional attribution notices cannot be construed
|
121
|
+
as modifying the License.
|
122
|
+
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
124
|
+
may provide additional or different license terms and conditions
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
128
|
+
the conditions stated in this License.
|
129
|
+
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
133
|
+
this License, without any additional terms or conditions.
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
135
|
+
the terms of any separate license agreement you may have executed
|
136
|
+
with Licensor regarding such Contributions.
|
137
|
+
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
140
|
+
except as required for reasonable and customary use in describing the
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
142
|
+
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
152
|
+
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
158
|
+
incidental, or consequential damages of any character arising as a
|
159
|
+
result of this License or out of the use or inability to use the
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
162
|
+
other commercial damages or losses), even if such Contributor
|
163
|
+
has been advised of the possibility of such damages.
|
164
|
+
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
168
|
+
or other liability obligations and/or rights consistent with this
|
169
|
+
License. However, in accepting such obligations, You may act only
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
174
|
+
of your accepting any such warranty or additional liability.
|
175
|
+
|
176
|
+
END OF TERMS AND CONDITIONS
|
177
|
+
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
179
|
+
|
180
|
+
To apply the Apache License to your work, attach the following
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
182
|
+
replaced with your own identifying information. (Don't include
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
184
|
+
comment syntax for the file format. We also recommend that a
|
185
|
+
file or class name and description of purpose be included on the
|
186
|
+
same "printed page" as the copyright notice for easier
|
187
|
+
identification within third-party archives.
|
188
|
+
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
190
|
+
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
192
|
+
you may not use this file except in compliance with the License.
|
193
|
+
You may obtain a copy of the License at
|
194
|
+
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
196
|
+
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
200
|
+
See the License for the specific language governing permissions and
|
201
|
+
limitations under the License.
|
data/README.md
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
# Chef Run
|
2
|
+
|
3
|
+
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/chef_apply`.
|
4
|
+
|
5
|
+
TODO: Delete this and the text above, and describe your gem
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'chef-apply'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install chef-apply
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
TODO: Write usage instructions here
|
26
|
+
|
27
|
+
## Development
|
28
|
+
|
29
|
+
TODO: Write usage development here
|
30
|
+
|
31
|
+
## Contributing
|
32
|
+
|
33
|
+
TODO: Write usage contributing here
|
34
|
+
|
35
|
+
## License
|
36
|
+
|
37
|
+
The gem is available as open source under the terms of the [Apache License, Version 2.0](https://opensource.org/licenses/Apache-2.0).
|
38
|
+
|
39
|
+
## Code of Conduct
|
40
|
+
|
41
|
+
TODO: Write usage code of conduct here
|
data/Rakefile
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
#
|
2
|
+
# Copyright:: Copyright (c) 2018 Chef Software Inc.
|
3
|
+
# License:: Apache License, Version 2.0
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
#
|
17
|
+
|
18
|
+
require "bundler/gem_tasks"
|
19
|
+
|
20
|
+
task :default => [:spec, :style]
|
21
|
+
|
22
|
+
require "rspec/core/rake_task"
|
23
|
+
RSpec::Core::RakeTask.new(:spec)
|
24
|
+
|
25
|
+
require "chefstyle"
|
26
|
+
require "rubocop/rake_task"
|
27
|
+
desc "Run Chef Ruby style checks"
|
28
|
+
RuboCop::RakeTask.new(:chefstyle) do |t|
|
29
|
+
t.options = %w{--display-cop-names}
|
30
|
+
end
|
31
|
+
|
32
|
+
task :style => :chefstyle
|
data/bin/chef-run
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
#
|
4
|
+
# Copyright:: Copyright (c) 2018 Chef Software Inc.
|
5
|
+
# License:: Apache License, Version 2.0
|
6
|
+
#
|
7
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
8
|
+
# you may not use this file except in compliance with the License.
|
9
|
+
# You may obtain a copy of the License at
|
10
|
+
#
|
11
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
12
|
+
|
13
|
+
# Unless required by applicable law or agreed to in writing, software
|
14
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
15
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
16
|
+
# See the License for the specific language governing permissions and
|
17
|
+
# limitations under the License.
|
18
|
+
#
|
19
|
+
require "chef_apply/startup"
|
20
|
+
|
21
|
+
# Perform initialization tasks then hand off control to
|
22
|
+
# CLI to run the command.
|
23
|
+
ChefApply::Startup.new(ARGV).run
|
data/chef-apply.gemspec
ADDED
@@ -0,0 +1,67 @@
|
|
1
|
+
#
|
2
|
+
# Copyright:: Copyright (c) 2018 Chef Software Inc.
|
3
|
+
# License:: Apache License, Version 2.0
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
#
|
17
|
+
|
18
|
+
lib = File.expand_path("../lib", __FILE__)
|
19
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
20
|
+
require "chef_apply/version"
|
21
|
+
|
22
|
+
Gem::Specification.new do |spec|
|
23
|
+
spec.name = "chef-apply"
|
24
|
+
spec.version = ChefApply::VERSION
|
25
|
+
spec.authors = ["Chef Software, Inc"]
|
26
|
+
spec.email = ["beta@chef.io"]
|
27
|
+
|
28
|
+
spec.summary = "The ad-hoc execution tool for the Chef ecosystem."
|
29
|
+
spec.description = "Ad-hoc management of individual nodes and devices."
|
30
|
+
spec.homepage = "https://github.com/chef/chef-apply"
|
31
|
+
spec.license = "Apache-2.0"
|
32
|
+
spec.required_ruby_version = ">= 2.5.0"
|
33
|
+
|
34
|
+
spec.files = %w{Rakefile LICENSE README.md} +
|
35
|
+
Dir.glob("Gemfile*") + # Includes Gemfile and locks
|
36
|
+
Dir.glob("*.gemspec") +
|
37
|
+
Dir.glob("{lib,bin,vendor,i18n}/**/*", File::FNM_DOTMATCH).reject { |f| File.directory?(f) }
|
38
|
+
spec.bindir = "bin"
|
39
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
40
|
+
spec.require_paths = ["lib"]
|
41
|
+
|
42
|
+
spec.add_dependency "mixlib-cli" # Provides argument handling DSL for CLI applications
|
43
|
+
spec.add_dependency "mixlib-config" # shared chef configuration library that
|
44
|
+
# simplifies managing a configuration file
|
45
|
+
spec.add_dependency "mixlib-log" # Basis for our traditional logger
|
46
|
+
spec.add_dependency "mixlib-install" # URL resolver + install tool for chef products
|
47
|
+
spec.add_dependency "r18n-desktop" # easy path to message text management via
|
48
|
+
# localization gem...
|
49
|
+
spec.add_dependency "toml-rb" # This isn't ideal because mixlib-config uses 'tomlrb'
|
50
|
+
# but that library does not support a dumper
|
51
|
+
spec.add_dependency "train" # remote connection management over ssh, winrm
|
52
|
+
spec.add_dependency "pastel" # A color library
|
53
|
+
spec.add_dependency "tty-spinner" # Pretty output for status updates in the CLI
|
54
|
+
spec.add_dependency "chef", ">= 14.0" # Needed to load cookbooks
|
55
|
+
spec.add_dependency "chef-dk", ">= 3.0"
|
56
|
+
spec.add_dependency "chef-telemetry"
|
57
|
+
|
58
|
+
spec.add_development_dependency "bundler"
|
59
|
+
spec.add_development_dependency "rake"
|
60
|
+
spec.add_development_dependency "rspec"
|
61
|
+
spec.add_development_dependency "pry"
|
62
|
+
spec.add_development_dependency "simplecov"
|
63
|
+
spec.add_development_dependency "pry-byebug"
|
64
|
+
spec.add_development_dependency "pry-stack_explorer"
|
65
|
+
spec.add_development_dependency "rspec_junit_formatter"
|
66
|
+
spec.add_development_dependency "chefstyle"
|
67
|
+
end
|
data/i18n/en.yml
ADDED
@@ -0,0 +1,513 @@
|
|
1
|
+
#
|
2
|
+
# Copyright:: Copyright (c) 2018 Chef Software Inc.
|
3
|
+
# License:: Apache License, Version 2.0
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
#
|
17
|
+
|
18
|
+
cli:
|
19
|
+
telemetry_enabled: |
|
20
|
+
Telemetry has been enabled by default for this beta release
|
21
|
+
of Chef Workstation. The anonymous data we gather is used to
|
22
|
+
determine how we can impove your Chef Workstation experience.
|
23
|
+
|
24
|
+
To disable it, add the following entry to
|
25
|
+
%1:
|
26
|
+
|
27
|
+
[telemetry]
|
28
|
+
enable=false
|
29
|
+
|
30
|
+
For more information about what we data gather and additional opt-out
|
31
|
+
options, please visit https://chef.sh/TODO.
|
32
|
+
description: |
|
33
|
+
Chef Run is a tool to execute ad-hoc tasks using Chef.
|
34
|
+
creating_config: "Creating config file in %1."
|
35
|
+
default_config_location: "Location of config file. Default: %1"
|
36
|
+
identity_file: "SSH identity file to use when connecting. Keys loaded into ssh-agent will also be used."
|
37
|
+
ssl:
|
38
|
+
desc: "Use SSL for WinRM. Current default: %1"
|
39
|
+
verify_desc: |
|
40
|
+
Verify peer certificate when using SSL for WinRM
|
41
|
+
Use --ssl-no-verify when using SSL for WinRM and
|
42
|
+
the remote host is using a self-signed certificate.
|
43
|
+
Current default: %1
|
44
|
+
cookbook_repo_paths: "Comma separated list of cookbook repository paths."
|
45
|
+
install_description: |
|
46
|
+
Install Chef client on the target host(s) if it is not installed.
|
47
|
+
This defaults to enabled - the installation will be performed
|
48
|
+
if there is no Chef client on the target(s).
|
49
|
+
user_description: |
|
50
|
+
Username to use for authentication to the target(s). The same
|
51
|
+
username will be used for all targets.
|
52
|
+
password_description: |
|
53
|
+
Password to use for authentication to the target(s). The same
|
54
|
+
password will be used for all targets.
|
55
|
+
protocol_description: |
|
56
|
+
The protocol to use for connecting to targets.
|
57
|
+
The default is '%2', and it can be changed in config.toml by
|
58
|
+
setting 'connection.default_protocol' to a supported option.
|
59
|
+
sudo:
|
60
|
+
flag_description:
|
61
|
+
sudo: "Whether to use root permissions on the target. Default: true"
|
62
|
+
command: "Command to use for administrative/root access. Defaults to 'sudo'."
|
63
|
+
options: |
|
64
|
+
Options to use with the sudo command. If there are multiple flags,
|
65
|
+
quote them. For example: --sudo-options '-H -P -s'
|
66
|
+
password: |
|
67
|
+
Password to use with the sudo command. This must be provided if
|
68
|
+
password is required for sudo on the target(s). The same sudo password
|
69
|
+
will be used for all targets.
|
70
|
+
help:
|
71
|
+
description: Show help and usage for `chef-run`
|
72
|
+
usage: |
|
73
|
+
chef-run <TARGET[S]> <RESOURCE> <RESOURCE_NAME> [PROPERTIES] [FLAGS]
|
74
|
+
chef-run <TARGET[S]> <RECIPE> [FLAGS]
|
75
|
+
|
76
|
+
usage_full: |
|
77
|
+
chef-run <TARGET[S]> <RESOURCE> <RESOURCE_NAME> [PROPERTIES] [FLAGS]
|
78
|
+
|
79
|
+
Runs a single <RESOURCE> on the specified <TARGET[S]>.
|
80
|
+
[PROPERTIES] should be specified as key=value.
|
81
|
+
|
82
|
+
For example:
|
83
|
+
|
84
|
+
chef-run web01 service nginx action=restart
|
85
|
+
chef-run web01,web02 service nginx action=restart
|
86
|
+
chef-run web0[1:2] service nginx action=restart
|
87
|
+
|
88
|
+
chef-run <TARGET[S]> <RECIPE> [FLAGS]
|
89
|
+
|
90
|
+
Runs a single recipe located at <RECIPE> on the specified <TARGET[S]>.
|
91
|
+
|
92
|
+
For example:
|
93
|
+
|
94
|
+
chef-run web01 path/to/cookbook/recipe.rb
|
95
|
+
chef-run web01,web02 path/to/cookbook
|
96
|
+
chef-run web0[1:2] cookbook_name
|
97
|
+
chef-run web01 cookbook_name::recipe_name
|
98
|
+
|
99
|
+
ARGUMENTS:
|
100
|
+
<TARGET[S]> The hosts or IPs to target. Can also be an SSH or WinRM URLs
|
101
|
+
in the form:
|
102
|
+
|
103
|
+
ssh://[USERNAME]@example.com[:PORT]
|
104
|
+
<RESOURCE> A Chef resource, such as 'user' or 'package'
|
105
|
+
<RESOURCE_NAME> The name, usually used to specify what 'thing' to set up with
|
106
|
+
the resource. For example, given resource 'user', 'name' would be
|
107
|
+
the name of the user you wanted to create.
|
108
|
+
<RECIPE> The recipe to converge. This can be provided as one of:
|
109
|
+
1. Full path to a recipe file
|
110
|
+
2. Cookbook name. First we check the working directory for this
|
111
|
+
cookbook, then we check in the chef repository path. If a
|
112
|
+
cookbook is found we run the default recipe.
|
113
|
+
3. This behaves similarly to 'cookbook name' above, but it also allows
|
114
|
+
you to specify which recipe to use from the cookbook.
|
115
|
+
error:
|
116
|
+
bad_config_file: |
|
117
|
+
|
118
|
+
The path '%1' is not a valid file, or it cannot be read.
|
119
|
+
|
120
|
+
Please verify that the path is correct, and that permissions
|
121
|
+
on the file allow it to be read by your user account.
|
122
|
+
|
123
|
+
missing_config_path: |
|
124
|
+
|
125
|
+
Missing configuration file.
|
126
|
+
|
127
|
+
Please provide the path to a valid chef-run configuration file
|
128
|
+
as an argument to --config-path. For example:
|
129
|
+
|
130
|
+
--config-path /home/user1/.chef-workstation/config.toml
|
131
|
+
|
132
|
+
invalid_config_key: |
|
133
|
+
|
134
|
+
Invalid configuration entry.
|
135
|
+
|
136
|
+
When loading '%2',
|
137
|
+
the configuration entry '%1' was not recognized.
|
138
|
+
|
139
|
+
Please check the spelling and ensure that the value is correct.
|
140
|
+
|
141
|
+
unknown_config_error: |
|
142
|
+
|
143
|
+
Error in configuration file.
|
144
|
+
|
145
|
+
When loading '%2',
|
146
|
+
the following error occurred:
|
147
|
+
%1
|
148
|
+
|
149
|
+
Please verify that the configuration file is correct. If the
|
150
|
+
problem continues, contact beta@chef.io for further assistance.
|
151
|
+
|
152
|
+
version:
|
153
|
+
description: Show the current version of Chef Run.
|
154
|
+
show: "chef-run: %1"
|
155
|
+
status:
|
156
|
+
connecting: "Connecting as %1..."
|
157
|
+
connected: "Connected."
|
158
|
+
connection_failed: "Connection failed: %1"
|
159
|
+
|
160
|
+
status:
|
161
|
+
generate_policyfile:
|
162
|
+
generating: Generating local policyfile...
|
163
|
+
success: Generated local policyfile
|
164
|
+
install_chef:
|
165
|
+
installing: Installing Chef client version %1.
|
166
|
+
checking_for_client: Checking for Chef client.
|
167
|
+
upgrading: Upgrading Chef client from version %1 to %2.
|
168
|
+
downloading: Downloading Chef client installer into local cache.
|
169
|
+
uploading: Uploading Chef client installer to target.
|
170
|
+
verifying: Verifying Chef client installation.
|
171
|
+
already_present: Chef client version %1 already installed on target.
|
172
|
+
install_success: Successfully installed Chef client version %1
|
173
|
+
upgrade_success: Successfully upgraded Chef client from version %1 to %2.
|
174
|
+
failure: "An error occurred while installing Chef client: %1"
|
175
|
+
converge:
|
176
|
+
multi_header: "Converging targets:"
|
177
|
+
converging_recipe: Converging local recipe %1 on target...
|
178
|
+
converging_resource: Converging %1 on target...
|
179
|
+
creating_local_policy: Creating local policy...
|
180
|
+
creating_remote_policy: Pushing remote policy to target...
|
181
|
+
uploading_trusted_certs: Uploading local trusted certs to target...
|
182
|
+
running_chef: Running Chef on target...
|
183
|
+
success: "Successfully converged target!"
|
184
|
+
failure: "Failed to converge target."
|
185
|
+
reboot: "Reboot scheduled on target."
|
186
|
+
|
187
|
+
# Error definitions, usage Text.e.ERR999
|
188
|
+
# General format:
|
189
|
+
# First Line: brief description of the error
|
190
|
+
# Second line: blank
|
191
|
+
# Third+ : detailed description, max 76 characters per line
|
192
|
+
errors:
|
193
|
+
# Catch-all for the worst case
|
194
|
+
UNKNOWN: An unknown error has occurred.
|
195
|
+
|
196
|
+
# Installer action errors
|
197
|
+
CHEFINS002: |
|
198
|
+
The target does not have chef-client installed.
|
199
|
+
|
200
|
+
This command is powered by the Chef client. In order to make use of it
|
201
|
+
on this node, the Chef client must be installed first.
|
202
|
+
|
203
|
+
Re-running this command without the '--no-install' flag will
|
204
|
+
automatically perform the installation.
|
205
|
+
|
206
|
+
CHEFINS003: |
|
207
|
+
The target has an older version of Chef client installed.
|
208
|
+
|
209
|
+
The target has version %1 installed, but this command
|
210
|
+
requires a minimum version of %2.
|
211
|
+
|
212
|
+
Please upgrade the Chef client on this node to version %2 or later.
|
213
|
+
|
214
|
+
# Local errors trying to create policy to send to target
|
215
|
+
CHEFPOLICY001: |
|
216
|
+
Could not create local Policyfile bundle.
|
217
|
+
|
218
|
+
The following error was reported:
|
219
|
+
|
220
|
+
%1
|
221
|
+
|
222
|
+
# Remote execution and file operation errors are prefixed CHEFRMT
|
223
|
+
CHEFRMT001: |
|
224
|
+
The command '%1' exited with return code '%2' on '%3'.
|
225
|
+
|
226
|
+
The following error was reported:
|
227
|
+
|
228
|
+
%4
|
229
|
+
|
230
|
+
# Remote chef client run failure start here.
|
231
|
+
CHEFCCR001: |
|
232
|
+
Could not determine reason for converge failure.
|
233
|
+
|
234
|
+
STDOUT (may be blank)
|
235
|
+
|
236
|
+
%1
|
237
|
+
|
238
|
+
STDERR (may be blank)
|
239
|
+
|
240
|
+
%2
|
241
|
+
|
242
|
+
An error occurred while converging the remote host.
|
243
|
+
I was unable to retrieve the log file which would allow
|
244
|
+
me to provide more information. Above is the output
|
245
|
+
that occurred while trying to retrieve the remote log file.
|
246
|
+
|
247
|
+
CHEFCCR002: |
|
248
|
+
The converge of the remote host failed for the
|
249
|
+
following reason:
|
250
|
+
|
251
|
+
%1
|
252
|
+
|
253
|
+
CHEFCCR003: |
|
254
|
+
The action '%1' is not valid.
|
255
|
+
|
256
|
+
Valid actions are:
|
257
|
+
|
258
|
+
%2
|
259
|
+
|
260
|
+
For more information, please consult the documentation
|
261
|
+
for this resource:
|
262
|
+
|
263
|
+
https://docs.chef.io/resource_reference.html
|
264
|
+
|
265
|
+
CHEFCCR004: |
|
266
|
+
A property value you provided is not valid:
|
267
|
+
|
268
|
+
%1
|
269
|
+
|
270
|
+
Please consult the documentation for properties
|
271
|
+
supported by your resource and their valid values:
|
272
|
+
|
273
|
+
https://docs.chef.io/resource_reference.html
|
274
|
+
|
275
|
+
CHEFCCR005: |
|
276
|
+
'%1' is not a valid Chef resource.
|
277
|
+
|
278
|
+
Please consult the documentation for a list of valid resources:
|
279
|
+
|
280
|
+
https://docs.chef.io/resource_reference.html
|
281
|
+
|
282
|
+
CHEFCCR006: |
|
283
|
+
'%1' is not a property of '%2'.
|
284
|
+
|
285
|
+
Please consult the documentation for %2 for a list of
|
286
|
+
valid properties:
|
287
|
+
|
288
|
+
https://docs.chef.io/resource_reference.html
|
289
|
+
|
290
|
+
CHEFCCR099: |
|
291
|
+
The converge of the remote host failed.
|
292
|
+
|
293
|
+
Please examine the log file for a detailed cause of failure.
|
294
|
+
|
295
|
+
# Train-related errors (connectivy, auth failure, etc)
|
296
|
+
# are prefixed CHEFTRN. Non-specific descendants of Train::Error
|
297
|
+
# will resolve to CHEFTRN001, and we can add additional
|
298
|
+
# more specific text as we need it.
|
299
|
+
CHEFTRN001: |
|
300
|
+
An error has occurred on the %1 connection to %2:
|
301
|
+
|
302
|
+
%2.
|
303
|
+
|
304
|
+
CHEFTRN002: |
|
305
|
+
An remote error has occurred:
|
306
|
+
|
307
|
+
%1.
|
308
|
+
|
309
|
+
CHEFTRN003: |
|
310
|
+
Password required for sudo.
|
311
|
+
|
312
|
+
This target requires a password to perform sudo operations. Please provide a
|
313
|
+
password using the --sudo-password option. For example if the sudo password is
|
314
|
+
in the environment variable $CHEF_RUN_SUDO_PASSWORD, you could use:
|
315
|
+
|
316
|
+
--sudo-password $CHEF_RUN_SUDO_PASSWORD
|
317
|
+
|
318
|
+
CHEFTRN004: |
|
319
|
+
Incorrect sudo password provided.
|
320
|
+
|
321
|
+
Please ensure that the password you provided with "--sudo-password" is correct.
|
322
|
+
|
323
|
+
CHEFTRN005: |
|
324
|
+
sudo command '%1' not found.
|
325
|
+
|
326
|
+
Please verify that the --sudo-command '%1' is valid
|
327
|
+
and installed on this node.
|
328
|
+
|
329
|
+
CHEFTRN006: |
|
330
|
+
sudo requires tty on this system
|
331
|
+
|
332
|
+
In order to continue, sudo must be configured to no longer require tty.
|
333
|
+
You can do this by modifying /etc/sudoers:
|
334
|
+
|
335
|
+
For all users:
|
336
|
+
Defaults !requiretty
|
337
|
+
|
338
|
+
Per-user:
|
339
|
+
Defaults:username !requiretty
|
340
|
+
|
341
|
+
CHEFTRN007: |
|
342
|
+
No authentication methods available.
|
343
|
+
|
344
|
+
Try...
|
345
|
+
- Provide a password with "--password PASSWORD"
|
346
|
+
- Provide a key with "-identity-file PATH/TO/FILE"
|
347
|
+
- Enable ssh-agent and add keys
|
348
|
+
- Add a host entry to your ssh configuration
|
349
|
+
|
350
|
+
Additional instructions can be found in the troubleshooting documentation:
|
351
|
+
|
352
|
+
https://www.chef.sh/docs/chef-workstation/troubleshooting/#error-code-cheftrn007
|
353
|
+
|
354
|
+
CHEFTRN999: |
|
355
|
+
Connection failed: %1
|
356
|
+
|
357
|
+
The following error occured while attempting to connect and authenticate to the target.
|
358
|
+
|
359
|
+
%1
|
360
|
+
|
361
|
+
# CLI argument validation errors
|
362
|
+
CHEFVAL002: |
|
363
|
+
You must supply <TARGET[S]> and either <RESOURCE> and <RESOURCE_NAME> or <RECIPE>
|
364
|
+
|
365
|
+
CHEFVAL003: |
|
366
|
+
Property '%1' did not match the 'key=value' syntax required
|
367
|
+
|
368
|
+
CHEFVAL004: |
|
369
|
+
Please provide a recipe in the form 'path/to/recipe/file.rb',
|
370
|
+
'path/to/cookbook', 'cookbook_name' or 'cookbook_name::recipe_name'.
|
371
|
+
|
372
|
+
You provided '%1'.
|
373
|
+
|
374
|
+
CHEFVAL005: |
|
375
|
+
The cookbook provided could not be loaded. Ensure it contains a valid
|
376
|
+
'metadata.rb'.
|
377
|
+
|
378
|
+
Cookbook path is '%1'.
|
379
|
+
|
380
|
+
CHEFVAL006: |
|
381
|
+
Cookbook '%1' could not be found in any of the following directories
|
382
|
+
|
383
|
+
%2
|
384
|
+
|
385
|
+
CHEFVAL007: |
|
386
|
+
There is no default recipe in cookbook '%2'. Please provide the name of the recipe to run, for example:
|
387
|
+
%2::some_recipe
|
388
|
+
|
389
|
+
Cookbook path is '%1'.
|
390
|
+
|
391
|
+
CHEFVAL008: |
|
392
|
+
There is no recipe named '%2' in the cookbook '%4', which I found at '%1'.
|
393
|
+
|
394
|
+
Please include the name of the recipe you wish to converge on the remote target.
|
395
|
+
|
396
|
+
These are the available recipes in '%4':
|
397
|
+
%3
|
398
|
+
|
399
|
+
CHEFVAL009: |
|
400
|
+
File extension '%1' is unsupported. Currently recipes must be specified with a `.rb` extension.
|
401
|
+
|
402
|
+
CHEFVAL010: |
|
403
|
+
The flag '%1' does not exist.
|
404
|
+
|
405
|
+
Available flags are:
|
406
|
+
%2
|
407
|
+
|
408
|
+
CHEFVAL011: |
|
409
|
+
The protocol '%1' is not supported.
|
410
|
+
|
411
|
+
Currently supported remote access protocols are:
|
412
|
+
|
413
|
+
%2
|
414
|
+
|
415
|
+
# General errors/unknown errors are handled with CHEFINT
|
416
|
+
CHEFINT001: |
|
417
|
+
An unexpected error has occurred:
|
418
|
+
|
419
|
+
%1
|
420
|
+
|
421
|
+
# Maps to: NameError
|
422
|
+
CHEFNET001: |
|
423
|
+
A network error occurred:
|
424
|
+
|
425
|
+
%1
|
426
|
+
|
427
|
+
Please verify the host name or address is correct and that the host is
|
428
|
+
reachable before trying again.
|
429
|
+
|
430
|
+
# Remote chef client run failure start here.
|
431
|
+
CHEFUPL003: |
|
432
|
+
Uploading config to target failed.
|
433
|
+
|
434
|
+
CHEFUPL004: |
|
435
|
+
Uploading handler to target failed.
|
436
|
+
|
437
|
+
CHEFUPL005: |
|
438
|
+
Uploading policy bundle to target failed.
|
439
|
+
|
440
|
+
# Maps to: SSL::SSLError with message text indicating verification failure
|
441
|
+
CHEFNET002: |
|
442
|
+
SSL host verification failed.
|
443
|
+
|
444
|
+
I could not verify the identity of the remote host.
|
445
|
+
|
446
|
+
If you are certain that you are connecting to the correct host,
|
447
|
+
you can specify the '--no-ssl-verify' option for this command, or
|
448
|
+
make it the default by setting the following in your configuration:
|
449
|
+
|
450
|
+
[connection.winrm]
|
451
|
+
ssl_verify=false
|
452
|
+
|
453
|
+
# Errors specifying target ranges
|
454
|
+
CHEFRANGE001: |
|
455
|
+
The target '%1' contains an invalid range.
|
456
|
+
|
457
|
+
The range '%2' mixes alphabetic and numeric values.
|
458
|
+
A range must be one or the other.
|
459
|
+
|
460
|
+
CHEFRANGE002:
|
461
|
+
The target '%1' contains too many ranges.
|
462
|
+
|
463
|
+
A single target name can contain up two ranges.
|
464
|
+
|
465
|
+
CHEFRANGE003: !!pl
|
466
|
+
1:
|
467
|
+
The target provided resolves to too many hosts.
|
468
|
+
|
469
|
+
At this time there is a limit of %2 hosts in a single operation.
|
470
|
+
n:
|
471
|
+
The targets provided resolve to too many hosts.
|
472
|
+
|
473
|
+
At this time there is a limit of %2 hosts in a single operation.
|
474
|
+
|
475
|
+
# Errors related to multi-target execution
|
476
|
+
CHEFMULTI001: |
|
477
|
+
One or more actions has failed.
|
478
|
+
|
479
|
+
A complete list of failures and possible resolutions can
|
480
|
+
be found in the file below:
|
481
|
+
|
482
|
+
%1
|
483
|
+
|
484
|
+
# Errors relating to target state:
|
485
|
+
CHEFTARG001: |
|
486
|
+
'%1' is not a supported target operating system at this time.
|
487
|
+
|
488
|
+
We plan to support a range of target operating systems,
|
489
|
+
but during this targeted beta we are constraining our efforts
|
490
|
+
to Windows and Linux.
|
491
|
+
|
492
|
+
footer:
|
493
|
+
both: |
|
494
|
+
If you are not able to resolve this issue, please contact Chef support
|
495
|
+
at beta@chef.io and include the log file and stack trace from the
|
496
|
+
locations below:
|
497
|
+
|
498
|
+
%1
|
499
|
+
%2
|
500
|
+
|
501
|
+
log_only: |
|
502
|
+
If you are not able to resolve this issue, please contact Chef support
|
503
|
+
at beta@chef.io and include the log file from the location below:
|
504
|
+
%1
|
505
|
+
|
506
|
+
stack_only: |
|
507
|
+
If you are not able to resolve this issue, please contact Chef support
|
508
|
+
at beta@chef.io and include the stack trace from the location below:
|
509
|
+
%1
|
510
|
+
|
511
|
+
neither: |
|
512
|
+
If you are not able to resolve this issue, please contact Chef support
|
513
|
+
at beta@chef.io
|