spiceweasel 0.3 → 0.4

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/CHANGELOG.md CHANGED
@@ -24,15 +24,20 @@ This is the current, previous and future development milestones and contains the
24
24
 
25
25
  0.4
26
26
  ===
27
- * --chef-client The option `--chef-client` will make a `knife ssh` call to each box and run `chef-client` on each.
28
- * --chef-client validation that nodes are added
27
+ * support versions for cookbooks
28
+ * support site vendor for cookbooks
29
+
30
+ 0.5
31
+ ===
32
+ * support JSON and YAML
29
33
 
30
34
  BACKLOG
31
35
  =======
32
- * support site vendor for cookbooks
33
- * support versions for cookbooks
36
+ * convert to a knife plugin (knife batchload from file infrastructure.yml)
37
+ * --chef-client The option `--chef-client` will make a `knife ssh` call to each box and run `chef-client` on each.
38
+ * --chef-client validation that nodes are added
34
39
  * add support for environments
35
- * make the JSON calls directly with Spice (https://github.com/danryan/spice)
40
+ * make the JSON calls directly with Chef APIs
36
41
  * -e/--execute execute the commands
37
42
  * catching return codes and retrying (with retry count?)
38
43
  * on provider delete take count of vendor-specific, delete if match (ec2 server delete and node delete)
data/README.md CHANGED
@@ -21,6 +21,7 @@ The syntax for the spiceweasel file is a simple YAML format of Chef primitives d
21
21
  cookbooks:
22
22
  - apache2:
23
23
  - apt:
24
+ - 1.1.0
24
25
  - mysql:
25
26
 
26
27
  roles:
@@ -48,16 +49,18 @@ The syntax for the spiceweasel file is a simple YAML format of Chef primitives d
48
49
 
49
50
  Cookbooks
50
51
  ---------
51
- The `cookbooks` section of the YAML file currently supports `knife cookbook upload FOO` where `FOO` is the name of the cookbook in the `cookbooks` directory. The YAML snippet
52
+ The `cookbooks` section of the YAML file currently supports `knife cookbook upload FOO` where `FOO` is the name of the cookbook in the `cookbooks` directory. If a version is passed, it is validated against an existing cookbook `metadata.rb` and if none is found, the missing cookbook is downloaded. The YAML snippet
52
53
 
53
54
  cookbooks:
54
55
  - apache2:
55
56
  - apt:
57
+ - 1.1.0
56
58
  - mysql:
57
59
 
58
60
  produces the knife commands
59
61
 
60
62
  knife cookbook upload apache2
63
+ knife cookbook site vendor apt 1.1.0
61
64
  knife cookbook upload apt
62
65
  knife cookbook upload mysql
63
66
 
data/bin/spiceweasel CHANGED
@@ -76,7 +76,7 @@ begin
76
76
  cli.parse_options
77
77
  rescue OptionParser::InvalidOption => e
78
78
  STDERR.puts e.message
79
- #puts???
79
+ puts cli.opt_parser.to_s
80
80
  exit(-1)
81
81
  end
82
82
 
@@ -84,7 +84,7 @@ begin
84
84
  yml = YAML.load_file ARGV.last
85
85
  rescue Exception
86
86
  STDERR.puts "No infrastructure YAML file provided."
87
- #puts???
87
+ puts cli.opt_parser.to_s
88
88
  exit(-1)
89
89
  end
90
90
 
@@ -95,10 +95,27 @@ delete = String.new()
95
95
  cookbooks = yml['cookbooks'] || []
96
96
  cookbook_list = []
97
97
  cookbooks.each do |cookbook|
98
- delete += "knife cookbook delete #{cookbook.keys[0]} -y\n"
99
- create += "knife cookbook upload #{cookbook.keys[0]}\n"
98
+ cb = cookbook.keys.first
99
+ #get the version if available
100
+ version = cookbook[cb]
101
+ delete += "knife cookbook delete #{cb} #{version} -y\n"
102
+ if File.directory?("cookbooks")
103
+ if version and File.directory?("cookbooks/#{cb}")
104
+ #check metadata.rb for requested version
105
+ metadata = File.open("cookbooks/#{cb}/metadata.rb").grep(/^version/)[0].split()[1].gsub(/"/,'')
106
+ if (metadata != version[0])
107
+ raise "Invalid version '#{version[0]}' of '#{cb}' requested, '#{metadata}' is already in the cookbooks directory."
108
+ exit(-1)
109
+ end
110
+ elsif !File.directory?("cookbooks/#{cb}")
111
+ create += "knife cookbook site vendor #{cb} #{version}\n"
112
+ end
113
+ else
114
+ STDERR.puts "cookbooks directory not found, validation and downloading skipped"
115
+ end
116
+ create += "knife cookbook upload #{cb}\n"
100
117
  #flatten list of cookbooks for validation later
101
- cookbook_list.push(cookbook.keys[0])
118
+ cookbook_list.push(cb)
102
119
  end
103
120
 
104
121
  #roles
@@ -165,5 +182,3 @@ end
165
182
  #eventually we will execute instead of printing knife commands
166
183
  #puts "BAM!"
167
184
  #end
168
-
169
-
data/example.yml CHANGED
@@ -1,6 +1,7 @@
1
1
  cookbooks:
2
2
  - apache2:
3
3
  - apt:
4
+ - 1.1.0
4
5
  - mysql:
5
6
 
6
7
  roles:
@@ -1,3 +1,3 @@
1
1
  module Spiceweasel
2
- VERSION = "0.3"
2
+ VERSION = "0.4"
3
3
  end
metadata CHANGED
@@ -1,12 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spiceweasel
3
3
  version: !ruby/object:Gem::Version
4
- hash: 13
4
+ hash: 3
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
- - 3
9
- version: "0.3"
8
+ - 4
9
+ version: "0.4"
10
10
  platform: ruby
11
11
  authors:
12
12
  - Matt Ray
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2011-03-07 00:00:00 -06:00
17
+ date: 2011-03-11 00:00:00 -06:00
18
18
  default_executable:
19
19
  dependencies: []
20
20