knife-block 0.1.0 → 0.1.1
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.
- data/README.md +3 -3
- data/knife-block.gemspec +2 -1
- data/lib/chef/knife/block.rb +7 -6
- data/lib/knife-block/version.rb +1 -1
- metadata +5 -4
data/README.md
CHANGED
|
@@ -18,7 +18,7 @@ At present, knife-block requires ruby 1.9.2 or above. This is owing to the use
|
|
|
18
18
|
|
|
19
19
|
Knife looks for knife.rb in ~/.chef - all this script does is create a symlink from the required configuration to knife.rb so that knife can act on the appropriate server.
|
|
20
20
|
|
|
21
|
-
Create a knife
|
|
21
|
+
Create a knife-<service_name>.rb configuration file in your ~/.chef directory for each Chef server that you wish to connect to.
|
|
22
22
|
|
|
23
23
|
**Please note - this script will check to see if knife.rb exists and whether it is a symlink or not.**
|
|
24
24
|
|
|
@@ -40,13 +40,13 @@ Create a knife-<service_name>.rb configuration file in your ~/.chef directory fo
|
|
|
40
40
|
The knife configuration has been updated to use opscode-hosted-chef
|
|
41
41
|
|
|
42
42
|
#### Create a new server
|
|
43
|
-
(Launches "knife configure" and creates $HOME/.chef/knife
|
|
43
|
+
(Launches "knife configure" and creates $HOME/.chef/knife-<friendlyname>.rb)
|
|
44
44
|
|
|
45
45
|
knife block new <friendlyname>
|
|
46
46
|
|
|
47
47
|
|
|
48
48
|
### Berkshelf integration
|
|
49
|
-
Knife block supports Berkshelf, however, the berkshelf config files must be manually created and named "config
|
|
49
|
+
Knife block supports Berkshelf, however, the berkshelf config files must be manually created and named "config-<block>.json" and put in the Berkshelf directory (typically ~/.berkshelf). In the future, these files could be automatically created by knife block.
|
|
50
50
|
|
|
51
51
|
|
|
52
52
|
These knife plugins are supplied without any warranty or guarantees regarding suitability for purpose.
|
data/knife-block.gemspec
CHANGED
|
@@ -6,7 +6,8 @@ Gem::Specification.new do |gem|
|
|
|
6
6
|
gem.email = ["theprofessor@threedrunkensysadsonthe.net"]
|
|
7
7
|
gem.description = %q{Create and manage knife.rb files for OpsCodes' Chef}
|
|
8
8
|
gem.summary = %q{Create and manage knife.rb files for OpsCodes' Chef}
|
|
9
|
-
gem.homepage = ""
|
|
9
|
+
gem.homepage = "https://github.com/greenandsecure/knife-block"
|
|
10
|
+
gem.license = "MIT"
|
|
10
11
|
|
|
11
12
|
gem.files = `git ls-files`.split($\)
|
|
12
13
|
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
data/lib/chef/knife/block.rb
CHANGED
|
@@ -11,22 +11,23 @@
|
|
|
11
11
|
class Chef
|
|
12
12
|
class Knife
|
|
13
13
|
def get_config_file
|
|
14
|
-
|
|
15
14
|
# locate_config_file is only compatible with Chef 11
|
|
16
|
-
|
|
17
|
-
if GreenAndSecure.current_chef_version >= _chef11
|
|
15
|
+
if GreenAndSecure.current_chef_version >= ::Gem::Version.new('11.8.0')
|
|
18
16
|
config[:config_file] ||= ::Chef::Knife.locate_config_file
|
|
17
|
+
elsif GreenAndSecure.current_chef_version >= ::Gem::Version.new('11.0.0')
|
|
18
|
+
locate_config_file
|
|
19
19
|
else
|
|
20
20
|
GreenAndSecure.locate_config_file config
|
|
21
21
|
end
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
# if we haven't created our knife.rb yet, set defaults to ~/.chef so we can create the config.
|
|
24
|
+
config[:config_file] ? File.dirname(config[:config_file]) : File.join(ENV['HOME'], '.chef')
|
|
24
25
|
end
|
|
25
26
|
end
|
|
26
27
|
end
|
|
27
28
|
|
|
28
29
|
module GreenAndSecure
|
|
29
|
-
@@current_chef_version = ::
|
|
30
|
+
@@current_chef_version = ::Gem::Version.new(::Chef::VERSION)
|
|
30
31
|
@@knife = ::Chef::Knife.new
|
|
31
32
|
|
|
32
33
|
def current_chef_version
|
|
@@ -222,7 +223,7 @@ module GreenAndSecure
|
|
|
222
223
|
knife_config.config[:client_key] = "#{GreenAndSecure::chef_config_base}/#{@client_name}-#{@config_name}.pem"
|
|
223
224
|
knife_config.run
|
|
224
225
|
|
|
225
|
-
puts "#{GreenAndSecure::chef_config_base}/knife-#{@config_name}.rb has been
|
|
226
|
+
puts "#{GreenAndSecure::chef_config_base}/knife-#{@config_name}.rb has been successfully created"
|
|
226
227
|
GreenAndSecure::BlockList.new.run
|
|
227
228
|
use = GreenAndSecure::BlockUse.new
|
|
228
229
|
use.name_args = [@config_name]
|
data/lib/knife-block/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: knife-block
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.1
|
|
5
5
|
prerelease:
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date:
|
|
12
|
+
date: 2014-06-18 00:00:00.000000000 Z
|
|
13
13
|
dependencies: []
|
|
14
14
|
description: Create and manage knife.rb files for OpsCodes' Chef
|
|
15
15
|
email:
|
|
@@ -29,8 +29,9 @@ files:
|
|
|
29
29
|
- lib/knife-block.rb
|
|
30
30
|
- lib/knife-block/version.rb
|
|
31
31
|
- test/unit/knifeblock_test.rb
|
|
32
|
-
homepage:
|
|
33
|
-
licenses:
|
|
32
|
+
homepage: https://github.com/greenandsecure/knife-block
|
|
33
|
+
licenses:
|
|
34
|
+
- MIT
|
|
34
35
|
post_install_message:
|
|
35
36
|
rdoc_options: []
|
|
36
37
|
require_paths:
|