chef-cli 4.0.0 → 5.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile +4 -0
- data/chef-cli.gemspec +1 -1
- data/lib/chef-cli/command/export.rb +14 -6
- data/lib/chef-cli/command/generate.rb +5 -3
- data/lib/chef-cli/command/generator_commands/cookbook.rb +15 -2
- data/lib/chef-cli/command/generator_commands/recipe.rb +7 -0
- data/lib/chef-cli/cookbook_metadata.rb +1 -1
- data/lib/chef-cli/exceptions.rb +13 -1
- data/lib/chef-cli/helpers.rb +4 -4
- data/lib/chef-cli/policyfile/dsl.rb +16 -1
- data/lib/chef-cli/policyfile_services/export_repo.rb +9 -13
- data/lib/chef-cli/skeletons/code_generator/recipes/cookbook.rb +26 -5
- data/lib/chef-cli/skeletons/code_generator/recipes/recipe.rb +11 -3
- data/lib/chef-cli/skeletons/code_generator/templates/default/delivery-project.toml.erb +1 -1
- data/lib/chef-cli/skeletons/code_generator/templates/default/recipe.yml.erb +18 -0
- data/lib/chef-cli/version.rb +1 -1
- data/spec/unit/command/export_spec.rb +18 -1
- data/spec/unit/command/generate_spec.rb +7 -0
- data/spec/unit/command/generator_commands/cookbook_spec.rb +49 -235
- data/spec/unit/command/generator_commands/recipe_spec.rb +34 -0
- data/spec/unit/cookbook_metadata_spec.rb +20 -1
- data/spec/unit/fixtures/example_cookbook_both_metadata/.gitignore +17 -0
- data/spec/unit/fixtures/example_cookbook_both_metadata/.kitchen.yml +16 -0
- data/spec/unit/fixtures/example_cookbook_both_metadata/Berksfile +3 -0
- data/spec/unit/fixtures/example_cookbook_both_metadata/README.md +4 -0
- data/spec/unit/fixtures/example_cookbook_both_metadata/chefignore +96 -0
- data/spec/unit/fixtures/example_cookbook_both_metadata/metadata.json +5 -0
- data/spec/unit/fixtures/example_cookbook_both_metadata/metadata.rb +9 -0
- data/spec/unit/fixtures/example_cookbook_both_metadata/recipes/default.rb +8 -0
- data/spec/unit/helpers_spec.rb +111 -0
- data/spec/unit/policyfile_evaluation_spec.rb +67 -1
- data/spec/unit/policyfile_services/export_repo_spec.rb +51 -2
- metadata +22 -14
- data/lib/chef-cli/command/generator_commands/build_cookbook.rb +0 -126
- data/lib/chef-cli/skeletons/code_generator/files/default/build_cookbook/README.md +0 -146
- data/lib/chef-cli/skeletons/code_generator/files/default/build_cookbook/kitchen.yml +0 -21
- data/lib/chef-cli/skeletons/code_generator/files/default/build_cookbook/test-fixture-recipe.rb +0 -8
- data/lib/chef-cli/skeletons/code_generator/files/default/delivery-config.json +0 -17
- data/lib/chef-cli/skeletons/code_generator/recipes/build_cookbook.rb +0 -175
- data/lib/chef-cli/skeletons/code_generator/templates/default/build_cookbook/Berksfile.erb +0 -7
- data/lib/chef-cli/skeletons/code_generator/templates/default/build_cookbook/metadata.rb.erb +0 -10
- data/lib/chef-cli/skeletons/code_generator/templates/default/build_cookbook/recipe.rb.erb +0 -9
- data/spec/unit/command/generator_commands/build_cookbook_spec.rb +0 -377
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 296f2275d23de7dca838ca9919a2ef33f99fcafab1876d3bea25d7c314738a77
|
4
|
+
data.tar.gz: 320ea6193c4d7af2754e88528f9916615e35f383392eef8cfdcfaa89c456cf45
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 75673a37567263db2076636caa828cfa56ef03fc90b1fb0dbbc2eceaccf5d5b5ca8a39056b12363b3ef4d7eb1237c35919a7d8d5955771299c9826c759d7ad89
|
7
|
+
data.tar.gz: 8aed49647cc53678c60feae466ef554402420ec0df840565af1839cccf96e8cad8bb3ac422f249d87354ac1d091055334df94e21dc7677489de595183b65c4fe
|
data/Gemfile
CHANGED
@@ -10,11 +10,15 @@ group :test do
|
|
10
10
|
gem "cookstyle", "=7.7.2" # this forces dependabot PRs to open which triggers cookstyle CI on the chef generate command
|
11
11
|
gem "chefstyle", "=1.6.2"
|
12
12
|
gem "test-kitchen", ">= 2.11.1"
|
13
|
+
|
13
14
|
if Gem::Version.new(RUBY_VERSION) < Gem::Version.new("2.6")
|
14
15
|
gem "chef-zero", "~> 14"
|
15
16
|
gem "chef", "~> 15"
|
16
17
|
gem "chef-utils", "=16.6.14"
|
17
18
|
end
|
19
|
+
if Gem::Version.new(RUBY_VERSION) < Gem::Version.new("2.7")
|
20
|
+
gem "ohai", "~> 16"
|
21
|
+
end
|
18
22
|
end
|
19
23
|
|
20
24
|
group :development do
|
data/chef-cli.gemspec
CHANGED
@@ -29,7 +29,7 @@ Gem::Specification.new do |gem|
|
|
29
29
|
gem.license = "Apache-2.0"
|
30
30
|
gem.homepage = "https://www.chef.io/"
|
31
31
|
|
32
|
-
gem.required_ruby_version = ">= 2.
|
32
|
+
gem.required_ruby_version = ">= 2.6"
|
33
33
|
|
34
34
|
gem.files = %w{Rakefile LICENSE} +
|
35
35
|
Dir.glob("Gemfile*") + # Includes Gemfile and locks
|
@@ -1,5 +1,5 @@
|
|
1
1
|
#
|
2
|
-
# Copyright:: Copyright (c)
|
2
|
+
# Copyright:: Copyright (c) Chef Software Inc.
|
3
3
|
# License:: Apache License, Version 2.0
|
4
4
|
#
|
5
5
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -67,6 +67,11 @@ module ChefCLI
|
|
67
67
|
description: "Enable stacktraces and other debug output",
|
68
68
|
default: false
|
69
69
|
|
70
|
+
option :policy_group,
|
71
|
+
long: "--policy-group POLICY_GROUP",
|
72
|
+
description: "The policy_group to include in the export (default: 'local')",
|
73
|
+
default: nil
|
74
|
+
|
70
75
|
attr_reader :policyfile_relative_path
|
71
76
|
attr_reader :export_dir
|
72
77
|
|
@@ -120,11 +125,14 @@ module ChefCLI
|
|
120
125
|
end
|
121
126
|
|
122
127
|
def export_service
|
123
|
-
@export_service ||= PolicyfileServices::ExportRepo.new(
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
+
@export_service ||= PolicyfileServices::ExportRepo.new(
|
129
|
+
policyfile: policyfile_relative_path,
|
130
|
+
export_dir: export_dir,
|
131
|
+
root_dir: Dir.pwd,
|
132
|
+
archive: archive?,
|
133
|
+
force: config[:force],
|
134
|
+
policy_group: config[:policy_group]
|
135
|
+
)
|
128
136
|
end
|
129
137
|
|
130
138
|
def handle_error(error)
|
@@ -29,7 +29,6 @@ require_relative "generator_commands/template"
|
|
29
29
|
require_relative "generator_commands/repo"
|
30
30
|
require_relative "generator_commands/policyfile"
|
31
31
|
require_relative "generator_commands/generator_generator"
|
32
|
-
require_relative "generator_commands/build_cookbook"
|
33
32
|
require_relative "../dist"
|
34
33
|
|
35
34
|
module ChefCLI
|
@@ -56,7 +55,7 @@ module ChefCLI
|
|
56
55
|
generator(:repo, :Repo, "Generate a #{ChefCLI::Dist::INFRA_PRODUCT} code repository")
|
57
56
|
generator(:policyfile, :Policyfile, "Generate a Policyfile for use with the install/push commands")
|
58
57
|
generator(:generator, :GeneratorGenerator, "Copy #{ChefCLI::Dist::PRODUCT}'s generator cookbook so you can customize it")
|
59
|
-
generator(:'build-cookbook', :BuildCookbook, "Generate a build cookbook for use with #{ChefCLI::Dist::WORKFLOW}")
|
58
|
+
generator(:'build-cookbook', :BuildCookbook, "DEPRECATED: Generate a build cookbook for use with #{ChefCLI::Dist::WORKFLOW}")
|
60
59
|
|
61
60
|
def self.banner_headline
|
62
61
|
<<~E
|
@@ -83,6 +82,10 @@ module ChefCLI
|
|
83
82
|
end
|
84
83
|
|
85
84
|
def run(params)
|
85
|
+
if params[0] == "build-cookbook"
|
86
|
+
warn "[DEPRECATION] Chef Workflow (Delivery) is end of life (EOL) as of December 31, 2020 and this generator subcommand has been removed".freeze
|
87
|
+
return 1
|
88
|
+
end
|
86
89
|
if ( generator_spec = generator_for(params[0]) )
|
87
90
|
params.shift
|
88
91
|
generator = GeneratorCommands.build(generator_spec.class_name, params)
|
@@ -118,7 +121,6 @@ module ChefCLI
|
|
118
121
|
def have_generator?(name)
|
119
122
|
self.class.generators.map { |g| g.name.to_s }.include?(name)
|
120
123
|
end
|
121
|
-
|
122
124
|
end
|
123
125
|
end
|
124
126
|
end
|
@@ -65,7 +65,7 @@ module ChefCLI
|
|
65
65
|
option :workflow,
|
66
66
|
short: "-w",
|
67
67
|
long: "--workflow",
|
68
|
-
description: "Generate a cookbook with a full #{ChefCLI::Dist::WORKFLOW} build cookbook.",
|
68
|
+
description: "DEPRECATED: Generate a cookbook with a full #{ChefCLI::Dist::WORKFLOW} build cookbook.",
|
69
69
|
boolean: true,
|
70
70
|
default: false
|
71
71
|
|
@@ -76,6 +76,13 @@ module ChefCLI
|
|
76
76
|
boolean: true,
|
77
77
|
default: false
|
78
78
|
|
79
|
+
option :yaml,
|
80
|
+
short: "-y",
|
81
|
+
long: "--yaml",
|
82
|
+
description: "Generate a cookbook with YAML Recipe configuration file as the default.",
|
83
|
+
boolean: true,
|
84
|
+
default: nil
|
85
|
+
|
79
86
|
option :pipeline,
|
80
87
|
long: "--pipeline PIPELINE",
|
81
88
|
description: "Use PIPELINE to set target branch to something other than master for the #{ChefCLI::Dist::WORKFLOW} build_cookbook",
|
@@ -111,6 +118,7 @@ module ChefCLI
|
|
111
118
|
end
|
112
119
|
|
113
120
|
def emit_post_create_message
|
121
|
+
default_recipe_file = yaml ? "default.yml" : "default.rb"
|
114
122
|
if have_delivery_config?
|
115
123
|
msg("Your cookbook is ready. To setup the pipeline, type `cd #{cookbook_name_or_path}`, then run `delivery init`")
|
116
124
|
else
|
@@ -120,7 +128,7 @@ module ChefCLI
|
|
120
128
|
msg("\nWhy not start by writing an InSpec test? Tests for the default recipe are stored at:\n")
|
121
129
|
msg("test/integration/default/default_test.rb")
|
122
130
|
msg("\nIf you'd prefer to dive right in, the default recipe can be found at:")
|
123
|
-
msg("\nrecipes
|
131
|
+
msg("\nrecipes/#{default_recipe_file}\n")
|
124
132
|
end
|
125
133
|
end
|
126
134
|
|
@@ -147,6 +155,7 @@ module ChefCLI
|
|
147
155
|
Generator.add_attr_to_context(:pipeline, pipeline)
|
148
156
|
Generator.add_attr_to_context(:kitchen, kitchen)
|
149
157
|
Generator.add_attr_to_context(:vscode_dir, create_vscode_dir?)
|
158
|
+
Generator.add_attr_to_context(:yaml, yaml)
|
150
159
|
end
|
151
160
|
|
152
161
|
def kitchen
|
@@ -157,6 +166,10 @@ module ChefCLI
|
|
157
166
|
config[:pipeline]
|
158
167
|
end
|
159
168
|
|
169
|
+
def yaml
|
170
|
+
config[:yaml]
|
171
|
+
end
|
172
|
+
|
160
173
|
def policy_name
|
161
174
|
cookbook_name
|
162
175
|
end
|
@@ -26,6 +26,13 @@ module ChefCLI
|
|
26
26
|
|
27
27
|
banner "Usage: #{ChefCLI::Dist::EXEC} generate recipe [path/to/cookbook] NAME [options]"
|
28
28
|
|
29
|
+
option :yaml,
|
30
|
+
short: "-y",
|
31
|
+
long: "--yaml",
|
32
|
+
description: "Generate recipe using YAML configuration format.",
|
33
|
+
boolean: true,
|
34
|
+
default: nil
|
35
|
+
|
29
36
|
options.merge!(SharedGeneratorOptions.options)
|
30
37
|
|
31
38
|
def recipe
|
data/lib/chef-cli/exceptions.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
#
|
2
|
-
# Copyright:: Copyright (c)
|
2
|
+
# Copyright:: Copyright (c) Chef Software Inc.
|
3
3
|
# License:: Apache License, Version 2.0
|
4
4
|
#
|
5
5
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -71,6 +71,18 @@ module ChefCLI
|
|
71
71
|
class MissingCookbookLockData < StandardError
|
72
72
|
end
|
73
73
|
|
74
|
+
class PolicyfileMissingCookbookMetadata < StandardError
|
75
|
+
def initialize(cookbook_root)
|
76
|
+
super("Policyfile specified to use cookbook metadata, but neither #{cookbook_root}/metadata.rb or #{cookbook_root}/metadata.json was found.")
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
class PolicyfileBadCookbookMetadata < StandardError
|
81
|
+
def initialize(cookbook_root, e)
|
82
|
+
super("Cookbook metadata for cookbook at #{cookbook_root} could not be parsed:\n Original Exception: #{e}")
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
74
86
|
class InvalidLockfile < StandardError
|
75
87
|
end
|
76
88
|
|
data/lib/chef-cli/helpers.rb
CHANGED
@@ -117,11 +117,11 @@ module ChefCLI
|
|
117
117
|
@omnibus_env ||=
|
118
118
|
begin
|
119
119
|
user_bin_dir = File.expand_path(File.join(Gem.user_dir, "bin"))
|
120
|
-
path = [ omnibus_bin_dir, user_bin_dir, omnibus_embedded_bin_dir, ENV["PATH"] ]
|
120
|
+
path = [ omnibus_bin_dir, user_bin_dir, omnibus_embedded_bin_dir, ENV["PATH"].split(File::PATH_SEPARATOR) ]
|
121
121
|
path << git_bin_dir if Dir.exist?(git_bin_dir)
|
122
122
|
path << git_windows_bin_dir if Dir.exist?(git_windows_bin_dir)
|
123
123
|
{
|
124
|
-
"PATH" => path.join(File::PATH_SEPARATOR),
|
124
|
+
"PATH" => path.flatten.uniq.join(File::PATH_SEPARATOR),
|
125
125
|
"GEM_ROOT" => Gem.default_dir,
|
126
126
|
"GEM_HOME" => Gem.user_dir,
|
127
127
|
"GEM_PATH" => Gem.path.join(File::PATH_SEPARATOR),
|
@@ -129,8 +129,6 @@ module ChefCLI
|
|
129
129
|
end
|
130
130
|
end
|
131
131
|
|
132
|
-
private
|
133
|
-
|
134
132
|
def omnibus_expand_path(*paths)
|
135
133
|
dir = File.expand_path(File.join(paths))
|
136
134
|
raise OmnibusInstallNotFound.new unless dir && File.directory?(dir)
|
@@ -138,6 +136,8 @@ module ChefCLI
|
|
138
136
|
dir
|
139
137
|
end
|
140
138
|
|
139
|
+
private
|
140
|
+
|
141
141
|
def expected_omnibus_root
|
142
142
|
File.expand_path(File.join(Gem.ruby, "..", "..", ".."))
|
143
143
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
#
|
2
|
-
# Copyright:: Copyright (c)
|
2
|
+
# Copyright:: Copyright (c) Chef Software Inc.
|
3
3
|
# License:: Apache License, Version 2.0
|
4
4
|
#
|
5
5
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -138,6 +138,21 @@ module ChefCLI
|
|
138
138
|
end
|
139
139
|
end
|
140
140
|
|
141
|
+
def metadata
|
142
|
+
cookbook_root = storage_config.relative_paths_root
|
143
|
+
unless File.exist?(File.join(cookbook_root, "metadata.rb")) || File.exist?(File.join(cookbook_root, "metadata.json"))
|
144
|
+
raise PolicyfileMissingCookbookMetadata.new(cookbook_root)
|
145
|
+
end
|
146
|
+
|
147
|
+
begin
|
148
|
+
cookbook_name = CookbookMetadata.from_path(cookbook_root).cookbook_name
|
149
|
+
rescue Exception => e
|
150
|
+
raise PolicyfileBadCookbookMetadata.new(cookbook_root, e)
|
151
|
+
end
|
152
|
+
name cookbook_name if name.nil?
|
153
|
+
cookbook(cookbook_name, path: ".")
|
154
|
+
end
|
155
|
+
|
141
156
|
def default
|
142
157
|
@node_attributes.default
|
143
158
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
#
|
2
|
-
# Copyright:: Copyright (c)
|
2
|
+
# Copyright:: Copyright (c) Chef Software Inc.
|
3
3
|
# License:: Apache License, Version 2.0
|
4
4
|
#
|
5
5
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -33,20 +33,15 @@ module ChefCLI
|
|
33
33
|
|
34
34
|
class ExportRepo
|
35
35
|
|
36
|
-
# Policy groups provide namespaces for policies so that a Chef Infra Server can
|
37
|
-
# have multiple active iterations of a policy at once, but we don't need
|
38
|
-
# this when serving a single exported policy via Chef Zero, so hardcode
|
39
|
-
# it to a "well known" value:
|
40
|
-
POLICY_GROUP = "local".freeze
|
41
|
-
|
42
36
|
include Policyfile::StorageConfigDelegation
|
43
37
|
|
44
38
|
attr_reader :storage_config
|
45
39
|
attr_reader :root_dir
|
46
40
|
attr_reader :export_dir
|
47
41
|
attr_reader :ui
|
42
|
+
attr_reader :policy_group
|
48
43
|
|
49
|
-
def initialize(policyfile: nil, export_dir: nil, root_dir: nil, archive: false, force: false)
|
44
|
+
def initialize(policyfile: nil, export_dir: nil, root_dir: nil, archive: false, force: false, policy_group: nil)
|
50
45
|
@root_dir = root_dir
|
51
46
|
@export_dir = File.expand_path(export_dir)
|
52
47
|
@archive = archive
|
@@ -55,6 +50,8 @@ module ChefCLI
|
|
55
50
|
|
56
51
|
@policy_data = nil
|
57
52
|
@policyfile_lock = nil
|
53
|
+
@policy_group = policy_group
|
54
|
+
@policy_group ||= "local".freeze
|
58
55
|
|
59
56
|
policyfile_rel_path = policyfile || "Policyfile.rb"
|
60
57
|
policyfile_full_path = File.expand_path(policyfile_rel_path, root_dir)
|
@@ -243,7 +240,7 @@ module ChefCLI
|
|
243
240
|
#
|
244
241
|
|
245
242
|
policy_name '#{policy_name}'
|
246
|
-
policy_group '
|
243
|
+
policy_group '#{policy_group}'
|
247
244
|
|
248
245
|
use_policyfile true
|
249
246
|
policy_document_native_api true
|
@@ -301,9 +298,8 @@ module ChefCLI
|
|
301
298
|
### policy_groups/
|
302
299
|
|
303
300
|
Policy groups are used by Chef Infra Server to manage multiple revisions of the same
|
304
|
-
policy.
|
305
|
-
|
306
|
-
|
301
|
+
policy. The default "local" policy is recommended for export use since there can be
|
302
|
+
no different revisions when not utilizing a server.
|
307
303
|
README
|
308
304
|
end
|
309
305
|
end
|
@@ -389,7 +385,7 @@ module ChefCLI
|
|
389
385
|
end
|
390
386
|
|
391
387
|
def policy_group_repo_item_path
|
392
|
-
File.join(staging_dir, "policy_groups", "
|
388
|
+
File.join(staging_dir, "policy_groups", "#{policy_group}.json")
|
393
389
|
end
|
394
390
|
|
395
391
|
def dot_chef_staging_dir
|
@@ -117,10 +117,18 @@ end
|
|
117
117
|
# Recipes
|
118
118
|
directory "#{cookbook_dir}/recipes"
|
119
119
|
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
120
|
+
if context.yaml
|
121
|
+
template "#{cookbook_dir}/recipes/default.yml" do
|
122
|
+
source 'recipe.yml.erb'
|
123
|
+
helpers(ChefCLI::Generator::TemplateHelper)
|
124
|
+
action :create_if_missing
|
125
|
+
end
|
126
|
+
else
|
127
|
+
template "#{cookbook_dir}/recipes/default.rb" do
|
128
|
+
source 'recipe.rb.erb'
|
129
|
+
helpers(ChefCLI::Generator::TemplateHelper)
|
130
|
+
action :create_if_missing
|
131
|
+
end
|
124
132
|
end
|
125
133
|
|
126
134
|
# the same will be done below if workflow was enabled so avoid double work and skip this
|
@@ -182,4 +190,17 @@ if context.vscode_dir
|
|
182
190
|
end
|
183
191
|
end
|
184
192
|
|
185
|
-
|
193
|
+
if context.enable_workflow
|
194
|
+
warn "\n---------WARNING---------\nThe --workflow flag is deprecated as #{ChefCLI::Dist::WORKFLOW} is EOL as of December 2020.\n\nThis flag will be ignored and will be removed in a future release.\n-------------------------\n\n"
|
195
|
+
directory "#{cookbook_dir}/.delivery"
|
196
|
+
|
197
|
+
template "#{cookbook_dir}/.delivery/project.toml" do
|
198
|
+
variables(
|
199
|
+
specs: context.specs
|
200
|
+
)
|
201
|
+
source 'delivery-project.toml.erb'
|
202
|
+
helpers(ChefCLI::Generator::TemplateHelper)
|
203
|
+
action :create_if_missing
|
204
|
+
end
|
205
|
+
|
206
|
+
end
|
@@ -1,6 +1,7 @@
|
|
1
1
|
context = ChefCLI::Generator.context
|
2
2
|
cookbook_dir = File.join(context.cookbook_root, context.cookbook_name)
|
3
3
|
recipe_path = File.join(cookbook_dir, 'recipes', "#{context.new_file_basename}.rb")
|
4
|
+
recipe_path_yml = File.join(cookbook_dir, 'recipes', "#{context.new_file_basename}.yml")
|
4
5
|
spec_helper_path = File.join(cookbook_dir, 'spec', 'spec_helper.rb')
|
5
6
|
spec_dir = File.join(cookbook_dir, 'spec', 'unit', 'recipes')
|
6
7
|
spec_path = File.join(spec_dir, "#{context.new_file_basename}_spec.rb")
|
@@ -44,7 +45,14 @@ template inspec_path do
|
|
44
45
|
end
|
45
46
|
|
46
47
|
# Recipe
|
47
|
-
|
48
|
-
|
49
|
-
|
48
|
+
if context.yaml
|
49
|
+
template recipe_path_yml do
|
50
|
+
source 'recipe.yml.erb'
|
51
|
+
helpers(ChefCLI::Generator::TemplateHelper)
|
52
|
+
end
|
53
|
+
else
|
54
|
+
template recipe_path do
|
55
|
+
source 'recipe.rb.erb'
|
56
|
+
helpers(ChefCLI::Generator::TemplateHelper)
|
57
|
+
end
|
50
58
|
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
#
|
2
|
+
# Cookbook:: <%= cookbook_name %>
|
3
|
+
# Recipe:: <%= recipe_name %>
|
4
|
+
#
|
5
|
+
<%= license_description('#') %>
|
6
|
+
|
7
|
+
---
|
8
|
+
resources:
|
9
|
+
# Example Syntax
|
10
|
+
# Additional snippets are available using the Chef Infra Extension for Visual Studio Code
|
11
|
+
# - type: file
|
12
|
+
# name: '/path/to/file'
|
13
|
+
# content: 'content'
|
14
|
+
# owner: 'root'
|
15
|
+
# group: 'root'
|
16
|
+
# mode: '0755'
|
17
|
+
# action:
|
18
|
+
# - create
|