chef-berksfile-env 1.0.0 → 1.1.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/README.md +34 -8
- data/VERSION +1 -1
- metadata +58 -31
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 34d7bc1cab0522e6afae0a750b4da044152fac5a
|
4
|
+
data.tar.gz: b618f43e9b9d6c98afeb3e130b9951f87bb8d293
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2147a05c082737b30a2a9b2b0cd8457d37708877aab30cd69ae88122c21e0fcea7005de60f5914da65755840a7afa63775b75174c9406e0c73f8844912e71418
|
7
|
+
data.tar.gz: 936099dc6d2132b079f38afd8eb63b36eacf3d6c06659f6cd82adee2d9e2802a01e26db8092b69fe8dfeeda3ebf0e7186067042883b65d13dc252dd8ad5a85ee
|
data/README.md
CHANGED
@@ -1,7 +1,9 @@
|
|
1
1
|
Chef-Berksfile-Env
|
2
2
|
==================
|
3
3
|
|
4
|
-
A Chef plugin which allows you to lock down your Chef Environment with a Berksfile.
|
4
|
+
A Chef plugin which allows you to lock down your Chef Environment's cookbook versions with a Berksfile.
|
5
|
+
|
6
|
+
This is effectively the same as doing `berks apply ...` but via `knife environment from file ...`.
|
5
7
|
|
6
8
|
Installation
|
7
9
|
------------
|
@@ -15,8 +17,8 @@ In your chef repo create a Berksfile next to your Chef environment file like thi
|
|
15
17
|
|
16
18
|
chef-repo/environments/[ENV_NAME]/Berksfile
|
17
19
|
|
18
|
-
This is the default location that will used by the plugin. We have to put the
|
19
|
-
directory since [multiple
|
20
|
+
This is the default location that will used by the plugin. We have to put the Berksfile in its own
|
21
|
+
directory since [multiple Berksfiles can't exist in the same directory](https://github.com/berkshelf/berkshelf/issues/1247).
|
20
22
|
|
21
23
|
The berksfile should include any cookbooks that your nodes or roles explicitly mention for that environment,
|
22
24
|
|
@@ -34,20 +36,44 @@ Your environment file must by in `.rb` format and look like this,
|
|
34
36
|
|
35
37
|
require 'chef-berksfile-env'
|
36
38
|
|
37
|
-
#
|
39
|
+
# The name must be defined first so we can use it to find the Berksfile
|
38
40
|
name "my_env"
|
39
41
|
|
40
|
-
# Load Berksfile locked dependencies as my
|
42
|
+
# Load Berksfile locked dependencies as my environment's cookbook version contraints
|
41
43
|
load_berksfile
|
42
44
|
|
43
45
|
...
|
44
46
|
|
45
|
-
Now our environment will
|
46
|
-
|
47
|
+
Now our environment will use the locked versions of the cookbooks and transitive dependencies generated by our Berksfile.
|
48
|
+
Upgrading to the latest dependecies is now as simple as,
|
47
49
|
|
48
50
|
berks install
|
49
51
|
|
50
52
|
Our Berksfile also provides an easy way to ensure all the cookbooks and their versions that our environment requires
|
51
53
|
are uploaded to our chef-server,
|
52
54
|
|
53
|
-
berks upload
|
55
|
+
berks upload
|
56
|
+
|
57
|
+
How the Plugin Finds the Berksfile
|
58
|
+
----------------------------------
|
59
|
+
|
60
|
+
If you are curious how the plugin knows to find the Berksfile in `chef-repo/environments/[ENV]/Berksfile`, you
|
61
|
+
want to put your Berksfile somewhere else or you have run into this error `Expected Berksfile at [/path/../Berksfile] but does not exist`,
|
62
|
+
this section will explain how this works and ways to tweak the path or fix your error.
|
63
|
+
|
64
|
+
`load_berksfile` has an optional argument which represents the path to your Berksfile. This path can be pseduo relative (explained in a moment)
|
65
|
+
or absolute. By default the value is `environments/[ENV_NAME]/Berksfile`.
|
66
|
+
|
67
|
+
By pseduo relative I mean that its a relative path but the plugin will check to see if the directory we are executing from partially matches
|
68
|
+
our relative path. So if we are running knife from `/home/chef-repo/environments` and our relative path is `chef-repo/environments/dev/Berksfile`
|
69
|
+
the plugin will see that the relative path is partially included in our execution directory and will attempt to merge the two to come up with
|
70
|
+
`/home/chef-repo/environments/dev/Berksfile`. If we can't make any match at all we attempt to guess the path by just joining the relative path
|
71
|
+
with our execution directory.
|
72
|
+
|
73
|
+
So why do we do this? Well the only way to use this plugin is if your environment is in Ruby format. Chef's `knife from file ...` uses Ruby's
|
74
|
+
`instance_eval` in order to do this. This means the code on Chef's end effectively looks like this,
|
75
|
+
|
76
|
+
env.instance_eval(IO.read(env_ruby_file))
|
77
|
+
|
78
|
+
which means that any context about the location of the environment file is lost. So we have no great way to discern the location of our environment
|
79
|
+
Ruby file, so instead we guess.
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.1.0
|
metadata
CHANGED
@@ -1,116 +1,143 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chef-berksfile-env
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bryan Baugher
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-04-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: berkshelf
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '3.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - ~>
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '3.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: chef
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '11.0'
|
34
|
+
- - "<"
|
35
|
+
- !ruby/object:Gem::Version
|
36
|
+
version: '13.0'
|
34
37
|
type: :runtime
|
35
38
|
prerelease: false
|
36
39
|
version_requirements: !ruby/object:Gem::Requirement
|
37
40
|
requirements:
|
38
|
-
- -
|
41
|
+
- - ">="
|
39
42
|
- !ruby/object:Gem::Version
|
40
43
|
version: '11.0'
|
44
|
+
- - "<"
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '13.0'
|
41
47
|
- !ruby/object:Gem::Dependency
|
42
48
|
name: bundler
|
43
49
|
requirement: !ruby/object:Gem::Requirement
|
44
50
|
requirements:
|
45
|
-
- - ~>
|
51
|
+
- - "~>"
|
46
52
|
- !ruby/object:Gem::Version
|
47
53
|
version: '1.6'
|
48
54
|
type: :development
|
49
55
|
prerelease: false
|
50
56
|
version_requirements: !ruby/object:Gem::Requirement
|
51
57
|
requirements:
|
52
|
-
- - ~>
|
58
|
+
- - "~>"
|
53
59
|
- !ruby/object:Gem::Version
|
54
60
|
version: '1.6'
|
55
61
|
- !ruby/object:Gem::Dependency
|
56
62
|
name: rake
|
57
63
|
requirement: !ruby/object:Gem::Requirement
|
58
64
|
requirements:
|
59
|
-
- - ~>
|
65
|
+
- - "~>"
|
60
66
|
- !ruby/object:Gem::Version
|
61
67
|
version: '0.9'
|
62
68
|
type: :development
|
63
69
|
prerelease: false
|
64
70
|
version_requirements: !ruby/object:Gem::Requirement
|
65
71
|
requirements:
|
66
|
-
- - ~>
|
72
|
+
- - "~>"
|
67
73
|
- !ruby/object:Gem::Version
|
68
74
|
version: '0.9'
|
69
75
|
- !ruby/object:Gem::Dependency
|
70
76
|
name: octokit
|
71
77
|
requirement: !ruby/object:Gem::Requirement
|
72
78
|
requirements:
|
73
|
-
- - ~>
|
79
|
+
- - "~>"
|
74
80
|
- !ruby/object:Gem::Version
|
75
81
|
version: '3.0'
|
76
82
|
type: :development
|
77
83
|
prerelease: false
|
78
84
|
version_requirements: !ruby/object:Gem::Requirement
|
79
85
|
requirements:
|
80
|
-
- - ~>
|
86
|
+
- - "~>"
|
81
87
|
- !ruby/object:Gem::Version
|
82
88
|
version: '3.0'
|
83
89
|
description: "Chef-Berksfile-Env\n==================\n\nA Chef plugin which allows
|
84
|
-
you to lock down your Chef Environment with a Berksfile.\n\
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
+
you to lock down your Chef Environment's cookbook versions with a Berksfile.\n\nThis
|
91
|
+
is effectively the same as doing `berks apply ...` but via `knife environment from
|
92
|
+
file ...`.\n\nInstallation\n------------\n\n /opt/chef/embedded/bin/gem install
|
93
|
+
chef-berksfile-env\n\nUsage\n-----\n\nIn your chef repo create a Berksfile next
|
94
|
+
to your Chef environment file like this,\n\n chef-repo/environments/[ENV_NAME]/Berksfile\n\nThis
|
95
|
+
is the default location that will used by the plugin. We have to put the Berksfile
|
96
|
+
in its own\ndirectory since [multiple Berksfiles can't exist in the same directory](https://github.com/berkshelf/berkshelf/issues/1247).
|
90
97
|
\n\nThe berksfile should include any cookbooks that your nodes or roles explicitly
|
91
98
|
mention for that environment,\n\n source \"https://supermarket.getchef.com\"\n\n
|
92
99
|
\ cookbook \"java\"\n cookbook \"yum\", \"~> 2.0\"\n ...\n\nNext we need
|
93
100
|
to generate our Berksfile's lock file,\n\n berks install\n\nYour environment
|
94
101
|
file must by in `.rb` format and look like this,\n\n require 'chef-berksfile-env'\n
|
95
|
-
\ \n #
|
96
|
-
\ \n # Load Berksfile locked dependencies as my
|
97
|
-
\
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
\
|
102
|
+
\ \n # The name must be defined first so we can use it to find the Berksfile\n
|
103
|
+
\ name \"my_env\"\n \n # Load Berksfile locked dependencies as my environment's
|
104
|
+
cookbook version contraints\n load_berksfile\n\n ...\n\nNow our environment
|
105
|
+
will use the locked versions of the cookbooks and transitive dependencies generated
|
106
|
+
by our Berksfile. \nUpgrading to the latest dependecies is now as simple as,\n\n
|
107
|
+
\ berks install\n\nOur Berksfile also provides an easy way to ensure all the cookbooks
|
108
|
+
and their versions that our environment requires \nare uploaded to our chef-server,\n\n
|
109
|
+
\ berks upload\n\nHow the Plugin Finds the Berksfile\n----------------------------------\n\nIf
|
110
|
+
you are curious how the plugin knows to find the Berksfile in `chef-repo/environments/[ENV]/Berksfile`,
|
111
|
+
you \nwant to put your Berksfile somewhere else or you have run into this error
|
112
|
+
`Expected Berksfile at [/path/../Berksfile] but does not exist`, \nthis section
|
113
|
+
will explain how this works and ways to tweak the path or fix your error.\n\n`load_berksfile`
|
114
|
+
has an optional argument which represents the path to your Berksfile. This path
|
115
|
+
can be pseduo relative (explained in a moment) \nor absolute. By default the value
|
116
|
+
is `environments/[ENV_NAME]/Berksfile`.\n\nBy pseduo relative I mean that its a
|
117
|
+
relative path but the plugin will check to see if the directory we are executing
|
118
|
+
from partially matches \nour relative path. So if we are running knife from `/home/chef-repo/environments`
|
119
|
+
and our relative path is `chef-repo/environments/dev/Berksfile` \nthe plugin will
|
120
|
+
see that the relative path is partially included in our execution directory and
|
121
|
+
will attempt to merge the two to come up with \n`/home/chef-repo/environments/dev/Berksfile`.
|
122
|
+
If we can't make any match at all we attempt to guess the path by just joining the
|
123
|
+
relative path \nwith our execution directory.\n\nSo why do we do this? Well the
|
124
|
+
only way to use this plugin is if your environment is in Ruby format. Chef's `knife
|
125
|
+
from file ...` uses Ruby's\n`instance_eval` in order to do this. This means the
|
126
|
+
code on Chef's end effectively looks like this,\n\n env.instance_eval(IO.read(env_ruby_file))\n\nwhich
|
127
|
+
means that any context about the location of the environment file is lost. So we
|
128
|
+
have no great way to discern the location of our environment \nRuby file, so instead
|
129
|
+
we guess."
|
103
130
|
email:
|
104
131
|
- bryan.baugher@cerner.com
|
105
132
|
executables: []
|
106
133
|
extensions: []
|
107
134
|
extra_rdoc_files: []
|
108
135
|
files:
|
109
|
-
- lib/chef-berksfile-env.rb
|
110
136
|
- Gemfile
|
111
|
-
- Rakefile
|
112
137
|
- README.md
|
138
|
+
- Rakefile
|
113
139
|
- VERSION
|
140
|
+
- lib/chef-berksfile-env.rb
|
114
141
|
homepage: http://github.com/bbaugher/chef-berksfile-env
|
115
142
|
licenses:
|
116
143
|
- MIT
|
@@ -121,17 +148,17 @@ require_paths:
|
|
121
148
|
- lib
|
122
149
|
required_ruby_version: !ruby/object:Gem::Requirement
|
123
150
|
requirements:
|
124
|
-
- -
|
151
|
+
- - ">="
|
125
152
|
- !ruby/object:Gem::Version
|
126
153
|
version: '0'
|
127
154
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
128
155
|
requirements:
|
129
|
-
- -
|
156
|
+
- - ">="
|
130
157
|
- !ruby/object:Gem::Version
|
131
158
|
version: '0'
|
132
159
|
requirements: []
|
133
160
|
rubyforge_project:
|
134
|
-
rubygems_version: 2.
|
161
|
+
rubygems_version: 2.2.2
|
135
162
|
signing_key:
|
136
163
|
specification_version: 4
|
137
164
|
summary: A Chef plugin to lock down your Chef Environment with a Berksfile
|