spiceweasel 0.8.2 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -8,16 +8,11 @@ The [https://github.com/mattray/ravel-repo](https://github.com/mattray/ravel-rep
8
8
 
9
9
  The [CHANGELOG.md](https://github.com/mattray/spiceweasel/blob/master/CHANGELOG.md) covers current, previous and future development milestones and contains the features backlog.
10
10
 
11
-
12
11
  Requirements
13
12
  ============
14
13
  Spiceweasel currently depends on `knife` to run commands for it. Infrastructure files must either end in .json or .yml to be processed.
15
14
 
16
- Written initially with Chef 0.9.12 (should still work) and continuing to develop with support for 0.10.
17
-
18
- Testing
19
- -------
20
- Tested with Ubuntu 10.04 and Chef 0.9.16 and 0.10.4.
15
+ Written and tested initially with Chef 0.9.12 (should still work) and continuing development with the 0.10 series.
21
16
 
22
17
  File Syntax
23
18
  ===========
@@ -153,7 +148,7 @@ From the `example.json`:
153
148
 
154
149
  Cookbooks
155
150
  ---------
156
- The `cookbooks` section of the JSON or 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` (it must match the `metadata.rb` string exactly) and if none is found, the missing cookbook is downloaded (without touching version control) and the command to untar it is provided. You may pass any additional arguments if necessary. The YAML snippet
151
+ The `cookbooks` section of the JSON or YAML file currently supports `knife cookbook upload FOO` where `FOO` is the name of the cookbook in the `cookbooks` directory. The default behavior is to download the cookbook as a tarball, untar it and remove the tarball. The `--siteinstall` option will allow for use of `knife cookbook site install` with the cookbook and the creation of a vendor branch if git is the underlying version control. If a version is passed, it is validated against the existing cookbook `metadata.rb` and it must match the `metadata.rb` string exactly. You may pass any additional arguments if necessary. The YAML snippet
157
152
 
158
153
  ``` yaml
159
154
  cookbooks:
@@ -169,6 +164,7 @@ produces the knife commands
169
164
  knife cookbook upload apache2
170
165
  knife cookbook site download apt 1.1.0 --file cookbooks/apt.tgz
171
166
  tar -C cookbooks/ -xf cookbooks/apt.tgz
167
+ rm -f cookbooks/apt.tgz
172
168
  knife cookbook upload apt
173
169
  knife cookbook upload mysql
174
170
  ```
@@ -294,22 +290,38 @@ spiceweasel path/to/infrastructure.yml
294
290
 
295
291
  This will generate the knife commands to build the described infrastructure. Infrastructure files must end in either `.json` or `.yml`.
296
292
 
297
- --dryrun
298
- --------
299
- This is the default action, printing the knife commands to be run without executing them.
293
+ -c/--knifeconfig
294
+ ----------------
295
+ Specify a knife.rb configuration file to use with the knife commands.
296
+
297
+ --debug
298
+ -------
299
+ This provides verbose debugging messages.
300
300
 
301
301
  -d/--delete
302
302
  -----------
303
- The delete command will generate the knife commands to delete the infrastructure described in the file. This includes each cookbook, role, data bag, environment and node listed. Currently all nodes from the system are deleted with `knife node bulk_delete`, specific-node support will be added in a future release.
303
+ The delete command will generate the knife commands to delete the infrastructure described in the file. This includes each cookbook, role, data bag, environment and node listed. Node deletion will specify individual nodes, attempt to pass the list of nodes to the cloud provider for deletion, and finish with `knife node bulk delete`. If you are mixing individual nodes with cloud provider nodes it is possible that nodes may be missed from cloud provider deletion and you should double-check (ie. `knife ec2 server list`).
304
+
305
+ --dryrun
306
+ --------
307
+ This is the default action, printing the knife commands to be run without executing them.
304
308
 
305
309
  -h/--help
306
310
  ---------
307
311
  Print the currently-supported usage options for spiceweasel.
308
312
 
313
+ --parallel
314
+ ----------
315
+ Use the GNU 'parallel' command to execute 'knife VENDOR server create' commands that may be parallelized.
316
+
309
317
  -r/--rebuild
310
318
  ---------
311
319
  The rebuild command will generate the knife commands to delete and recreate the infrastructure described in the file. This includes each cookbook, role, data bag, environment and node listed. Currently all nodes from the system are deleted with `knife node bulk_delete`, specific-node support will be added in a future release.
312
320
 
321
+ --siteinstall
322
+ -------------
323
+ Use the 'install' command with 'knife cookbook site' instead of the default 'download'.
324
+
313
325
  -v/--version
314
326
  ------------
315
327
  Print the version of spiceweasel currently installed.
data/bin/spiceweasel CHANGED
@@ -13,6 +13,8 @@ begin
13
13
  cli = Spiceweasel::CLI.new
14
14
  cli.parse_options
15
15
  DEBUG = cli.config[:debug]
16
+ PARALLEL = cli.config[:parallel]
17
+ SITEINSTALL = cli.config[:siteinstall]
16
18
  rescue OptionParser::InvalidOption => e
17
19
  STDERR.puts e.message
18
20
  puts cli.opt_parser.to_s
@@ -8,7 +8,7 @@ class Spiceweasel::CLI
8
8
 
9
9
  option :debug,
10
10
  :long => "--debug",
11
- :description => "Verbose debugging messages.",
11
+ :description => "Verbose debugging messages",
12
12
  :boolean => true
13
13
 
14
14
  option :delete,
@@ -31,12 +31,27 @@ class Spiceweasel::CLI
31
31
  :show_options => true,
32
32
  :exit => 0
33
33
 
34
+ option :knifeconfig,
35
+ :short => "-c CONFIG",
36
+ :long => "--knifeconfig CONFIG",
37
+ :description => "Specify the knife.rb configuration file to use"
38
+
39
+ option :parallel,
40
+ :long => "--parallel",
41
+ :description => "Use the GNU 'parallel' command to parallelize 'knife VENDOR server create' commands that are not order-dependent",
42
+ :boolean => true
43
+
34
44
  option :rebuild,
35
45
  :short => "-r",
36
46
  :long => "--rebuild",
37
47
  :description => "Print the knife commands to be delete and recreate the infrastructure",
38
48
  :boolean => true
39
49
 
50
+ option :siteinstall,
51
+ :long => "--siteinstall",
52
+ :description => "Use the 'install' command with 'knife cookbook site' instead of the default 'download'",
53
+ :boolean => true
54
+
40
55
  option :version,
41
56
  :short => "-v",
42
57
  :long => "--version",
@@ -45,9 +60,4 @@ class Spiceweasel::CLI
45
60
  :proc => lambda {|v| puts "Spiceweasel: #{Spiceweasel::VERSION}" },
46
61
  :exit => 0
47
62
 
48
- option :knifeconfig,
49
- :short => "-c CONFIG",
50
- :long => "--knifeconfig CONFIG",
51
- :description => "The knife.rb configuration file to use."
52
-
53
63
  end
@@ -20,8 +20,13 @@ class Spiceweasel::CookbookList
20
20
  exit(-1)
21
21
  end
22
22
  elsif !File.directory?("cookbooks/#{cb}")
23
- @create += "knife cookbook#{options['knife_options']} site download #{cb} #{version} --file cookbooks/#{cb}.tgz #{args}\n"
24
- @create += "tar -C cookbooks/ -xf cookbooks/#{cb}.tgz\n"
23
+ if SITEINSTALL #use knife cookbook site install
24
+ @create += "knife cookbook#{options['knife_options']} site install #{cb} #{version} #{args}\n"
25
+ else #use knife cookbook site download, untar and then remove the tarball
26
+ @create += "knife cookbook#{options['knife_options']} site download #{cb} #{version} --file cookbooks/#{cb}.tgz #{args}\n"
27
+ @create += "tar -C cookbooks/ -xf cookbooks/#{cb}.tgz\n"
28
+ @create += "rm -f cookbooks/#{cb}.tgz\n"
29
+ end
25
30
  end
26
31
  else
27
32
  STDERR.puts "cookbooks directory not found, validation and downloading skipped"
@@ -3,7 +3,6 @@ class Spiceweasel::NodeList
3
3
  nodes ||= []
4
4
  @create = @delete = ''
5
5
 
6
- @delete += "knife node#{options['knife_options']} bulk_delete .* -y\n"
7
6
  if nodes
8
7
  nodes.each do |node|
9
8
  STDOUT.puts "DEBUG: node: #{node.keys[0]}" if DEBUG
@@ -11,29 +10,39 @@ class Spiceweasel::NodeList
11
10
  STDOUT.puts "DEBUG: node run_list: #{run_list}" if DEBUG
12
11
  Spiceweasel::RunList.new(run_list).validate(cookbook_list, environment_list, role_list)
13
12
  #provider support
14
- if node.keys[0].start_with?("bluebox","ec2","openstack","rackspace","slicehost","terremark")
13
+ if node.keys[0].start_with?("bluebox","ec2","gandi","openstack","rackspace","slicehost","terremark","voxel")
15
14
  provider = node.keys[0].split()
16
15
  count = 1
17
16
  if (provider.length == 2)
18
17
  count = provider[1]
19
18
  end
20
- #create the instances
21
- count.to_i.times do
19
+ if PARALLEL
20
+ @create += "seq #{count} | parallel -j 0 -v \""
22
21
  @create += "knife #{provider[0]}#{options['knife_options']} server create #{node[node.keys[0]][1]}"
23
22
  if run_list.length > 0
24
- @create += " -r '#{node[node.keys[0]][0].gsub(/ /,',')}'\n"
23
+ @create += " -r '#{node[node.keys[0]][0].gsub(/ /,',')}'\"\n"
24
+ end
25
+ else
26
+ count.to_i.times do
27
+ @create += "knife #{provider[0]}#{options['knife_options']} server create #{node[node.keys[0]][1]}"
28
+ if run_list.length > 0
29
+ @create += " -r '#{node[node.keys[0]][0].gsub(/ /,',')}'\n"
30
+ end
25
31
  end
26
32
  end
27
- else #multinode support
33
+ @delete += "knife node#{options['knife_options']} list | xargs knife #{provider[0]} server delete -y\n"
34
+ else #node bootstrap support
28
35
  node.keys[0].split.each do |server|
29
36
  @create += "knife bootstrap#{options['knife_options']} #{server} #{node[node.keys[0]][1]}"
30
37
  if run_list.length > 0
31
38
  @create += " -r '#{node[node.keys[0]][0].gsub(/ /,',')}'\n"
32
39
  end
40
+ @delete += "knife node#{options['knife_options']} delete #{server} -y\n"
33
41
  end
34
42
  end
35
43
  end
36
44
  end
45
+ @delete += "knife node#{options['knife_options']} bulk delete .* -y\n"
37
46
  end
38
47
 
39
48
  attr_reader :create, :delete
@@ -1,3 +1,3 @@
1
1
  module Spiceweasel
2
- VERSION = "0.8.2"
2
+ VERSION = "0.9.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spiceweasel
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.2
4
+ version: 0.9.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,12 +10,12 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2011-10-28 00:00:00.000000000 -05:00
13
+ date: 2011-11-17 00:00:00.000000000 -06:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: chef
18
- requirement: &2160839960 !ruby/object:Gem::Requirement
18
+ requirement: &2151797000 !ruby/object:Gem::Requirement
19
19
  none: false
20
20
  requirements:
21
21
  - - ! '>='
@@ -23,10 +23,10 @@ dependencies:
23
23
  version: '0'
24
24
  type: :runtime
25
25
  prerelease: false
26
- version_requirements: *2160839960
26
+ version_requirements: *2151797000
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: json
29
- requirement: &2160839480 !ruby/object:Gem::Requirement
29
+ requirement: &2151795080 !ruby/object:Gem::Requirement
30
30
  none: false
31
31
  requirements:
32
32
  - - ! '>='
@@ -34,10 +34,10 @@ dependencies:
34
34
  version: '0'
35
35
  type: :runtime
36
36
  prerelease: false
37
- version_requirements: *2160839480
37
+ version_requirements: *2151795080
38
38
  - !ruby/object:Gem::Dependency
39
39
  name: mixlib-cli
40
- requirement: &2160839000 !ruby/object:Gem::Requirement
40
+ requirement: &2151793020 !ruby/object:Gem::Requirement
41
41
  none: false
42
42
  requirements:
43
43
  - - ! '>='
@@ -45,10 +45,10 @@ dependencies:
45
45
  version: '0'
46
46
  type: :runtime
47
47
  prerelease: false
48
- version_requirements: *2160839000
48
+ version_requirements: *2151793020
49
49
  - !ruby/object:Gem::Dependency
50
50
  name: rspec
51
- requirement: &2160838480 !ruby/object:Gem::Requirement
51
+ requirement: &2151791600 !ruby/object:Gem::Requirement
52
52
  none: false
53
53
  requirements:
54
54
  - - ! '>='
@@ -56,7 +56,7 @@ dependencies:
56
56
  version: '0'
57
57
  type: :development
58
58
  prerelease: false
59
- version_requirements: *2160838480
59
+ version_requirements: *2151791600
60
60
  description: This provides a CLI for generating knife commands to build Chef-managed
61
61
  infrastructure from a simple YAML file.
62
62
  email: