chef-dk 0.15.15 → 0.15.16
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +2 -2
- data/lib/chef-dk/skeletons/code_generator/files/default/repo/README.md +28 -28
- data/lib/chef-dk/skeletons/code_generator/files/default/repo/cookbooks/example/README.md +27 -27
- data/lib/chef-dk/skeletons/code_generator/files/default/repo/data_bags/README.md +58 -58
- data/lib/chef-dk/skeletons/code_generator/recipes/template.rb +32 -32
- data/lib/chef-dk/version.rb +1 -1
- data/omnibus_overrides.rb +0 -1
- data/spec/unit/command/generator_commands/template_spec.rb +32 -32
- data/version_policy.rb +0 -7
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fb142ee9ea0cda2c706a1db0c397605745ae2fa1
|
4
|
+
data.tar.gz: 9146a5b8e321da01bdd48c28c489e592be4338a8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b91caf2b14bd0f6e433833c715f83a3e0906d2f7295d18c5c611354db1055ee31535cbd068f8b561e8718c2534e4bb76fe7c22ffd8007da7266823a433f71293
|
7
|
+
data.tar.gz: 10a81f1ff20674a506bf7923327d105bb0261b8e58b958ae31abce5d61d0968651c4576c1a6cc1d6a808494b438ac02f792c375934139b33bb6b2fd6b3551e6e
|
data/Gemfile.lock
CHANGED
@@ -94,7 +94,7 @@ GIT
|
|
94
94
|
PATH
|
95
95
|
remote: .
|
96
96
|
specs:
|
97
|
-
chef-dk (0.15.
|
97
|
+
chef-dk (0.15.16)
|
98
98
|
chef (~> 12.5)
|
99
99
|
chef-provisioning (~> 1.2)
|
100
100
|
cookbook-omnifetch (~> 0.2, >= 0.2.2)
|
@@ -684,7 +684,7 @@ GEM
|
|
684
684
|
tzinfo (1.2.2)
|
685
685
|
thread_safe (~> 0.1)
|
686
686
|
ubuntu_ami (0.4.1)
|
687
|
-
unicode-display_width (1.0
|
687
|
+
unicode-display_width (1.1.0)
|
688
688
|
uuid (2.3.8)
|
689
689
|
macaddr (~> 1.0)
|
690
690
|
uuidtools (2.1.5)
|
@@ -1,28 +1,28 @@
|
|
1
|
-
Overview
|
2
|
-
========
|
3
|
-
|
4
|
-
Every Chef installation needs a Chef Repository. This is the place where cookbooks, roles, config files and other artifacts for managing systems with Chef will live. We strongly recommend storing this repository in a version control system such as Git and treat it like source code.
|
5
|
-
|
6
|
-
While we prefer Git, and make this repository available via GitHub, you are welcome to download a tar or zip archive and use your favorite version control system to manage the code.
|
7
|
-
|
8
|
-
Repository Directories
|
9
|
-
======================
|
10
|
-
|
11
|
-
This repository contains several directories, and each directory contains a README file that describes what it is for in greater detail, and how to use it for managing your systems with Chef.
|
12
|
-
|
13
|
-
* `cookbooks/` - Cookbooks you download or create.
|
14
|
-
* `data_bags/` - Store data bags and items in .json in the repository.
|
15
|
-
* `roles/` - Store roles in .rb or .json in the repository.
|
16
|
-
* `environments/` - Store environments in .rb or .json in the repository.
|
17
|
-
|
18
|
-
Configuration
|
19
|
-
=============
|
20
|
-
|
21
|
-
The config file, `.chef/knife.rb` is a repository specific configuration file for knife. If you're using the Chef Platform, you can download one for your organization from the management console. If you're using the Open Source Chef Server, you can generate a new one with `knife configure`. For more information about configuring Knife, see the Knife documentation.
|
22
|
-
|
23
|
-
https://docs.chef.io/knife.html
|
24
|
-
|
25
|
-
Next Steps
|
26
|
-
==========
|
27
|
-
|
28
|
-
Read the README file in each of the subdirectories for more information about what goes in those directories.
|
1
|
+
Overview
|
2
|
+
========
|
3
|
+
|
4
|
+
Every Chef installation needs a Chef Repository. This is the place where cookbooks, roles, config files and other artifacts for managing systems with Chef will live. We strongly recommend storing this repository in a version control system such as Git and treat it like source code.
|
5
|
+
|
6
|
+
While we prefer Git, and make this repository available via GitHub, you are welcome to download a tar or zip archive and use your favorite version control system to manage the code.
|
7
|
+
|
8
|
+
Repository Directories
|
9
|
+
======================
|
10
|
+
|
11
|
+
This repository contains several directories, and each directory contains a README file that describes what it is for in greater detail, and how to use it for managing your systems with Chef.
|
12
|
+
|
13
|
+
* `cookbooks/` - Cookbooks you download or create.
|
14
|
+
* `data_bags/` - Store data bags and items in .json in the repository.
|
15
|
+
* `roles/` - Store roles in .rb or .json in the repository.
|
16
|
+
* `environments/` - Store environments in .rb or .json in the repository.
|
17
|
+
|
18
|
+
Configuration
|
19
|
+
=============
|
20
|
+
|
21
|
+
The config file, `.chef/knife.rb` is a repository specific configuration file for knife. If you're using the Chef Platform, you can download one for your organization from the management console. If you're using the Open Source Chef Server, you can generate a new one with `knife configure`. For more information about configuring Knife, see the Knife documentation.
|
22
|
+
|
23
|
+
https://docs.chef.io/knife.html
|
24
|
+
|
25
|
+
Next Steps
|
26
|
+
==========
|
27
|
+
|
28
|
+
Read the README file in each of the subdirectories for more information about what goes in those directories.
|
@@ -1,27 +1,27 @@
|
|
1
|
-
# Example
|
2
|
-
|
3
|
-
An example cookbook
|
4
|
-
|
5
|
-
## Requirements
|
6
|
-
|
7
|
-
### Platform:
|
8
|
-
|
9
|
-
*No platforms defined*
|
10
|
-
|
11
|
-
### Cookbooks:
|
12
|
-
|
13
|
-
*No dependencies defined*
|
14
|
-
|
15
|
-
## Attributes
|
16
|
-
|
17
|
-
* `node['example']['name']` - Defaults to `Sam Doe`.
|
18
|
-
|
19
|
-
## Recipes
|
20
|
-
|
21
|
-
* example::default
|
22
|
-
|
23
|
-
## License and Maintainer
|
24
|
-
|
25
|
-
Maintainer:: (<>)
|
26
|
-
|
27
|
-
License:: All rights reserved
|
1
|
+
# Example
|
2
|
+
|
3
|
+
An example cookbook
|
4
|
+
|
5
|
+
## Requirements
|
6
|
+
|
7
|
+
### Platform:
|
8
|
+
|
9
|
+
*No platforms defined*
|
10
|
+
|
11
|
+
### Cookbooks:
|
12
|
+
|
13
|
+
*No dependencies defined*
|
14
|
+
|
15
|
+
## Attributes
|
16
|
+
|
17
|
+
* `node['example']['name']` - Defaults to `Sam Doe`.
|
18
|
+
|
19
|
+
## Recipes
|
20
|
+
|
21
|
+
* example::default
|
22
|
+
|
23
|
+
## License and Maintainer
|
24
|
+
|
25
|
+
Maintainer:: (<>)
|
26
|
+
|
27
|
+
License:: All rights reserved
|
@@ -1,58 +1,58 @@
|
|
1
|
-
Data Bags
|
2
|
-
---------
|
3
|
-
|
4
|
-
This directory contains directories of the various data bags you create for your infrastructure. Each subdirectory corresponds to a data bag on the Chef Server, and contains JSON files of the items that go in the bag.
|
5
|
-
|
6
|
-
For example, in this directory you'll find an example data bag directory called `example`, which contains an item definition called `example_item.json`
|
7
|
-
|
8
|
-
Before uploading this item to the server, we must first create the data bag on the Chef Server.
|
9
|
-
|
10
|
-
knife data bag create example
|
11
|
-
|
12
|
-
Then we can upload the items in the data bag's directory to the Chef Server.
|
13
|
-
|
14
|
-
knife data bag from file example example_item.json
|
15
|
-
|
16
|
-
For more information on data bags, see the Chef wiki page:
|
17
|
-
|
18
|
-
https://docs.chef.io/essentials_data_bags.html
|
19
|
-
|
20
|
-
Encrypted Data Bags
|
21
|
-
-------------------
|
22
|
-
|
23
|
-
Added in Chef 0.10, encrypted data bags allow you to encrypt the contents of your data bags. The content of attributes will no longer be searchable. To use encrypted data bags, first you must have or create a secret key.
|
24
|
-
|
25
|
-
openssl rand -base64 512 > secret_key
|
26
|
-
|
27
|
-
You may use this secret_key to add items to a data bag during a create.
|
28
|
-
|
29
|
-
knife data bag create --secret-file secret_key passwords mysql
|
30
|
-
|
31
|
-
You may also use it when adding ITEMs from files,
|
32
|
-
|
33
|
-
knife data bag create passwords
|
34
|
-
knife data bag from file passwords data_bags/passwords/mysql.json --secret-file secret_key
|
35
|
-
|
36
|
-
The JSON for the ITEM must contain a key named "id" with a value equal to "ITEM" and the contents will be encrypted when uploaded. For example,
|
37
|
-
|
38
|
-
{
|
39
|
-
"id": "mysql",
|
40
|
-
"password": "abc123"
|
41
|
-
}
|
42
|
-
|
43
|
-
Without the secret_key, the contents are encrypted.
|
44
|
-
|
45
|
-
knife data bag show passwords mysql
|
46
|
-
id: mysql
|
47
|
-
password: 2I0XUUve1TXEojEyeGsjhw==
|
48
|
-
|
49
|
-
Use the secret_key to view the contents.
|
50
|
-
|
51
|
-
knife data bag show passwords mysql --secret-file secret_key
|
52
|
-
id: mysql
|
53
|
-
password: abc123
|
54
|
-
|
55
|
-
|
56
|
-
For more information on encrypted data bags, see the Chef wiki page:
|
57
|
-
|
58
|
-
https://docs.chef.io/essentials_data_bags.html
|
1
|
+
Data Bags
|
2
|
+
---------
|
3
|
+
|
4
|
+
This directory contains directories of the various data bags you create for your infrastructure. Each subdirectory corresponds to a data bag on the Chef Server, and contains JSON files of the items that go in the bag.
|
5
|
+
|
6
|
+
For example, in this directory you'll find an example data bag directory called `example`, which contains an item definition called `example_item.json`
|
7
|
+
|
8
|
+
Before uploading this item to the server, we must first create the data bag on the Chef Server.
|
9
|
+
|
10
|
+
knife data bag create example
|
11
|
+
|
12
|
+
Then we can upload the items in the data bag's directory to the Chef Server.
|
13
|
+
|
14
|
+
knife data bag from file example example_item.json
|
15
|
+
|
16
|
+
For more information on data bags, see the Chef wiki page:
|
17
|
+
|
18
|
+
https://docs.chef.io/essentials_data_bags.html
|
19
|
+
|
20
|
+
Encrypted Data Bags
|
21
|
+
-------------------
|
22
|
+
|
23
|
+
Added in Chef 0.10, encrypted data bags allow you to encrypt the contents of your data bags. The content of attributes will no longer be searchable. To use encrypted data bags, first you must have or create a secret key.
|
24
|
+
|
25
|
+
openssl rand -base64 512 > secret_key
|
26
|
+
|
27
|
+
You may use this secret_key to add items to a data bag during a create.
|
28
|
+
|
29
|
+
knife data bag create --secret-file secret_key passwords mysql
|
30
|
+
|
31
|
+
You may also use it when adding ITEMs from files,
|
32
|
+
|
33
|
+
knife data bag create passwords
|
34
|
+
knife data bag from file passwords data_bags/passwords/mysql.json --secret-file secret_key
|
35
|
+
|
36
|
+
The JSON for the ITEM must contain a key named "id" with a value equal to "ITEM" and the contents will be encrypted when uploaded. For example,
|
37
|
+
|
38
|
+
{
|
39
|
+
"id": "mysql",
|
40
|
+
"password": "abc123"
|
41
|
+
}
|
42
|
+
|
43
|
+
Without the secret_key, the contents are encrypted.
|
44
|
+
|
45
|
+
knife data bag show passwords mysql
|
46
|
+
id: mysql
|
47
|
+
password: 2I0XUUve1TXEojEyeGsjhw==
|
48
|
+
|
49
|
+
Use the secret_key to view the contents.
|
50
|
+
|
51
|
+
knife data bag show passwords mysql --secret-file secret_key
|
52
|
+
id: mysql
|
53
|
+
password: abc123
|
54
|
+
|
55
|
+
|
56
|
+
For more information on encrypted data bags, see the Chef wiki page:
|
57
|
+
|
58
|
+
https://docs.chef.io/essentials_data_bags.html
|
@@ -1,32 +1,32 @@
|
|
1
|
-
|
2
|
-
context = ChefDK::Generator.context
|
3
|
-
cookbook_dir = File.join(context.cookbook_root, context.cookbook_name)
|
4
|
-
template_dir = File.join(cookbook_dir, "templates", "default")
|
5
|
-
template_filename = context.new_file_basename
|
6
|
-
|
7
|
-
unless File.extname(template_filename) == ".erb"
|
8
|
-
# new_file_basename is a frozen string, so we have to create an entirely
|
9
|
-
# new string here instead of using concat.
|
10
|
-
template_filename = "#{template_filename}.erb"
|
11
|
-
end
|
12
|
-
|
13
|
-
template_path = File.join(cookbook_dir, "templates", "default", template_filename)
|
14
|
-
|
15
|
-
directory template_dir do
|
16
|
-
recursive true
|
17
|
-
end
|
18
|
-
|
19
|
-
if source_file = context.content_source
|
20
|
-
|
21
|
-
file template_path do
|
22
|
-
content(IO.read(source_file))
|
23
|
-
end
|
24
|
-
|
25
|
-
else
|
26
|
-
|
27
|
-
template template_path do
|
28
|
-
source "template.erb"
|
29
|
-
helpers(ChefDK::Generator::TemplateHelper)
|
30
|
-
end
|
31
|
-
|
32
|
-
end
|
1
|
+
|
2
|
+
context = ChefDK::Generator.context
|
3
|
+
cookbook_dir = File.join(context.cookbook_root, context.cookbook_name)
|
4
|
+
template_dir = File.join(cookbook_dir, "templates", "default")
|
5
|
+
template_filename = context.new_file_basename
|
6
|
+
|
7
|
+
unless File.extname(template_filename) == ".erb"
|
8
|
+
# new_file_basename is a frozen string, so we have to create an entirely
|
9
|
+
# new string here instead of using concat.
|
10
|
+
template_filename = "#{template_filename}.erb"
|
11
|
+
end
|
12
|
+
|
13
|
+
template_path = File.join(cookbook_dir, "templates", "default", template_filename)
|
14
|
+
|
15
|
+
directory template_dir do
|
16
|
+
recursive true
|
17
|
+
end
|
18
|
+
|
19
|
+
if source_file = context.content_source
|
20
|
+
|
21
|
+
file template_path do
|
22
|
+
content(IO.read(source_file))
|
23
|
+
end
|
24
|
+
|
25
|
+
else
|
26
|
+
|
27
|
+
template template_path do
|
28
|
+
source "template.erb"
|
29
|
+
helpers(ChefDK::Generator::TemplateHelper)
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
data/lib/chef-dk/version.rb
CHANGED
data/omnibus_overrides.rb
CHANGED
@@ -1,32 +1,32 @@
|
|
1
|
-
#
|
2
|
-
# Copyright:: Copyright (c) 2014 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 'spec_helper'
|
19
|
-
require 'shared/a_file_generator'
|
20
|
-
require 'chef-dk/command/generator_commands/template'
|
21
|
-
|
22
|
-
describe ChefDK::Command::GeneratorCommands::Template do
|
23
|
-
|
24
|
-
include_examples "a file generator" do
|
25
|
-
|
26
|
-
let(:generator_name) { "template" }
|
27
|
-
let(:generated_files) { [ "templates/default/new_template.txt.erb" ] }
|
28
|
-
let(:new_file_name) { "new_template.txt" }
|
29
|
-
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
1
|
+
#
|
2
|
+
# Copyright:: Copyright (c) 2014 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 'spec_helper'
|
19
|
+
require 'shared/a_file_generator'
|
20
|
+
require 'chef-dk/command/generator_commands/template'
|
21
|
+
|
22
|
+
describe ChefDK::Command::GeneratorCommands::Template do
|
23
|
+
|
24
|
+
include_examples "a file generator" do
|
25
|
+
|
26
|
+
let(:generator_name) { "template" }
|
27
|
+
let(:generated_files) { [ "templates/default/new_template.txt.erb" ] }
|
28
|
+
let(:new_file_name) { "new_template.txt" }
|
29
|
+
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
data/version_policy.rb
CHANGED
@@ -48,13 +48,6 @@ OMNIBUS_OVERRIDES = {
|
|
48
48
|
## These can float as they are frequently updated in a way that works for us
|
49
49
|
#override "cacerts" =>"???",
|
50
50
|
#override "openssl" =>"???",
|
51
|
-
|
52
|
-
# We manually pin Delivery CLI right now. In the future we should have the bump
|
53
|
-
# bot automatically update this to the latest delivered version. We cannot look
|
54
|
-
# in Artifactory because in the future we will only be building Delivery CLI
|
55
|
-
# from the ChefDK. We cannot look at the Github tags because those are committed
|
56
|
-
# in the Build phase, and we only want to send customers Delivered changes.
|
57
|
-
"delivery-cli" => "0.0.23",
|
58
51
|
}
|
59
52
|
|
60
53
|
#
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chef-dk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.15.
|
4
|
+
version: 0.15.16
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel DeLeo
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2016-
|
13
|
+
date: 2016-07-05 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: mixlib-cli
|