cuken 0.1.12 → 0.1.13

Sign up to get free protection for your applications and to get access to all the features.
Files changed (31) hide show
  1. data/VERSION +1 -1
  2. data/cuken.gemspec +11 -9
  3. data/features/.nav +22 -15
  4. data/features/about.md +16 -5
  5. data/features/chef_examples/{zenoss → zenoss_example}/01_chef_server_setup.feature +2 -2
  6. data/features/chef_examples/{zenoss → zenoss_example}/02_monitor_vm_setup.feature +1 -1
  7. data/features/chef_examples/{zenoss → zenoss_example}/03_monitor_chef_setup.feature +2 -2
  8. data/features/chef_steps/common_steps.feature +14 -5
  9. data/features/chef_steps/cookbook_steps.feature +27 -7
  10. data/features/chef_steps/data_bag_steps.feature +18 -0
  11. data/features/chef_steps/knife_steps.feature +1 -1
  12. data/features/chef_steps/node_steps.feature +9 -8
  13. data/features/chef_steps/role_steps.feature +17 -0
  14. data/features/command_steps/command_steps.feature +1 -1
  15. data/features/file_steps/file_steps.feature +15 -2
  16. data/features/generic_steps/generic_steps.feature +6 -5
  17. data/features/ssh_steps/ssh_steps.feature +1 -1
  18. data/features/step_definitions/cuken_steps.rb +1 -1
  19. data/lib/cuken/api/chef/common.rb +32 -0
  20. data/lib/cuken/api/chef/knife.rb +0 -32
  21. data/lib/cuken/api/chef.rb +1 -2
  22. data/lib/cuken/cucumber/chef/common.rb +16 -0
  23. data/lib/cuken/cucumber/chef/cookbook.rb +4 -0
  24. data/lib/cuken/cucumber/chef/knife.rb +0 -8
  25. data/lib/cuken/cucumber/chef/role.rb +1 -9
  26. metadata +12 -10
  27. /data/features/data/repositories/chef-repo/{README.md → README.md.relish} +0 -0
  28. /data/features/data/repositories/chef-repo/certificates/{README.md → README.md.relish} +0 -0
  29. /data/features/data/repositories/chef-repo/cookbooks/{README.md → README.md.relish} +0 -0
  30. /data/features/data/repositories/chef-repo/data_bags/{README.md → README.md.relish} +0 -0
  31. /data/features/data/repositories/chef-repo/roles/{README.md → README.md.relish} +0 -0
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.12
1
+ 0.1.13
data/cuken.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{cuken}
8
- s.version = "0.1.12"
8
+ s.version = "0.1.13"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Hedgehog"]
@@ -39,13 +39,15 @@ Gem::Specification.new do |s|
39
39
  "features/chef_examples/cookbooks_repo.feature",
40
40
  "features/chef_examples/knife_admin_client.feature",
41
41
  "features/chef_examples/knife_client_create.feature",
42
- "features/chef_examples/zenoss/01_chef_server_setup.feature",
43
- "features/chef_examples/zenoss/02_monitor_vm_setup.feature",
44
- "features/chef_examples/zenoss/03_monitor_chef_setup.feature",
42
+ "features/chef_examples/zenoss_example/01_chef_server_setup.feature",
43
+ "features/chef_examples/zenoss_example/02_monitor_vm_setup.feature",
44
+ "features/chef_examples/zenoss_example/03_monitor_chef_setup.feature",
45
45
  "features/chef_steps/common_steps.feature",
46
46
  "features/chef_steps/cookbook_steps.feature",
47
+ "features/chef_steps/data_bag_steps.feature",
47
48
  "features/chef_steps/knife_steps.feature",
48
49
  "features/chef_steps/node_steps.feature",
50
+ "features/chef_steps/role_steps.feature",
49
51
  "features/command_examples/commands.feature",
50
52
  "features/command_steps/command_steps.feature",
51
53
  "features/cuken.feature",
@@ -372,13 +374,13 @@ Gem::Specification.new do |s|
372
374
  "features/data/node-load-test.rb",
373
375
  "features/data/node-simple.rb",
374
376
  "features/data/repositories/chef-repo/.gitignore",
375
- "features/data/repositories/chef-repo/README.md",
377
+ "features/data/repositories/chef-repo/README.md.relish",
376
378
  "features/data/repositories/chef-repo/Rakefile",
377
- "features/data/repositories/chef-repo/certificates/README.md",
379
+ "features/data/repositories/chef-repo/certificates/README.md.relish",
378
380
  "features/data/repositories/chef-repo/config/rake.rb",
379
- "features/data/repositories/chef-repo/cookbooks/README.md",
380
- "features/data/repositories/chef-repo/data_bags/README.md",
381
- "features/data/repositories/chef-repo/roles/README.md",
381
+ "features/data/repositories/chef-repo/cookbooks/README.md.relish",
382
+ "features/data/repositories/chef-repo/data_bags/README.md.relish",
383
+ "features/data/repositories/chef-repo/roles/README.md.relish",
382
384
  "features/data/repositories/cookbooks/attribute_include/README.rdoc",
383
385
  "features/data/repositories/cookbooks/attribute_include/attributes/a.rb",
384
386
  "features/data/repositories/cookbooks/attribute_include/attributes/b.rb",
data/features/.nav CHANGED
@@ -2,27 +2,34 @@
2
2
  - about.md (About Cuken's Reusable Steps)
3
3
  - LICENSE (License)
4
4
  - NOTICE (Notice)
5
- - generic_steps:
6
- - generic_steps.feature
7
- - file_steps:
8
- - file_steps.feature
9
- - command_steps:
10
- - command_steps.feature
11
- - ssh_steps:
12
- - ssh_steps.feature
13
5
  - chef_steps:
14
6
  - common_steps.feature
15
- - knife_steps.feature
16
7
  - cookbook_steps.feature
8
+ - knife_steps.feature
9
+ - data_bag_steps.feature
10
+ - knife_steps.feature
17
11
  - node_steps.feature
18
- - file_examples:
19
- - files.feature
20
- - command_examples:
21
- - commands.feature
22
- - ssh_examples:
23
- - ssh.feature
12
+ - role_steps.feature
13
+ - command_steps:
14
+ - command_steps.feature
15
+ - file_steps:
16
+ - file_steps.feature
17
+ - generic_steps:
18
+ - generic_steps.feature
19
+ - ssh_steps:
20
+ - ssh_steps.feature
24
21
  - chef_examples:
25
22
  - cookbooks_metadata.feature
26
23
  - cookbooks_repo.feature
27
24
  - cookbooks_cookbook.feature
25
+ - command_examples:
26
+ - commands.feature
27
+ - file_examples:
28
+ - files.feature
29
+ - ssh_examples:
30
+ - ssh.feature
31
+ - zenoss_example:
32
+ - 01_chef_server_setup.feature
33
+ - 02_monitor_vm_setup.feature
34
+ - 03_monitor_chef_setup.feature
28
35
 
data/features/about.md CHANGED
@@ -1,8 +1,7 @@
1
1
  # About Cuken's Reusable Steps
2
2
 
3
3
  These [Cucumber][0] features summarise the steps defined in
4
- [Cuken][1] and [Aruba][2]. Cuken's step+API structure is modeled on Aruba, and
5
- largely uses Aruba's steps and API.
4
+ [Cuken][1] and [Aruba][2]. Cuken's step+API structure is modeled on Aruba.
6
5
 
7
6
  Cucumber features where these steps might be useful have been variously described as:
8
7
  - Infrastructure integration tests
@@ -17,12 +16,21 @@ The Chef steps assume you have Chef server accessible on `localhost:4040`.
17
16
  If you have ideas to clarify or improve any of these cucumber features,
18
17
  please submit an [issue][9] or [pull request][8].
19
18
 
19
+ ## The Zenoss Example
20
+ This is a proof of concept rather than best practice example.
21
+ It is modeled on Matt Ray's blip.tv [screencast][17]. The intention is that you read, adjust and then run the features
22
+ in the numbered order.
23
+ Some things to adjust are the writable GitHub URI's, and the location of the Vagrant basebox.
24
+ In the final version all examples should 'just-run', until then, or until you make a pull request to change it,
25
+ it is more convenient for me.
26
+
20
27
  ## The Chef vs Vagrant/Aruba JSON Issue
21
28
  Due to several JSON gem conflicts between Chef and the Vagrant/Aruba gems, Cuken is only intended
22
29
  to work with the 0.10 series of Chef. Of course you are free to work whatever
23
30
  magic you wish for the 0.9.x releases.
24
31
 
25
32
  ## Opinons
33
+ Cuken is an 'Opinionated library':
26
34
  Virtual machines are [Vagrant][11] VM's.
27
35
  Vagrant VM's are all named.
28
36
  Configuration management and system integration is done with [Opscode's Chef][12].
@@ -72,8 +80,9 @@ outside of that ephemeral area and verifying the contents.
72
80
  ### Chef
73
81
  In most cases Chef operations refer to the remote server, e.g. 'I create the Data Bag "...". The reason we leave remote
74
82
  implicit in these steps, are:
75
- a) to keep steps descriptions succint yet informative/accurate.
76
- b) a 'local' version of this step is not accurate because local, filesystem, operations are properly done with the file
83
+
84
+ a) to keep steps descriptions succint yet informative/accurate.
85
+ b) a 'local' version of this step is not accurate because local, filesystem, operations are properly done with the file
77
86
  and directory steps and API, and are not done through Chef/Knife.
78
87
 
79
88
  Cookbooks are are checked out into the branch 'cuken'.
@@ -150,6 +159,8 @@ convinced this approach is a long term disaster, review Bundler's code base circ
150
159
  - General passwordless and interactive SSH steps (currently Vagrant VM specific)
151
160
  - Cloud launch and basic management steps, i.e. CRUD operations for Cloud VM
152
161
  - Updating packages on a VM, and repackaging the VM, essentialy CRUD too.
162
+ - Remove 'should' from steps
163
+ - Make output steps expression consistent with file/directory steps
153
164
 
154
165
  ## Prior Art:
155
166
  - [Aruba][2] confirmed the utility of reusable steps.
@@ -175,4 +186,4 @@ convinced this approach is a long term disaster, review Bundler's code base circ
175
186
  [14]: http://book.git-scm.com/4_rebasing.html
176
187
  [15]: http://book.git-scm.com/4_interactive_rebasing.html
177
188
  [16]: https://github.com/aslakhellesoy/aruba/issues/69
178
-
189
+ [17]: http://blip.tv/file/4687890
@@ -1,5 +1,5 @@
1
1
  @announce
2
- Feature: Zenoss Monitoring
2
+ Feature: 01) Chef-Server VM
3
3
  In order to launch a Zenoss server
4
4
  As a admin/developer
5
5
  I want to define the Chef admin client configuration via executable features
@@ -176,7 +176,7 @@ Feature: Zenoss Monitoring
176
176
 
177
177
  Scenario: Start the Chef server VM
178
178
  Given the Chef root directory "/tmp/chef" exists
179
- And the VM "chef" is not "running"
179
+ And the state of VM "chef" is not "running"
180
180
  And the Vagrantfile "/tmp/chef/Vagrantfile" exists
181
181
  When I launch the VM "chef"
182
182
  Then the state of VM "chef" is "running"
@@ -1,5 +1,5 @@
1
1
  @announce
2
- Feature: Zenoss Monitoring
2
+ Feature: 02) Prepare Monitor VM
3
3
  In order to launch a Zenoss server
4
4
  As a admin/developer
5
5
  I want to define the VM configuration via executable features
@@ -1,5 +1,5 @@
1
1
  @announce
2
- Feature: Zenoss Monitoring
2
+ Feature: 03) Launch Monitor VM
3
3
  In order to launch a Zenoss server
4
4
  As a admin/developer
5
5
  I want to define the Chef configuration via executable features
@@ -42,7 +42,7 @@ Feature: Zenoss Monitoring
42
42
  And a Cookbooks path "/tmp/monitor/cookbooks/"
43
43
  And a Cookbooks path "/tmp/monitor/site-cookbooks/"
44
44
  And the Knife file "/tmp/monitor/.chef/knife.rb"
45
- When I load the Cookbook Roles:
45
+ When I load the Roles:
46
46
  | site-cookbook | role |
47
47
  | zenoss | Class_Server-SSH-Linux.rb |
48
48
  | zenoss | Class_Server-SSH-Linux-MySQL.rb |
@@ -1,5 +1,5 @@
1
1
  @chef @common @step_features
2
- Feature: Listing common steps
2
+ Feature: Common steps
3
3
  In order to test automated Chef deployments.
4
4
  As an administrator.
5
5
  I want to know what generic steps are available.
@@ -10,16 +10,25 @@ Feature: Listing common steps
10
10
  Scenario: Common Chef
11
11
  Then these steps are defined for "cuken/cucumber/chef/common.rb":
12
12
  | step |
13
- |a default base Chef repository in "([^"]*)" |
14
- |I clone the remote Chef repository branch "([^"]*)" to "([^"]*)" |
15
- |the Chef server URI "([^"]*)" |
16
- |the Chef client "([^"]*)" exists |
17
13
  |the Chef admin client "([^"]*)" exists |
14
+ |the Chef client "([^"]*)" exists |
18
15
  |the Chef client private key path "([^"]*)" |
16
+ |the Chef root directory "([^"]*)" exists |
17
+ |the Chef server URI "([^"]*)" |
18
+
19
+ Scenario: Chef actions
20
+ Then these steps are defined for "cuken/cucumber/chef/common.rb":
21
+ | step |
22
+ |I create the Chef admin client "([^"]*)" |
23
+ |I create the Chef client "([^"]*)" |
24
+ |I delete the Chef admin client "([^"]*)" |
25
+ |I delete the Chef client "([^"]*)" |
19
26
 
20
27
  Scenario: Local and remote Chef repository commands
21
28
  Then these steps are defined for "cuken/cucumber/chef/common.rb":
22
29
  | step |
30
+ |a default base Chef repository in "([^"]*)" |
31
+ |I clone the remote Chef repository branch "([^"]*)" to "([^"]*)" |
23
32
  |the local Chef repository "([^"]*)" |
24
33
  |the local Chef repository exists |
25
34
  |the remote Chef repository "([^"]*)" |
@@ -1,5 +1,5 @@
1
1
  @chef @cookbook @step_features
2
- Feature: Listing Cookbook steps
2
+ Feature: Cookbook steps
3
3
  In order to test automated Chef deployments
4
4
  As an administrator
5
5
  I want to know what Cookbook steps are available
@@ -7,7 +7,7 @@ Feature: Listing Cookbook steps
7
7
  Background:
8
8
  Given that "cuken/chef" has been required
9
9
 
10
- Scenario: Common Chef
10
+ Scenario: Generic Cookbook steps
11
11
  Then these steps are defined for "cuken/cucumber/chef/cookbook.rb":
12
12
  | step |
13
13
  |a Cookbook path "([^"]*)" |
@@ -16,16 +16,36 @@ Feature: Listing Cookbook steps
16
16
  |I successfully generate Cookbook "([^"]*)" metadata |
17
17
  |the local Cookbook "([^"]*)" exists |
18
18
 
19
- Scenario: Local and remote Cookbook repository commands
19
+ Scenario: Cookbook action steps
20
20
  Then these steps are defined for "cuken/cucumber/chef/cookbook.rb":
21
21
  | step |
22
- |I clone the Cookbooks: |
23
- |I clone the Cookbook "([^"]*)" branch "([^"]*)" to "([^"]*)" |
24
22
  |I clone the remote Cookbook repository branch "([^"]*)" to "([^"]*)" |
23
+ |I clone the Cookbook "([^"]*)" branch "([^"]*)" to "([^"]*)" |
24
+ |I clone the Cookbooks: |
25
+ |I load the Cookbooks: |
26
+ |I successfully generate all Cookbook metadata |
27
+ |I successfully generate Cookbook "([^"]*)" metadata |
28
+
29
+ Scenario: Local Cookbook and repository commands
30
+ Then these steps are defined for "cuken/cucumber/chef/cookbook.rb":
31
+ | step |
25
32
  |the local Cookbook repository "([^"]*)" |
26
33
  |the local Cookbook repository exists |
34
+ |these local Cookbooks exist: |
35
+ |the local Cookbook repository "([^"]*)" |
36
+ |the local Cookbook repository exists |
37
+ |the local Cookbook "([^"]*)" exists |
38
+ |the local Site\-Cookbook "([^"]*)" exists |
39
+ |the local Site\-Cookbook repository exists |
40
+ |these local Cookbooks exist: |
41
+ |these local Cookbooks no not exist: |
42
+ |these local Site\-Cookbooks exist: |
43
+
44
+ Scenario: Remote Cookbook and repository commands
45
+ Then these steps are defined for "cuken/cucumber/chef/cookbook.rb":
46
+ | step |
27
47
  |the remote Cookbook repository "([^"]*)" |
28
48
  |the remote Cookbooks URI "([^"]*)" |
29
- |these local Cookbooks exist: |
30
- |these local Site-Cookbooks exist: |
49
+ |these remote Cookbooks exist: |
50
+ |these remote Cookbooks do not exist: |
31
51
 
@@ -0,0 +1,18 @@
1
+ @chef @data_bag @step_features
2
+ Feature: Data Bag steps
3
+ In order to test automated Chef deployments
4
+ As an administrator
5
+ I want to know what Data Bag steps are available
6
+
7
+ Background:
8
+ Given that "cuken/chef" has been required
9
+
10
+ Scenario: Common Data Bag steps
11
+ Then these steps are defined for "cuken/cucumber/chef/data_bag.rb":
12
+ | step |
13
+ |I add these Cookbook Data Bag items: |
14
+ |I create the Data Bag "([^"]*)" |
15
+ |these Data Bags exist: |
16
+ |these Data Bags do not exist: |
17
+ |these Data Bags contain: |
18
+ |these Data Bags do not contain: |
@@ -1,5 +1,5 @@
1
1
  @chef @knife @step_features
2
- Feature: Listing Knife steps
2
+ Feature: Knife steps
3
3
  In order to test automated Chef deployments
4
4
  As an administrator
5
5
  I want to know what Knife steps are available
@@ -1,15 +1,16 @@
1
- @chef @cookbook @step_features
2
- Feature: Listing Node steps
1
+ @chef @node @step_features
2
+ Feature: Node steps
3
3
  In order to test automated Chef deployments
4
4
  As an administrator
5
- I want to know what Cookbook steps are available
5
+ I want to know what Node steps are available
6
6
 
7
7
  Background:
8
8
  Given that "cuken/chef" has been required
9
9
 
10
- Scenario: Common Node
10
+ Scenario: Common Node steps
11
11
  Then these steps are defined for "cuken/cucumber/chef/node.rb":
12
- | step |
13
- | a validated Node |
14
- | the Node "([^"]*)" exists |
15
- | the Nodes are: |
12
+ | step |
13
+ |a validated Node |
14
+ |I add these Roles to the Nodes: |
15
+ |the Node "([^"]*)" exists |
16
+ |the Nodes are: |
@@ -0,0 +1,17 @@
1
+ @chef @role @step_features
2
+ Feature: Role steps
3
+ In order to test automated Chef deployments
4
+ As an administrator
5
+ I want to know what Role steps are available
6
+
7
+ Background:
8
+ Given that "cuken/chef" has been required
9
+
10
+ Scenario: Common Role steps
11
+ Then these steps are defined for "cuken/cucumber/chef/role.rb":
12
+ | step |
13
+ |I load the Roles: |
14
+ |these Roles exist: |
15
+ |these Roles do not exist: |
16
+ |the Roles are: |
17
+
@@ -1,5 +1,5 @@
1
1
  @step_features
2
- Feature: Listing command steps
2
+ Feature: Command steps
3
3
  In order to test a running system
4
4
  As an administrator
5
5
  I want to know what command steps are available
@@ -1,5 +1,5 @@
1
1
  @step_features
2
- Feature: Listing file steps
2
+ Feature: File and Directory steps
3
3
  In order to test a running system
4
4
  As an administrator
5
5
  I want to know what files steps are available
@@ -38,7 +38,7 @@ Feature: Listing file steps
38
38
  |the (.)time of "([^"]*)" changes |
39
39
  |we record the a-mtime of "([^"]*)" |
40
40
 
41
- Scenario: File and directory content
41
+ Scenario: File content
42
42
  Then these steps are defined for "cuken/cucumber/file.rb":
43
43
  | step |
44
44
  |the file "([^"]*)" contains: |
@@ -56,3 +56,16 @@ Feature: Listing file steps
56
56
  |I overwrite "([^"]*)": |
57
57
  |I append to "([^"]*)": |
58
58
 
59
+ Scenario: File placement
60
+ Then these steps are defined for "cuken/cucumber/file.rb":
61
+ | step |
62
+ |I place "([^"]*)" in "([^"]*)" |
63
+ |I place all in "([^"]*)" in "([^"]*)" |
64
+ |the placed directory "([^"]*)" exists |
65
+ |the placed directory "([^"]*)" does not exist |
66
+ |the placed file "([^"]*)" contains: |
67
+ |the placed file "([^"]*)" contains "([^"]*)" |
68
+ |the placed file "([^"]*)" exists |
69
+ |the placed file "([^"]*)" does not exist |
70
+
71
+
@@ -1,13 +1,14 @@
1
1
  @step_features
2
- Feature: Listing common steps
2
+ Feature: Generic steps
3
3
  In order to test a running system
4
4
  As an administrator
5
5
  I want to know what common steps are available
6
6
 
7
7
  Background:
8
- Given that "cuken/common" has been required
8
+ Given that "cuken/common" has been required
9
9
 
10
10
  Scenario: Common execution
11
- Then these steps are defined for "cuken/cucumber/common.rb":
12
- | step |
13
- |wait "([^"]*)" seconds |
11
+ Then these steps are defined for "cuken/cucumber/common.rb":
12
+ | step |
13
+ |wait "([^"]*)" seconds |
14
+ |I'm using a clean gemset "([^"]*)" |
@@ -1,5 +1,5 @@
1
1
  @step_features
2
- Feature: Listing SSH steps
2
+ Feature: SSH steps
3
3
  In order to test a running system
4
4
  As an administrator
5
5
  I want to know what SSH steps are available
@@ -26,7 +26,7 @@ Then /^these steps are defined for "([^\"]*)":$/ do |file, table|
26
26
  rsc = ::Cucumber::Runtime::SupportCode.new 'ui', :autoload_code_paths => 'lib/cuken/cucumber'
27
27
  rsc.load_files! ["lib/#{file}", "#{ENV['GEM_HOME']}/gems/aruba-0.3.6/lib/aruba/cucumber.rb"]
28
28
  sd_array = rsc.step_definitions
29
- #sd_array.each{|sd| puts sd.regexp_source}
29
+ # sd_array.each{|sd| puts sd.regexp_source}
30
30
  table.hashes.each do |hsh|
31
31
  sd_array.each{|sd| res = sd.regexp_source == %Q{/^#{hsh['step']}$/}; break('found') if res}.should == 'found'
32
32
  end
@@ -68,6 +68,7 @@ module ::Cuken
68
68
  'knife '
69
69
  end
70
70
 
71
+ # TODO: Once a method is spec'd refactor to use this and knife_config_file_error_handling
71
72
  def run_knife(argv=[])
72
73
  argv << '--config' << chef.knife_config_file.to_s
73
74
  with_args *argv do
@@ -136,6 +137,37 @@ module ::Cuken
136
137
  check_placed_directory_presence([chef.root_dir], expect_presence)
137
138
  end
138
139
 
140
+ def create_client(client_name, admin = false)
141
+ chef.client_private_key_path = chef.root_dir + "/.chef/#{client_name}.pem"
142
+ data = {:name => client_name,
143
+ :file => chef.client_private_key_path,
144
+ :no_editor => true,
145
+ :config_file => chef.knife_config_file}
146
+ argv = ['client', 'create', data[:name], '--file', data[:file], '--config', data[:config_file],'--no-editor']
147
+ argv << '--admin' if admin
148
+ unless Pathname(chef.client_private_key_path).exist?
149
+ with_args *argv do
150
+ ::Chef::Application::Knife.new.run
151
+ end
152
+ else
153
+ #TODO: Verify client exists on the Chef server, and has matching public key.
154
+ end
155
+ end
156
+
157
+ def delete_client(client_name)
158
+ chef.client_private_key_path = chef.root_dir + "/.chef/#{client_name}.pem"
159
+ data = {:name => client_name,
160
+ :file => chef.client_private_key_path,
161
+ :no_editor => true,
162
+ :yes => true,
163
+ :print_after => true,
164
+ :config_file => chef.knife_config_file}
165
+ argv = ['client', 'delete', data[:name], '--no-editor', '--yes' ]
166
+ with_args *argv do
167
+ ::Chef::Application::Knife.new.run
168
+ end
169
+ end
170
+
139
171
  end
140
172
  end
141
173
  end
@@ -72,44 +72,12 @@ module ::Cuken
72
72
  CliTemplate.option(:yes, :long => "--yes", :boolean => true, :default => true)
73
73
  end
74
74
 
75
- def create_client(client_name)
76
- chef.client_private_key_path = chef.root_dir + "/.chef/#{client_name}.pem"
77
- data = {:name => client_name,
78
- :admin => true,
79
- :file => chef.client_private_key_path,
80
- :no_editor => true,
81
- :config_file => chef.knife_config_file}
82
- argv = ['client', 'create', data[:name], '--file', data[:file], '--config', data[:config_file],'--no-editor']
83
- argv << '--admin' if data[:admin]
84
- unless Pathname(chef.client_private_key_path).exist?
85
- with_args *argv do
86
- ::Chef::Application::Knife.new.run # (args, CliTemplate.options)
87
- end
88
- else
89
- #TODO: Verify client exists on the Chef server, and has matching public key.
90
- end
91
- end
92
-
93
75
  def show_client(client_name)
94
76
  chef.client_private_key_path = chef.root_dir + "/.chef/#{client_name}.pem"
95
77
  data = {:name => client_name,
96
78
  :config_file => chef.knife_config_file}
97
79
  argv = ['client', 'show', data[:name], '--config', data[:config_file],'--no-editor']
98
80
  argv << '--admin' if data[:admin]
99
- with_args *argv do
100
- ::Chef::Application::Knife.new.run # (args, CliTemplate.options)
101
- end
102
- end
103
-
104
- def delete_client(client_name)
105
- chef.client_private_key_path = chef.root_dir + "/.chef/#{client_name}.pem"
106
- data = {:name => client_name,
107
- :file => chef.client_private_key_path,
108
- :no_editor => true,
109
- :yes => true,
110
- :print_after => true,
111
- :config_file => chef.knife_config_file}
112
- argv = ['client', 'delete', data[:name], '--no-editor', '--yes' ]
113
81
  with_args *argv do
114
82
  ::Chef::Application::Knife.new.run
115
83
  end
@@ -68,7 +68,6 @@ module ::Cuken
68
68
  if repo = res[/ERROR: (.*) doesn't exist. Did you enter it correctly?/,1]
69
69
  raise RuntimeError, "ERROR: #{repo} doesn't exist. Did you enter it correctly? #{repo}", caller
70
70
  end
71
-
72
71
  end
73
72
 
74
73
  def chef_clone_repo(ckbk_path, cookbook = false, repo = chef.remote_chef_repo, type = {'branch' => 'master'})
@@ -121,7 +120,7 @@ module ::Cuken
121
120
  end
122
121
  cmd += " -c #{chef.knife_config_file.expand_path.to_s}" if chef.knife_config_file.expand_path.exist?
123
122
  cmd += " -o #{ckbk_pth}" if ckbk_pth_opt
124
- cmd += " --log_level debug" if chef.knife_debug
123
+ # cmd += " --log_level debug" if chef.knife_debug
125
124
  chef.root_dir ||= current_dir
126
125
  in_chef_root do
127
126
  if interactive
@@ -24,6 +24,22 @@ Given /^the Chef server URI "([^"]*)"$/ do |uri|
24
24
  chef.uri = uri
25
25
  end
26
26
 
27
+ When /^I create the Chef admin client "([^"]*)"$/ do |client_name|
28
+ create_client(client_name, true)
29
+ end
30
+
31
+ When /^I create the Chef client "([^"]*)"$/ do |client_name|
32
+ create_client(client_name)
33
+ end
34
+
35
+ When /^I delete the Chef admin client "([^"]*)"$/ do |client_name|
36
+ delete_client(client_name)
37
+ end
38
+
39
+ When /^I delete the Chef client "([^"]*)"$/ do |client_name|
40
+ delete_client(client_name)
41
+ end
42
+
27
43
  Given /^the Chef client "([^"]*)" exists$/ do |name|
28
44
  chef.client_name = name
29
45
  end
@@ -106,6 +106,10 @@ And /^these local Cookbooks exist:$/ do |table|
106
106
  check_cookbook_table_presence(table)
107
107
  end
108
108
 
109
+ And /^these local Cookbooks do not exist:$/ do |table|
110
+ check_cookbook_table_presence(table, false)
111
+ end
112
+
109
113
  And /^these local Site\-Cookbooks exist:$/ do |table|
110
114
  # table is a Cucumber::Ast::Table
111
115
  ckbk_path = 'site-cookbook'
@@ -27,14 +27,6 @@ Given /^the Knife file "([^"]*)"$/ do |path|
27
27
  end
28
28
  end
29
29
 
30
- When /^I delete the Chef admin client "([^"]*)"$/ do |client_name|
31
- delete_client(client_name)
32
- end
33
-
34
- When /^I create the Chef admin client "([^"]*)"$/ do |client_name|
35
- create_client(client_name)
36
- end
37
-
38
30
  When /^I successfully run Knife's "([^"]*)"$/ do |cmd|
39
31
  run_knife_command(cmd, false)
40
32
  end
@@ -16,7 +16,7 @@
16
16
  #
17
17
  World(::Cuken::Api::Chef::Role)
18
18
 
19
- When /^I load the Cookbook Roles:$/ do |table|
19
+ When /^I load the Roles:$/ do |table|
20
20
  load_role_table(table)
21
21
  end
22
22
 
@@ -35,10 +35,6 @@ end
35
35
  ###
36
36
  # When
37
37
  ###
38
- #When /^I load the Cookbook Roles:$/ do |table|
39
- # # table is a Cucumber::Ast::Table
40
- # pending # express the regexp above with the code you wish you had
41
- #end
42
38
 
43
39
  ###
44
40
  # Then
@@ -48,7 +44,3 @@ Then /^the Roles are:$/ do |partial_output|
48
44
  all_stdout.should include(partial_output)
49
45
  end
50
46
 
51
- #Then /^these Roles exist:$/ do |table|
52
- # run_knife_command('role list')
53
- # pending # express the regexp above with the code you wish you had
54
- #end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: cuken
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.1.12
5
+ version: 0.1.13
6
6
  platform: ruby
7
7
  authors:
8
8
  - Hedgehog
@@ -231,13 +231,15 @@ files:
231
231
  - features/chef_examples/cookbooks_repo.feature
232
232
  - features/chef_examples/knife_admin_client.feature
233
233
  - features/chef_examples/knife_client_create.feature
234
- - features/chef_examples/zenoss/01_chef_server_setup.feature
235
- - features/chef_examples/zenoss/02_monitor_vm_setup.feature
236
- - features/chef_examples/zenoss/03_monitor_chef_setup.feature
234
+ - features/chef_examples/zenoss_example/01_chef_server_setup.feature
235
+ - features/chef_examples/zenoss_example/02_monitor_vm_setup.feature
236
+ - features/chef_examples/zenoss_example/03_monitor_chef_setup.feature
237
237
  - features/chef_steps/common_steps.feature
238
238
  - features/chef_steps/cookbook_steps.feature
239
+ - features/chef_steps/data_bag_steps.feature
239
240
  - features/chef_steps/knife_steps.feature
240
241
  - features/chef_steps/node_steps.feature
242
+ - features/chef_steps/role_steps.feature
241
243
  - features/command_examples/commands.feature
242
244
  - features/command_steps/command_steps.feature
243
245
  - features/cuken.feature
@@ -564,13 +566,13 @@ files:
564
566
  - features/data/node-load-test.rb
565
567
  - features/data/node-simple.rb
566
568
  - features/data/repositories/chef-repo/.gitignore
567
- - features/data/repositories/chef-repo/README.md
569
+ - features/data/repositories/chef-repo/README.md.relish
568
570
  - features/data/repositories/chef-repo/Rakefile
569
- - features/data/repositories/chef-repo/certificates/README.md
571
+ - features/data/repositories/chef-repo/certificates/README.md.relish
570
572
  - features/data/repositories/chef-repo/config/rake.rb
571
- - features/data/repositories/chef-repo/cookbooks/README.md
572
- - features/data/repositories/chef-repo/data_bags/README.md
573
- - features/data/repositories/chef-repo/roles/README.md
573
+ - features/data/repositories/chef-repo/cookbooks/README.md.relish
574
+ - features/data/repositories/chef-repo/data_bags/README.md.relish
575
+ - features/data/repositories/chef-repo/roles/README.md.relish
574
576
  - features/data/repositories/cookbooks/attribute_include/README.rdoc
575
577
  - features/data/repositories/cookbooks/attribute_include/attributes/a.rb
576
578
  - features/data/repositories/cookbooks/attribute_include/attributes/b.rb
@@ -670,7 +672,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
670
672
  requirements:
671
673
  - - ">="
672
674
  - !ruby/object:Gem::Version
673
- hash: 782328980720716796
675
+ hash: -4455492689956118476
674
676
  segments:
675
677
  - 0
676
678
  version: "0"