cucumber-chef 2.0.1.pre → 2.0.2.pre

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -2,726 +2,7 @@
2
2
 
3
3
  Cucumber-chef is a library of tools to enable the emerging discipline of infrastructure as code to practice test driven development. It provides a testing platform within which Cucumber tests can be run which provision virtual machines, configure them by applying the appropriate Chef roles to them, and then run acceptance and integration tests against the environment.
4
4
 
5
- ## Overview
6
-
7
- Cucumber-chef begins with a very simple premise. If we are framing our infrastructure as code - if we're writing cookbooks, recipes and other pieces of automation in a high level programming language, such as Ruby, then it makes sense to follow the current wisdom across the software development world to maximise the quality, maintainability and reusability of our code, providing maximum chance that we'll deliver value with it. One area which has been shown to have a very positive effect is the practive of 'test-driven' development. In this paradigm, the developer begins by writing a test that captures the intended behaviour of the code they are going to write. This test will start out by failing. The developer then writes code to make the test pass, and iterates thereafter.
8
-
9
- Cucumber-chef provides a framework to make it easier to do test-driven development for infrastructure. It does this by providing a test infrastructure, which we call the "test lab", within which a number of different scenarios can be set up, and against which Cucumber features can we run. From the outset, Cucumber-chef's design was to provide a fast, lightweight and cheap way to fire up virtual machines for testing. At present this is achieved using Linux Containers on Amazon EC2. Supporting alternative provisioning backends is planned, which will allow the user to opt to test using local machines, alternative cloud providers, and ultimatey alternative virtualization technologies.
10
-
11
- For node convergence, Cucumber-Chef uses the open-source Chef server. It can be configured to use Hosted Chef or Private Chef. Supoprt for Chef-solo will be included in a future relase.
12
-
13
- As you might have guessed from the name, we're going to write high level acceptance tests using Cucumber. Cucumber-Chef provides step definitions and helper methods to make it easy to provision and manage machines with Chef, and then build end-to-end tests.
14
-
15
- ## Getting Started
16
-
17
- *LISTEN UP*
18
-
19
- Here's the headline:
20
-
21
- With a /single command/ Cucumber-Chef will provision a machine, set up an open source Chef server, bootstrap it to support the creation of Linux containers, set up an environment from which to run tests, and automatically configure your system to use it.
22
-
23
- This means getting started with Cucumber-Chef is a simple, two step process.
24
-
25
- 1. Install Cucumber-Chef
26
-
27
- 2. Run `cucumber-chef init` to configure Cucumber-Chef.
28
-
29
- 3. Run `cucumber-chef setup` to build your test lab.
30
-
31
- ### Installing Cucumber-Chef
32
-
33
- Cucumber-Chef is distributed as a RubyGem. To install it you have two options - stable or development.
34
-
35
- #### Installing the stable version
36
-
37
- Simply install from RubyGems:
38
-
39
- $ gem install cucumber-chef
40
-
41
- Depending on your local setup (ie whether you're using RVM or rbenv, or distribution-provided Ruby), you may need to run this with superuser privileges.
42
-
43
- #### Installing the development version
44
-
45
- If you want to try a development version, simply clone this repo, and build the gem yourself:
46
-
47
- $ git clone git://github.com/Atalanta/cucumber-chef -b BRANCH
48
- $ cd cucumber-chef
49
- $ bundle
50
- $ rake build
51
- $ gem install pkg/cucumber-chef-VERSION.gem
52
-
53
- Again, depending on your local setup (ie whether you're using RVM or rbenv, or distribution-provided Ruby), you may need to run parts of this process with superuser privileges.
54
-
55
- ### Running `cucumber-chef init`
56
-
57
- Cucumber-Chef ships with an initialization task, which will interactively generate configuration file. This requires you to have, and know your Amazon Web Services credntials. On completion of the interactive configuration, it will provision a machine on EC2, and set up the entire infrastructure, using Chef.
58
-
59
- Cucumber-Chef doesn't demand where you keep your configuration file. By default, the config will be created in `~/.cucumber-chef`, but this can be overridden. Cucumber-Chef is clever enough to find your config, so it's all cool.
60
-
61
- The two obvious places to keep this config, are in the top level of your Chef repository, or in a dedicated Cucumber-Chef repository, but you're free to do whatever works for you.
62
-
63
- You can view and verify the current config at any time by running `cucumber-chef displayconfig`. If Cucumber-Chef thinks your config is incorrect, or incomplete, it'll tell you.
64
-
65
- ## Using Cucumber-Chef
66
-
67
- Once installed, you can run `cucumber-chef` on the command line to get an overview of the tasks it can carry out.
68
-
69
- $ cucumber-chef
70
- Tasks:
71
- cucumber-chef create <project> # Create a project template for testing an infrastructure.
72
- cucumber-chef diagnose <container> # Provide diagnostics from the chef-client on the specified container.
73
- cucumber-chef displayconfig # Display the current cucumber-chef config.
74
- cucumber-chef down # Shutdown the cucumber-chef test lab
75
- cucumber-chef help [TASK] # Describe available tasks or one specific task
76
- cucumber-chef info # Display information about the current test lab.
77
- cucumber-chef init # Initalize cucumber-chef configuration
78
- cucumber-chef ps [ps-options] # Snapshot of the current cucumber-chef test lab container processes.
79
- cucumber-chef setup # Setup cucumber-chef test lab in Amazon EC2
80
- cucumber-chef ssh [container] # SSH to cucumber-chef test lab or [container] if specified.
81
- cucumber-chef teardown # Teardown cucumber-chef test lab in Amazon EC2
82
- cucumber-chef test [cucumber-options] # Test a project using the cucumber-chef test suite.
83
- cucumber-chef up # Startup the cucumber-chef test lab
84
-
85
- After tunning set up, which takes about 15 minutes, you'll have a fully funtioning platform available for you to use. Let's just quickly review what that means. You will have an EC2 machine, fully managed by Chef, and providing the following:
86
-
87
- * The ability to provision LXC containers
88
- * The ability to run tests against LXC containers
89
- * A dedicated environment for certain kinds of testing scenarios
90
-
91
- The next stage is to set up a project. A project is simply a directory structure for containing your cucumber features and steps, already set up with an appropriate environment to make use of the step definitions provided with Cucumber-Chef. Cucumber-chef provides a task which will create a the directory for you, and populate it with a README and an example feature and steps. These represent futher documentation, and provide a model and steps to get you up and running with your testing as quickly as possible.
92
-
93
- $ cd /path/to/chef-repo
94
- $ cucumber-chef create myproject
95
-
96
- This will create a directory, cucumber-chef, and a subdirectory, `myproject`.
97
-
98
- └── myproject
99
- ├── README
100
- └── features
101
- ├── myproject.feature
102
- ├── step_definitions
103
- │   └── myproject_steps.rb
104
- └── support
105
- └── env.rb
106
-
107
- ### General Tasks
108
-
109
- #### `up`
110
-
111
- If you are using an EBS volume, you can start and stop your test lab. This task will attempt to start your Cucumber-Chef test lab if it is currently stopped.
112
-
113
- #### `down`
114
-
115
- If you are using an EBS volume, you can start and stop your test lab. This task will attempt to stop your Cucumber-Chef test lab if it is currently running.
116
-
117
- ## Writing Tests
118
-
119
- Once you've got your test lab set up, and you've generated a project, it's time to crack on with writing a test. The basic idea is this:
120
-
121
- 1. An infrastructure requirement is established
122
- 2. Write a cucumber feature that expresses the required behaviour of the infrastructure requirement
123
- 3. Write steps that will build this infrastructure environment on the test lab, using the step definitions provided - these include the ability to create a container, apply roles to it, and destroy it again.
124
- 4. Write cookbooks and recipes and supporting code to make the test pass
125
-
126
- ### Container Details
127
-
128
- All containers operate off a bridged interface on the test-lab. All outbound, non-local traffic from the LXC containers are NAT'd through the test-lab and off to the outside world. This bridged interface on the test-lab is configured as follows:
129
-
130
- CIDR: 192.168.0.0/16
131
- IP Address: 192.168.255.254
132
- Netmask: 255.255.255.0
133
- Broadcast: 192.168.255.255
134
-
135
- You are free to use any IP in this /24, with the exception of the test-lab itself, which is at `192.168.255.254`.
136
-
137
- ### Built In Test Steps
138
-
139
- #### Provisioning
140
-
141
- We provide several built in steps to help you with provisioning. It is suggested you build a `Background` section for your features so these are not repeated with each scenario. This example `Background` section does the following:
142
-
143
- * Sets up a server called `devopserver`.
144
- * Makes the server persistant (it will remain up after the test finishes, which is the default behaviour).
145
- * Assigns what linux distro and release to use for the container.
146
- * Assigns it an IP address on the test lab network (this can be omitted for an auto-assigned IP).
147
- * Tells Cucumber-Chef to provision the server.
148
- * Adds the `chef-client::service` recipe in to the chef-client's run list.
149
- * Executes `chef-client` with the generated run list.
150
- * Starts an SSH session to the server so you can execute commands and test the output of those commands in the scenarios.
151
-
152
- Here is the `Background` section as you might write it in a feature:
153
-
154
- Background:
155
- * I have a server called "devopserver"
156
- * "devopserver" should be persistant
157
- * "devopserver" is running "ubuntu" "lucid"
158
- * "devopserver" has an IP address of "192.168.73.31"
159
- * "devopserver" has been provisioned
160
- * the "chef-client::service" recipe has been added to the "devopserver" run list
161
- * the chef-client has been run on "devopserver"
162
- * I ssh to "devopserver" with the following credentials:
163
- | username | password |
164
- | root | root |
165
-
166
- To get a persistent server with an auto-assigned IP address using the generated and populated test lab SSH key pairs for SSH authentication you could write something like this. Remember the tests run on the test lab, so we can just back out a directory and reference our test lab SSH private key directly:
167
-
168
- Background:
169
- * I have a server called "devopserver"
170
- * "devopserver" is running "ubuntu" "lucid"
171
- * "devopserver" has been provisioned
172
- * the "chef-client::service" recipe has been added to the "devopserver" run list
173
- * the chef-client has been run on "devopserver"
174
- * I ssh to "devopserver" with the following credentials:
175
- | username | keyfile |
176
- | root | ../.ssh/id_rsa |
177
-
178
- You can add roles to the run list by writing:
179
-
180
- * the "chef-client" role has been added to the "devopserver" run list
181
-
182
- Here's an example `Scenario` section you might have to test if the chef-client is actually running as a daemon:
183
-
184
- Scenario: Chef-Client is running as a daemon
185
- When I run "ps aux | grep [c]hef-client"
186
- Then I should see "chef-client" in the output
187
- And I should see "-d" in the output
188
- And I should see "-i 1800" in the output
189
- And I should see "-s 20" in the output
190
-
191
- See the section below label *Example Test Run* for more examples.
192
-
193
- ##### List of Provisioning Steps
194
-
195
- Create a server profile:
196
-
197
- I have a server called "(server)"
198
-
199
- Set a (server) to persist or not:
200
-
201
- "(server)" should( not) be persistant
202
-
203
- Set (server) to run linux of type (distro), using (release).
204
-
205
- "(server)" is running "(distro)" "(release)"
206
-
207
- Supported (distro -> releases):
208
-
209
- ubuntu -> lucid, maverick, natty, oneiric, precise
210
- fedora -> (release number)
211
-
212
- Fedora releases 12, 13, 14 tested OK.
213
-
214
- Assign (server) a specific IP address (must be on the test lab network segment):
215
-
216
- "(server)" has an IP address of "(ip)"
217
-
218
- Assign (server) a specific MAC address:
219
-
220
- "(server)" has a MAC address of "(mac)"
221
-
222
- Initiate the provision of a (server). All attributes of the server need to be set before this:
223
-
224
- "(server)" has been provisioned
225
-
226
- Add a role to the chef-client run list:
227
-
228
- the "(role)" role has been added to the "(server)" run list
229
-
230
- Add a recipe to the chef-client run list:
231
-
232
- the "(recipe)" recipe has been added to the "(server)" run list
233
-
234
- Run the chef-client:
235
-
236
- the chef-client has been run on "(server)"
237
-
238
- #### Chef Steps
239
-
240
- To prep a server with a role and data bag:
241
-
242
- * the following roles have been updated:
243
- | role | role_path |
244
- | users | ./support/roles/ |
245
- * the "users" role has been added to the "users" run list
246
- * the following databags have been updated:
247
- | databag | databag_path |
248
- | users | ./support/data_bags/users |
249
-
250
- ##### List of Chef Steps
251
-
252
- Update/push roles to the chef-server:
253
-
254
- * the following roles have been updated:
255
- | role | role_path |
256
- | users | ./support/roles/ |
257
-
258
- Update/push data bags to the chef-server:
259
-
260
- * the following databags have been updated:
261
- | databag | databag_path |
262
- | users | ./support/data_bags/users |
263
-
264
- #### SSH Steps
265
-
266
- Here is how you might setup and initate an SSH session using password authentication to a server named `devopserver`:
267
-
268
- * I have no public keys set
269
- * I ssh to "devopserver" with the following credentials:
270
- | username | password |
271
- | root | root |
272
-
273
- Here is how you might setup and initate an SSH session using public key authentication to a server named `users`:
274
-
275
- * I ssh to "users" with the following credentials:
276
- | username | keyfile |
277
- | root | ../.ssh/id_rsa |
278
-
279
- Since the cukes run on the test lab, we can directly reference the public key pairs already there and populated for us.
280
-
281
- Suppose we have a cookbook that creates new users. After it runs we should be able to SSH in with our public keys. Let's test this. First we'll do our setup in the `Background`:
282
-
283
- Background:
284
- * I have a server called "users"
285
- * "users" is running "ubuntu" "lucid"
286
- * "users" has been provisioned
287
- * the following roles have been updated:
288
- | role | role_path |
289
- | users | ./support/roles/ |
290
- * the "users" role has been added to the "users" run list
291
- * the following databags have been updated:
292
- | databag | databag_path |
293
- | users | ./support/data_bags/users |
294
- * the chef-client has been run on "users"
295
-
296
- And now for the `Scenario`:
297
-
298
- Scenario: The user can ssh in to the system with their key pair
299
- * I ssh to "users" with the following credentials:
300
- | username | keyfile |
301
- | bdobbs | ./support/keys/bdobbs |
302
- When I run "hostname"
303
- Then I should see "users" in the output
304
-
305
-
306
- ##### List of SSH Steps
307
-
308
- Sets the authentication method to password:
309
-
310
- I have no public keys set
311
-
312
- Start an SSH session to the server (server) using password authentication:
313
-
314
- I ssh to "(server)" with the following credentials:
315
- | username | password |
316
- | root | root |
317
-
318
- Start an SSH session to the server (server) using public key authentication:
319
-
320
- I ssh to "(server)" with the following credentials:
321
- | username | keyfile |
322
- | root | id_rsa |
323
-
324
- Executes (command) over the previously established SSH session on the server (server):
325
-
326
- I run "(command)"
327
-
328
- Check (command) output for an (expected) or (not-expected) string:
329
-
330
- I should( not) see "(expected)" in the output
331
-
332
- Check (command) output for existance of or lack of (server) settings:
333
-
334
- I should( not) see the "(ip|mac)" of "(server)" in the output
335
-
336
- #### Minitest
337
-
338
- ##### List of Minitest Steps
339
-
340
- I enable the running of MiniTest suites for "(server)"
341
-
342
- the tests should run and pass on "(server)"
343
-
344
- #### Cucumber Before Hook Centric Helpers
345
-
346
- * `chef_set_client_config(config={})`
347
-
348
- This method configures the chef-client's `client.rb` file. Currently you can specify `:orgname`, `:log_level`, `:log_location`, `:chef_server_url` and `:validation_client_name`. See your `env.rb` file if you need to change this to point it at a Hosted Chef Server or need to modify any of these values.
349
-
350
- ##### Examples
351
-
352
- # for Opscode Hosted chef-server use this:
353
- #chef_set_client_config(:orgname => "cucumber-chef")
354
-
355
- # for Opscode OS chef-server on the Cucumber-Chef test lab use this:
356
- chef_set_client_config(:chef_server_url => "http://192.168.255.254:4000",
357
- :validation_client_name => "chef-validator")
358
-
359
- ## Running Tests
360
-
361
- You can write the tests and Chef code wherever you like. We're assuming you prefer working on your local machine, and checking into version control. But we don't really care. When it's time to run tests, Cucumber-Chef provides a task which handles this:
362
-
363
- $ cucumber-chef test
364
-
365
- Containers are now persisted by default. This means faster run times on average but if things get screwy, or you want to test from a clean slate, you can easily reset your containers. If you pass in either `-z` or `--destroy` all containers will be wiped before the test run starts.
366
-
367
- $ cucumber-chef help test
368
- Usage:
369
- cucumber-chef test [cucumber-options]
370
-
371
- Options:
372
- -z, [--destroy] # destroy all containers before test run
373
-
374
- Test a project using the cucumber-chef test suite.
375
-
376
- You can now pass in options for cucumber or even setup profiles via `cucumber.yml`. Any command-line options specified after the project name will be passed on to cucumber. For example:
377
-
378
- $ cucumber-chef test --tags @wip -c -v -b
379
-
380
- To take advantage of cucumber profiles, create a `cucumber.yml` configuration file in the root of your chef-repo; just as you would with any other project using cucumber. In this file you can take full advantage of the Cucumber profiles as definied on their wiki, https://github.com/cucumber/cucumber/wiki/cucumber.yml.
381
-
382
- Here is an example default project for `cucumber.yml` which turns on colored output, verbosity and full backtraces for all test runs:
383
-
384
- ---
385
- default: -c -v -b
386
-
387
- Running the test task will upload your current project to the test lab, and run the tests, reporting the results back to the screen. Cucumber-chef also provides an upload task, so you can push the current project to the test lab, and then connect to test lab yourself to run tests in a more granular way. To do this, you need to know the IP of the test lab. You can find this out by running:
388
-
389
- $ cucumber-chef info
390
-
391
- At present, Cucumber-Chef only allows one test lab per AWS account. In practice, this has not been a constraint. LXC is incredibly lightweight, and a large number of containers can be provisioned on even a small EC2 instance.
392
-
393
- ### When Things Go Oh So Wrong
394
-
395
- We have put in a few tasks to help you diagnose any issues you may come across with the test lab, containers or your cookbooks and recipes. There are two main tasks available to help you with this: `ssh` and `diagnose`.
396
-
397
- #### `ssh`
398
-
399
- $ cucumber-chef help ssh
400
- Usage:
401
- cucumber-chef ssh [container]
402
-
403
- Options:
404
- [--test] # INTERNAL USE ONLY
405
-
406
- SSH to cucumber-chef test lab or [container] if specified.
407
-
408
- This command provides you with a rapid way to connect to either your test lab or containers. Think `vagrant ssh`; we took a queue from their wonderful gem and realized we want our gem to provide the same sort of functionality. The main difference between our `ssh` task and the way Vagrant's task works is that we generate a fresh ssh key pair whenever a test lab is setup; so you can rest assured no one else has a copy of the credientials. You also do not have to worry about generating or specifying your own key pair to override a default key pair as is the case with Vagrant if you do not want to use the one shipped with Vagrant.
409
-
410
- $ cucumber-chef ssh
411
- Attempting SSH connection to cucumber-chef 'test lab'...
412
- _____ _ _____ _ __
413
- / ____| | | / ____| | / _|
414
- | | _ _ ___ _ _ _ __ ___ | |__ ___ _ __| | | |__ ___| |_
415
- | | | | | |/ __| | | | '_ ` _ \| '_ \ / _ \ '__| | | '_ \ / _ \ _|
416
- | |___| |_| | (__| |_| | | | | | | |_) | __/ | | |____| | | | __/ |
417
- \_____\__,_|\___|\__,_|_| |_| |_|_.__/ \___|_| \_____|_| |_|\___|_|
418
-
419
-
420
- Welcome to the Cucumber Chef Test Lab v2.0.0.rc1
421
-
422
- Last login: Mon Jun 4 07:56:40 2012 from [REDACTED]
423
- ubuntu@cucumber-chef:~$
424
-
425
- Keep in mind with Amazon's EC2 the base `ubuntu` user is already in the sudoers file; so you can `sudo su -` without needing the password.
426
-
427
- ubuntu@cucumber-chef:~$ sudo su -
428
- root@cucumber-chef:~#
429
-
430
- You can also specify a container name to SSH directly into that container. For now you are always logged in as `root` when you SSH to a container.
431
-
432
- $ cucumber-chef ssh devopserver
433
- Attempting SSH connection to cucumber-chef container 'devopserver'...
434
- _____ _ _____ _ __
435
- / ____| | | / ____| | / _|
436
- | | _ _ ___ _ _ _ __ ___ | |__ ___ _ __| | | |__ ___| |_
437
- | | | | | |/ __| | | | '_ ` _ \| '_ \ / _ \ '__| | | '_ \ / _ \ _|
438
- | |___| |_| | (__| |_| | | | | | | |_) | __/ | | |____| | | | __/ |
439
- \_____\__,_|\___|\__,_|_| |_| |_|_.__/ \___|_| \_____|_| |_|\___|_|
440
-
441
-
442
- Welcome to the Cucumber Chef Test Lab v2.0.0.rc1
443
-
444
- You are now logged in to the LXC 'devopserver'
445
-
446
- root@devopserver:~#
447
-
448
- #### `diagnose`
449
-
450
- This command provides you with a rapid way to get to the chef-client logs without needing to SSH into a container. There are a few basic options with this task, let's take a look at them.
451
-
452
- $ cucumber-chef help diagnose
453
- Usage:
454
- cucumber-chef diagnose <container>
455
-
456
- Options:
457
- -n, [--lines=N] # output the last N lines of the chef-client 'chef.log'
458
- # Default: 1
459
- -s, [--strace] # output the chef-client 'chef-stacktrace.out'
460
- # Default: true
461
- -l, [--log] # output the chef-client 'chef.log'
462
- # Default: true
463
-
464
- Provide diagnostics from the chef-client on the specified container.
465
-
466
- With the default options in effect, this task will output the `chef-stacktrace.out` file along with the last line of the `chef.log` file. You can of course request as many lines as you desire from the `chef.log` file. For example to look at the last 1000 lines of only the `chef.log` file you would likely run the task as follows.
467
-
468
- $ cucumber-chef diagnose devopserver --no-strace -n 1000
469
-
470
- Maybe you only want to view the `chef-stacktrace.out` file?
471
-
472
- $ cucumber-chef diagnose devopserver --no-log
473
-
474
- Maybe you want to run it with the default options in play; you would likely get some output as follows.
475
-
476
- $ cucumber-chef diagnose devopserver
477
- Attempting to collect diagnostic information on cucumber-chef container 'sysopserver'...
478
- ----------------------------------------------------------------------------
479
- chef-stacktrace.out:
480
- ----------------------------------------------------------------------------
481
- Generated at 2012-06-04 08:30:20 +0000
482
- Net::HTTPServerException: 412 "Precondition Failed"
483
- /opt/opscode/embedded/lib/ruby/1.9.1/net/http.rb:2303:in `error!'
484
- /opt/opscode/embedded/lib/ruby/gems/1.9.1/gems/chef-0.10.10/lib/chef/rest.rb:264:in `block in api_request'
485
- /opt/opscode/embedded/lib/ruby/gems/1.9.1/gems/chef-0.10.10/lib/chef/rest.rb:328:in `retriable_rest_request'
486
- /opt/opscode/embedded/lib/ruby/gems/1.9.1/gems/chef-0.10.10/lib/chef/rest.rb:240:in `api_request'
487
- /opt/opscode/embedded/lib/ruby/gems/1.9.1/gems/chef-0.10.10/lib/chef/rest.rb:139:in `post_rest'
488
- /opt/opscode/embedded/lib/ruby/gems/1.9.1/gems/chef-0.10.10/lib/chef/client.rb:313:in `sync_cookbooks'
489
- /opt/opscode/embedded/lib/ruby/gems/1.9.1/gems/chef-0.10.10/lib/chef/client.rb:194:in `setup_run_context'
490
- /opt/opscode/embedded/lib/ruby/gems/1.9.1/gems/chef-0.10.10/lib/chef/client.rb:162:in `run'
491
- /opt/opscode/embedded/lib/ruby/gems/1.9.1/gems/chef-0.10.10/lib/chef/application/client.rb:254:in `block in run_application'
492
- /opt/opscode/embedded/lib/ruby/gems/1.9.1/gems/chef-0.10.10/lib/chef/application/client.rb:241:in `loop'
493
- /opt/opscode/embedded/lib/ruby/gems/1.9.1/gems/chef-0.10.10/lib/chef/application/client.rb:241:in `run_application'
494
- /opt/opscode/embedded/lib/ruby/gems/1.9.1/gems/chef-0.10.10/lib/chef/application.rb:70:in `run'
495
- /opt/opscode/embedded/lib/ruby/gems/1.9.1/gems/chef-0.10.10/bin/chef-client:26:in `<top (required)>'
496
- /usr/bin/chef-client:19:in `load'
497
- /usr/bin/chef-client:19:in `<main>'
498
- ----------------------------------------------------------------------------
499
- chef.log:
500
- ----------------------------------------------------------------------------
501
- [Mon, 04 Jun 2012 08:30:20 +0000] FATAL: Net::HTTPServerException: 412 "Precondition Failed"
502
-
503
-
504
- #### `ps`
505
-
506
- This command provides you with a snapshot of all the container processes running on the Cucumber-Chef test lab. You can pass in `ps` command line options to customize the output as you desire.
507
-
508
- $ cucumber-chef help ps
509
- Usage:
510
- cucumber-chef ps [ps-options]
511
-
512
- Snapshot of the current cucumber-chef test lab container processes.
513
-
514
- Standard usage using `aux` options:
515
-
516
- $ cucumber-chef ps aux
517
- cucumber-chef v2.0.0.rc1
518
-
519
- Getting container processes from cucumber-chef test lab...
520
-
521
- ============================================================================
522
- CONTAINER USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
523
- sudo root 375 0.0 0.0 2368 608 ? S Jun21 0:00 upstart-udev-bridge --daemon
524
- sudo syslog 384 0.0 0.0 27296 1264 ? Sl Jun21 0:00 rsyslogd -c4
525
- sudo root 396 0.0 0.0 2236 388 ? S<s Jun21 0:00 udevd --daemon
526
- sudo root 406 0.0 0.0 1840 556 pts/19 Ss+ Jun21 0:00 /sbin/getty -8 38400 tty4
527
- sudo root 410 0.0 0.0 1840 560 pts/17 Ss+ Jun21 0:00 /sbin/getty -8 38400 tty2
528
- sudo root 412 0.0 0.0 1840 560 pts/18 Ss+ Jun21 0:00 /sbin/getty -8 38400 tty3
529
- sudo root 416 0.0 0.0 2428 812 ? Ss Jun21 0:00 cron
530
- sudo root 453 0.0 0.0 1840 564 pts/16 Ss+ Jun21 0:00 /sbin/getty -8 38400 tty1
531
- sudo root 455 0.0 0.0 1840 556 pts/20 Ss+ Jun21 0:00 /sbin/getty -8 38400 /dev/console
532
- sudo root 477 0.0 0.0 2288 576 ? Ss Jun21 0:00 dhclient3 -e IF_METRIC=100 -pf /var/run/dhclient.eth0.pid -lf /var/lib/dhcp3/dhclient.eth0.leases eth0
533
- sudo root 493 0.0 0.1 5600 2132 ? Ss Jun21 0:00 /usr/sbin/sshd -D
534
- users root 20777 0.0 0.0 2720 1484 ? Ss Jun21 0:02 /sbin/init
535
- users syslog 20876 0.0 0.0 27296 1172 ? Sl Jun21 0:02 rsyslogd -c4
536
- users root 20877 0.0 0.0 2368 560 ? S Jun21 0:00 upstart-udev-bridge --daemon
537
- users root 20883 0.0 0.0 2236 516 ? S<s Jun21 0:00 udevd --daemon
538
- users root 20914 0.0 0.0 1840 544 pts/4 Ss+ Jun21 0:00 /sbin/getty -8 38400 tty4
539
- users root 20918 0.0 0.0 1840 540 pts/2 Ss+ Jun21 0:00 /sbin/getty -8 38400 tty2
540
- users root 20921 0.0 0.0 1840 544 pts/3 Ss+ Jun21 0:00 /sbin/getty -8 38400 tty3
541
- users root 20925 0.0 0.0 2428 788 ? Ss Jun21 0:00 cron
542
- users root 20953 0.0 0.0 1840 544 pts/1 Ss+ Jun21 0:00 /sbin/getty -8 38400 tty1
543
- users root 20954 0.0 0.0 1840 544 pts/5 Ss+ Jun21 0:00 /sbin/getty -8 38400 /dev/console
544
- users root 20970 0.0 0.0 2288 572 ? Ss Jun21 0:00 dhclient3 -e IF_METRIC=100 -pf /var/run/dhclient.eth0.pid -lf /var/lib/dhcp3/dhclient.eth0.leases eth0
545
- users root 20987 0.0 0.1 5600 2128 ? Ss Jun21 0:01 /usr/sbin/sshd -D
546
- users root 21308 0.0 0.0 1848 488 ? S Jun21 0:07 tail -n 250 -f client.log
547
- users root 21519 0.0 0.0 1848 484 ? S 02:19 0:02 tail -n 250 -f /var/log/auth.log
548
- users root 21851 0.0 0.0 1848 484 ? S 02:20 0:02 tail -n 250 -f /var/log/chef/client.log
549
- chef-client root 27226 0.0 0.0 2728 1524 ? Ss Jun21 0:00 /sbin/init
550
- chef-client syslog 27328 0.0 0.0 27296 1244 ? Sl Jun21 0:00 rsyslogd -c4
551
- chef-client root 27329 0.0 0.0 2368 584 ? S Jun21 0:00 upstart-udev-bridge --daemon
552
- chef-client root 27340 0.0 0.0 2236 520 ? S<s Jun21 0:00 udevd --daemon
553
- chef-client root 27364 0.0 0.0 1840 548 pts/9 Ss+ Jun21 0:00 /sbin/getty -8 38400 tty4
554
- chef-client root 27368 0.0 0.0 1840 548 pts/7 Ss+ Jun21 0:00 /sbin/getty -8 38400 tty2
555
- chef-client root 27369 0.0 0.0 1840 548 pts/8 Ss+ Jun21 0:00 /sbin/getty -8 38400 tty3
556
- chef-client root 27371 0.0 0.0 2428 804 ? Ss Jun21 0:00 cron
557
- chef-client root 27401 0.0 0.0 1840 548 pts/6 Ss+ Jun21 0:00 /sbin/getty -8 38400 tty1
558
- chef-client root 27402 0.0 0.0 1840 548 pts/10 Ss+ Jun21 0:00 /sbin/getty -8 38400 /dev/console
559
- chef-client root 27420 0.0 0.0 2288 572 ? Ss Jun21 0:00 dhclient3 -e IF_METRIC=100 -pf /var/run/dhclient.eth0.pid -lf /var/lib/dhcp3/dhclient.eth0.leases eth0
560
- chef-client root 27437 0.0 0.1 5600 2128 ? Ss Jun21 0:00 /usr/sbin/sshd -D
561
- chef-client root 27616 0.2 1.2 26292 22128 ? Sl Jun21 6:00 /opt/opscode/embedded/bin/ruby /usr/bin/chef-client -d -P /var/run/chef/client.pid -L /var/log/chef/client.log -c /etc/chef/client.rb -i 1800 -s 20
562
- timezone root 28244 0.0 0.0 2724 1568 ? Ss Jun21 0:00 /sbin/init
563
- timezone root 28355 0.0 0.0 2368 600 ? S Jun21 0:00 upstart-udev-bridge --daemon
564
- timezone syslog 28356 0.0 0.0 27296 1268 ? Sl Jun21 0:00 rsyslogd -c4
565
- timezone root 28366 0.0 0.0 2236 504 ? S<s Jun21 0:00 udevd --daemon
566
- timezone root 28385 0.0 0.0 1840 556 pts/14 Ss+ Jun21 0:00 /sbin/getty -8 38400 tty4
567
- timezone root 28388 0.0 0.0 1840 560 pts/12 Ss+ Jun21 0:00 /sbin/getty -8 38400 tty2
568
- timezone root 28390 0.0 0.0 1840 556 pts/13 Ss+ Jun21 0:00 /sbin/getty -8 38400 tty3
569
- timezone root 28397 0.0 0.0 2428 812 ? Ss Jun21 0:00 cron
570
- timezone root 28423 0.0 0.0 1840 564 pts/11 Ss+ Jun21 0:00 /sbin/getty -8 38400 tty1
571
- timezone root 28426 0.0 0.0 1840 560 pts/15 Ss+ Jun21 0:00 /sbin/getty -8 38400 /dev/console
572
- timezone root 28449 0.0 0.0 2288 576 ? Ss Jun21 0:00 dhclient3 -e IF_METRIC=100 -pf /var/run/dhclient.eth0.pid -lf /var/lib/dhcp3/dhclient.eth0.leases eth0
573
- timezone root 28466 0.0 0.1 5600 2124 ? Ss Jun21 0:00 /usr/sbin/sshd -D
574
- sudo root 32737 0.0 0.0 2720 1580 ? Ss Jun21 0:00 /sbin/init
575
- users root 32741 0.0 0.0 2232 280 ? S< Jun21 0:00 udevd --daemon
576
- users root 32742 0.0 0.0 2232 280 ? S< Jun21 0:00 udevd --daemon
577
- chef-client root 32745 0.0 0.0 2232 280 ? S< Jun21 0:00 udevd --daemon
578
- chef-client root 32747 0.0 0.0 2232 280 ? S< Jun21 0:00 udevd --daemon
579
- timezone root 32754 0.0 0.0 2232 272 ? S< Jun21 0:00 udevd --daemon
580
- timezone root 32755 0.0 0.0 2232 272 ? S< Jun21 0:00 udevd --daemon
581
-
582
- ### Example Test Run
583
-
584
- Here is an example of using Cucumber-Chef to do a basic test. In this test we will provision a server called `devopserver` and apply the `chef-client::service` recipe from the `chef-client` community cookbook. This example assumes you have your test lab provisioned and up and running. First things first, make sure you've downloaded the `chef-client` community cookbook and placed it in your chef-repo.
585
-
586
- Now upload the `chef-client` community cookbook to your Cucumber-Chef test lab.
587
-
588
- $ cc-knife cookbook upload chef-client
589
- Uploading chef-client [1.1.2]
590
- Uploaded 1 cookbook.
591
-
592
- Next create your `devopserver` feature.
593
-
594
- $ cucumber-chef create devopserver
595
-
596
- Here is the feature we'll be using. This feature has some extra scenarios to illustrate how you might go about testing other parts of a system. Go into the features directory of your chef-repo and replace the contents of the `devopserver.feature` file with the text below.
597
-
598
- @devopserver @wip
599
- Feature: Perform test driven infrastructure with Cucumber-Chef
600
- In order to learn how to develop test driven infrastructure
601
- As an infrastructure developer
602
- I want to better understand how to use Cucumber-Chef
603
-
604
- Background:
605
- * I have a server called "devopserver"
606
- * "devopserver" is running "ubuntu" "lucid"
607
- * "devopserver" has been provisioned
608
- * the "chef-client::service" recipe has been added to the "devopserver" run list
609
- * the chef-client has been run on "devopserver"
610
- * I ssh to "devopserver" with the following credentials:
611
- | username | keyfile |
612
- | root | ../.ssh/id_rsa |
613
-
614
- Scenario: Can connect to the provisioned server via SSH password authentication
615
- And I run "hostname"
616
- Then I should see "devopserver" in the output
617
-
618
- Scenario: Default root shell is bash
619
- And I run "echo $SHELL"
620
- Then I should see "bash" in the output
621
-
622
- Scenario: Default gateway and resolver are using Cucumber-Chef Test Lab
623
- And I run "route -n | grep 'UG'"
624
- Then I should see "192.168.255.254" in the output
625
- And I run "cat /etc/resolv.conf"
626
- Then I should see "192.168.255.254" in the output
627
- And I should see "8.8.8.8" in the output
628
- And I should see "8.8.4.4" in the output
629
-
630
- Scenario: Primary interface is configured with my IP address and MAC address
631
- And I run "ifconfig eth0"
632
- Then I should see the "IP" of "devopserver" in the output
633
- And I should see the "MAC" of "devopserver" in the output
634
-
635
- Scenario: Local interface is not configured with my IP address or MAC address
636
- And I run "ifconfig lo"
637
- Then I should see "127.0.0.1" in the output
638
- And I should not see the "IP" of "devopserver" in the output
639
- And I should not see the "MAC" of "devopserver" in the output
640
-
641
- Scenario: Chef-Client is running as a daemon
642
- When I run "ps aux | grep [c]hef-client"
643
- Then I should see "chef-client" in the output
644
- And I should see "-d" in the output
645
- And I should see "-i 1800" in the output
646
- And I should see "-s 20" in the output
647
-
648
- Now we're going to execute the test. Created features are pre tagged with the name of the feature (i.e. `@<name>`) and `@wip`. Be sure to pass that to the test runner so Cucumber knows to only run tests tagged with that, unless you want to test all your features.
649
-
650
- $ cucumber-chef test --tags @devopserver
651
- Using features directory: /home/couldbeyou/chef-repo/features
652
- Cucumber-Chef Test Runner Initalized!
653
- Cleaning up any previous test runs...done.
654
- Uploading files required for this test run...done.
655
- Executing Cucumber-Chef Test Runner
656
- Using the default profile...
657
- Code:
658
- * ./support/env.rb
659
- * ./devopserver/step_definitions/devopserver_steps.rb
660
- * ./sample/step_definitions/sample_steps.rb
661
-
662
- Features:
663
- * ./devopserver/devopserver.feature
664
- Parsing feature files took 0m0.076s
665
-
666
- @devopserver @wip
667
- Feature: Perform test driven infrastructure with Cucumber-Chef
668
- In order to learn how to develop test driven infrastructure
669
- As an infrastructure developer
670
- I want to better understand how to use Cucumber-Chef
671
-
672
- Background: # ./devopserver/devopserver.feature:7
673
- * all servers are being destroyed
674
- * I have a server called "devopserver" # cucumber-chef-2.0.0.rc1/lib/cucumber/chef/steps/provision_steps.rb:1
675
- * "devopserver" is running "ubuntu" "lucid" # cucumber-chef-2.0.0.rc1/lib/cucumber/chef/steps/provision_steps.rb:5
676
- * devopserver is being provisioned
677
- * "devopserver" has been provisioned # cucumber-chef-2.0.0.rc1/lib/cucumber/chef/steps/provision_steps.rb:25
678
- * the "chef-client::service" recipe has been added to the "devopserver" run list # cucumber-chef-2.0.0.rc1/lib/cucumber/chef/steps/provision_steps.rb:33
679
- * the chef-client has been run on "devopserver" # cucumber-chef-2.0.0.rc1/lib/cucumber/chef/steps/provision_steps.rb:37
680
- * I ssh to "devopserver" with the following credentials: # cucumber-chef-2.0.0.rc1/lib/cucumber/chef/steps/ssh_steps.rb:57
681
- | username | keyfile |
682
- | root | ../.ssh/id_rsa |
683
-
684
- Scenario: Can connect to the provisioned server via SSH password authentication # ./devopserver/devopserver.feature:17
685
- And I run "hostname" # cucumber-chef-2.0.0.rc1/lib/cucumber/chef/steps/ssh_steps.rb:77
686
- Then I should see "devopserver" in the output # cucumber-chef-2.0.0.rc1/lib/cucumber/chef/steps/ssh_steps.rb:81
687
-
688
- Scenario: Default root shell is bash # ./devopserver/devopserver.feature:21
689
- And I run "echo $SHELL" # cucumber-chef-2.0.0.rc1/lib/cucumber/chef/steps/ssh_steps.rb:77
690
- Then I should see "bash" in the output # cucumber-chef-2.0.0.rc1/lib/cucumber/chef/steps/ssh_steps.rb:81
691
-
692
- Scenario: Default gateway and resolver are using Cucumber-Chef Test Lab # ./devopserver/devopserver.feature:25
693
- And I run "route -n | grep 'UG'" # cucumber-chef-2.0.0.rc1/lib/cucumber/chef/steps/ssh_steps.rb:77
694
- Then I should see "192.168.255.254" in the output # cucumber-chef-2.0.0.rc1/lib/cucumber/chef/steps/ssh_steps.rb:81
695
- And I run "cat /etc/resolv.conf" # cucumber-chef-2.0.0.rc1/lib/cucumber/chef/steps/ssh_steps.rb:77
696
- Then I should see "192.168.255.254" in the output # cucumber-chef-2.0.0.rc1/lib/cucumber/chef/steps/ssh_steps.rb:81
697
- And I should see "8.8.8.8" in the output # cucumber-chef-2.0.0.rc1/lib/cucumber/chef/steps/ssh_steps.rb:81
698
- And I should see "8.8.4.4" in the output # cucumber-chef-2.0.0.rc1/lib/cucumber/chef/steps/ssh_steps.rb:81
699
-
700
- Scenario: Primary interface is configured with my IP address and MAC address # ./devopserver/devopserver.feature:33
701
- And I run "ifconfig eth0" # cucumber-chef-2.0.0.rc1/lib/cucumber/chef/steps/ssh_steps.rb:77
702
- Then I should see the "IP" of "devopserver" in the output # cucumber-chef-2.0.0.rc1/lib/cucumber/chef/steps/ssh_steps.rb:90
703
- And I should see the "MAC" of "devopserver" in the output # cucumber-chef-2.0.0.rc1/lib/cucumber/chef/steps/ssh_steps.rb:90
704
-
705
- Scenario: Local interface is not configured with my IP address or MAC address # ./devopserver/devopserver.feature:38
706
- And I run "ifconfig lo" # cucumber-chef-2.0.0.rc1/lib/cucumber/chef/steps/ssh_steps.rb:77
707
- Then I should see "127.0.0.1" in the output # cucumber-chef-2.0.0.rc1/lib/cucumber/chef/steps/ssh_steps.rb:81
708
- And I should not see the "IP" of "devopserver" in the output # cucumber-chef-2.0.0.rc1/lib/cucumber/chef/steps/ssh_steps.rb:90
709
- And I should not see the "MAC" of "devopserver" in the output # cucumber-chef-2.0.0.rc1/lib/cucumber/chef/steps/ssh_steps.rb:90
710
-
711
- Scenario: Chef-Client is running as a daemon # ./devopserver/devopserver.feature:44
712
- When I run "ps aux | grep [c]hef-client" # cucumber-chef-2.0.0.rc1/lib/cucumber/chef/steps/ssh_steps.rb:77
713
- Then I should see "chef-client" in the output # cucumber-chef-2.0.0.rc1/lib/cucumber/chef/steps/ssh_steps.rb:81
714
- And I should see "-d" in the output # cucumber-chef-2.0.0.rc1/lib/cucumber/chef/steps/ssh_steps.rb:81
715
- And I should see "-i 1800" in the output # cucumber-chef-2.0.0.rc1/lib/cucumber/chef/steps/ssh_steps.rb:81
716
- And I should see "-s 20" in the output # cucumber-chef-2.0.0.rc1/lib/cucumber/chef/steps/ssh_steps.rb:81
717
-
718
- 6 scenarios (6 passed)
719
- 58 steps (58 passed)
720
- 2m45.515s
721
-
722
- If all goes well you should see output similar to what's above! Enjoy and have fun!
723
-
724
- # LINKS
5
+ # RESOURCES
725
6
 
726
7
  Source:
727
8
 
@@ -735,6 +16,10 @@ Wiki:
735
16
 
736
17
  * https://github.com/Atalanta/cucumber-chef/wiki
737
18
 
19
+ Chat:
20
+
21
+ * #cucumber-chef on irc.freenode.net
22
+
738
23
  # LICENSE
739
24
 
740
25
  Cucumber-Chef - A test driven infrastructure system
data/bin/cc-knife CHANGED
@@ -17,7 +17,7 @@ if (test_lab = Cucumber::Chef::TestLab.new) && (test_lab.labs_running.count > 0)
17
17
 
18
18
  knife_rb = Cucumber::Chef.locate(:file, ".cucumber-chef", "knife.rb")
19
19
  if File.exists?(knife_rb)
20
- command = [knife, ARGV, "-s http://#{test_lab.labs_running.first.public_ip_address}:4000", "-c #{knife_rb}", "2>&1"].flatten.compact.join(" ")
20
+ command = [knife, ARGV, "--server-url http://#{test_lab.labs_running.first.public_ip_address}:4000", "--config #{knife_rb}", "2>&1"].flatten.compact.join(" ")
21
21
  puts(command)
22
22
  puts(%x(#{command}))
23
23
  exit($?.to_i)
data/bin/cucumber-chef CHANGED
@@ -117,7 +117,7 @@ class CucumberChef < Thor
117
117
  puts
118
118
  @region = ask "Which region are you using?", :bold
119
119
  puts
120
- say("One last thing. If your using librarian-chef, we want to be sure all the hooks are in place.")
120
+ say("One last thing. If you're using librarian-chef, we want to be sure all the hooks are in place.")
121
121
  puts
122
122
  @librarian_chef = yes?("Does this chef-repo use librarian-chef?", :bold)
123
123
  puts
@@ -0,0 +1,38 @@
1
+ #!/usr/bin/env ruby
2
+ require 'cucumber-chef'
3
+
4
+ def run(command)
5
+ puts "Executing: '#{command}'"
6
+ @ssh.exec(command)
7
+ end
8
+
9
+ $logger = Cucumber::Chef::Logger.new
10
+ $logger.level = (Cucumber::Chef.is_rc? ? Cucumber::Chef::Logger::DEBUG : Cucumber::Chef::Logger::INFO)
11
+
12
+ message = "push-cucumber-chef v#{Cucumber::Chef::VERSION}"
13
+ puts(message)
14
+ $logger.info { message }
15
+
16
+ Cucumber::Chef::Config.load
17
+ if (test_lab = Cucumber::Chef::TestLab.new) && (test_lab.labs_running.count > 0)
18
+ @ssh = Cucumber::Chef::SSH.new
19
+ @ssh.config[:host] = test_lab.labs_running.first.public_ip_address
20
+ @ssh.config[:ssh_user] = "ubuntu"
21
+ @ssh.config[:identity_file] = Cucumber::Chef.locate(:file, ".cucumber-chef", "id_rsa-#{@ssh.config[:ssh_user]}")
22
+
23
+ gem_name = "cucumber-chef-#{Cucumber::Chef::VERSION}.gem"
24
+
25
+ puts %x(cd #{Cucumber::Chef.root} && gem build cucumber-chef.gemspec -V)
26
+
27
+ local_file = File.join(Cucumber::Chef.root, gem_name)
28
+ remote_file = File.join("/", "home", @ssh.config[:ssh_user], gem_name)
29
+ puts("#{local_file} -> #{@ssh.config[:ssh_user]}@#{test_lab.labs_running.first.public_ip_address}:#{remote_file}")
30
+ @ssh.upload(local_file, remote_file)
31
+ FileUtils.rm_f(File.join(Cucumber::Chef.root, "*.gem"))
32
+
33
+ run("cd #{File.dirname(remote_file)}; ls -la | grep 'cucumber-chef-'; sudo gem uninstall cucumber-chef -a -I -x -V; sudo gem install #{gem_name} -l -V; rm -f *.gem")
34
+
35
+ else
36
+ puts("No running cucumber-chef test labs to connect to!")
37
+ exit(1)
38
+ end
@@ -34,16 +34,16 @@ Gem::Specification.new do |s|
34
34
  s.required_rubygems_version = ">= 1.3.6"
35
35
  s.licenses = ["Apache 2.0"]
36
36
 
37
- s.add_dependency("chef", "~> 0.10.10")
38
- s.add_dependency("cucumber", "~> 1.2.0")
39
- s.add_dependency("erubis", "~> 2.7.0")
40
- s.add_dependency("fog", "~> 1.3.1")
41
- s.add_dependency("net-sftp", "~> 2.0.5")
42
- s.add_dependency("net-ssh", "~> 2.2.2")
43
- s.add_dependency("mixlib-config", "~> 1.1.2")
44
- s.add_dependency("thor", "~> 0.15.2")
45
- s.add_dependency("rake", "~> 0.9.2")
46
- s.add_dependency("ubuntu_ami", "~> 0.4.0")
37
+ s.add_dependency("chef", ">= 0.10.10")
38
+ s.add_dependency("cucumber", ">= 1.2.0")
39
+ s.add_dependency("erubis", ">= 2.7.0")
40
+ s.add_dependency("fog", ">= 1.3.1")
41
+ s.add_dependency("net-sftp", ">= 2.0.5")
42
+ s.add_dependency("net-ssh", ">= 2.2.2")
43
+ s.add_dependency("mixlib-config", ">= 1.1.2")
44
+ s.add_dependency("thor", ">= 0.15.2")
45
+ s.add_dependency("rake", ">= 0.9.2")
46
+ s.add_dependency("ubuntu_ami", ">= 0.4.0")
47
47
 
48
48
  s.add_development_dependency("rspec", "~> 2.10.0")
49
49
  s.add_development_dependency("simplecov", "~> 0.6.4")
@@ -25,10 +25,13 @@ module Cucumber::Chef::Helpers::ChefClient
25
25
 
26
26
  # call this in a Before hook
27
27
  def chef_set_client_config(config={})
28
- @chef_client_config = { :log_level => :debug,
29
- :log_location => "/var/log/chef/client.log",
30
- :chef_server_url => "https://api.opscode.com/organizations/#{config[:orgname]}",
31
- :validation_client_name => "#{config[:orgname]}-validator" }.merge(config)
28
+ @chef_client_config = (@chef_client_config || {
29
+ :environment => "_default",
30
+ :log_level => :debug,
31
+ :log_location => "/var/log/chef/client.log",
32
+ :chef_server_url => "https://api.opscode.com/organizations/#{config[:orgname]}",
33
+ :validation_client_name => "#{config[:orgname]}-validator"
34
+ }).merge(config)
32
35
  end
33
36
 
34
37
  ################################################################################
@@ -63,6 +66,7 @@ module Cucumber::Chef::Helpers::ChefClient
63
66
  f.puts("ssl_verify_mode :verify_none")
64
67
  f.puts("validation_client_name \"#{@chef_client_config[:validation_client_name]}\"")
65
68
  f.puts("node_name \"#{name}\"")
69
+ f.puts("environment \"#{@chef_client_config[:environment]}\"")
66
70
  f.puts
67
71
  f.puts("Mixlib::Log::Formatter.show_time = true")
68
72
  end
@@ -55,6 +55,10 @@ And /^the "([^\"]*)" recipe has been added to the "([^\"]*)" run list$/ do |reci
55
55
  chef_set_client_attributes(@servers[name], :run_list => ["recipe[#{recipe}]"])
56
56
  end
57
57
 
58
+ And /^"([^\"]*)" is in the "([^\"]*)" environment$/ do |name, environment|
59
+ chef_set_client_config(:environment => environment)
60
+ end
61
+
58
62
  And /^the chef-client has been run on "([^\"]*)"$/ do |name|
59
63
  chef_run_client(name)
60
64
  end
@@ -14,6 +14,7 @@ gpg --fetch-key http://apt.opscode.com/packages@opscode.com.gpg.key
14
14
  gpg --export packages@opscode.com | tee /etc/apt/trusted.gpg.d/opscode-keyring.gpg > /dev/null
15
15
  apt-get -q -y --force-yes update
16
16
  apt-get -q -y --force-yes -o Dpkg::Options::="--force-confnew" install opscode-keyring
17
+ apt-get -q -y --force-yes update
17
18
  chown -R ${SUDO_USER}:${SUDO_USER} ${HOME}/.gnupg
18
19
  apt-get -q -y upgrade
19
20
 
@@ -23,7 +24,7 @@ chef-solr chef-solr/amqp_password password <%= @config[:amqp_password] %>
23
24
  chef-server-webui chef-server-webui/admin_password password <%= @config[:admin_password] %>
24
25
  EOF
25
26
 
26
- apt-get -q -y install chef chef-server
27
+ apt-get -q -y --force-yes install chef chef-server
27
28
 
28
29
  echo -n "Waiting on validation.pem and webui.pem to appear..."
29
30
  until [ -f /etc/chef/validation.pem ] && [ -f /etc/chef/webui.pem ]; do
@@ -32,6 +32,12 @@ module Cucumber
32
32
  ((Cucumber::Chef::VERSION =~ /rc/) || (Cucumber::Chef::VERSION =~ /pre/))
33
33
  end
34
34
 
35
+ ################################################################################
36
+
37
+ def root
38
+ File.expand_path(File.join(File.dirname(__FILE__), "..", "..", ".."), File.dirname(__FILE__))
39
+ end
40
+
35
41
  ################################################################################
36
42
 
37
43
  def load_knife_config
@@ -24,7 +24,7 @@ module Cucumber
24
24
 
25
25
  ################################################################################
26
26
 
27
- VERSION = "2.0.1.pre" unless const_defined?(:VERSION)
27
+ VERSION = "2.0.2.pre" unless const_defined?(:VERSION)
28
28
 
29
29
  ################################################################################
30
30
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cucumber-chef
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.1.pre
4
+ version: 2.0.2.pre
5
5
  prerelease: 6
6
6
  platform: ruby
7
7
  authors:
@@ -10,14 +10,14 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-06-24 00:00:00.000000000 Z
13
+ date: 2012-08-27 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: chef
17
17
  requirement: !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
- - - ~>
20
+ - - ! '>='
21
21
  - !ruby/object:Gem::Version
22
22
  version: 0.10.10
23
23
  type: :runtime
@@ -25,7 +25,7 @@ dependencies:
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  none: false
27
27
  requirements:
28
- - - ~>
28
+ - - ! '>='
29
29
  - !ruby/object:Gem::Version
30
30
  version: 0.10.10
31
31
  - !ruby/object:Gem::Dependency
@@ -33,7 +33,7 @@ dependencies:
33
33
  requirement: !ruby/object:Gem::Requirement
34
34
  none: false
35
35
  requirements:
36
- - - ~>
36
+ - - ! '>='
37
37
  - !ruby/object:Gem::Version
38
38
  version: 1.2.0
39
39
  type: :runtime
@@ -41,7 +41,7 @@ dependencies:
41
41
  version_requirements: !ruby/object:Gem::Requirement
42
42
  none: false
43
43
  requirements:
44
- - - ~>
44
+ - - ! '>='
45
45
  - !ruby/object:Gem::Version
46
46
  version: 1.2.0
47
47
  - !ruby/object:Gem::Dependency
@@ -49,7 +49,7 @@ dependencies:
49
49
  requirement: !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
- - - ~>
52
+ - - ! '>='
53
53
  - !ruby/object:Gem::Version
54
54
  version: 2.7.0
55
55
  type: :runtime
@@ -57,7 +57,7 @@ dependencies:
57
57
  version_requirements: !ruby/object:Gem::Requirement
58
58
  none: false
59
59
  requirements:
60
- - - ~>
60
+ - - ! '>='
61
61
  - !ruby/object:Gem::Version
62
62
  version: 2.7.0
63
63
  - !ruby/object:Gem::Dependency
@@ -65,7 +65,7 @@ dependencies:
65
65
  requirement: !ruby/object:Gem::Requirement
66
66
  none: false
67
67
  requirements:
68
- - - ~>
68
+ - - ! '>='
69
69
  - !ruby/object:Gem::Version
70
70
  version: 1.3.1
71
71
  type: :runtime
@@ -73,7 +73,7 @@ dependencies:
73
73
  version_requirements: !ruby/object:Gem::Requirement
74
74
  none: false
75
75
  requirements:
76
- - - ~>
76
+ - - ! '>='
77
77
  - !ruby/object:Gem::Version
78
78
  version: 1.3.1
79
79
  - !ruby/object:Gem::Dependency
@@ -81,7 +81,7 @@ dependencies:
81
81
  requirement: !ruby/object:Gem::Requirement
82
82
  none: false
83
83
  requirements:
84
- - - ~>
84
+ - - ! '>='
85
85
  - !ruby/object:Gem::Version
86
86
  version: 2.0.5
87
87
  type: :runtime
@@ -89,7 +89,7 @@ dependencies:
89
89
  version_requirements: !ruby/object:Gem::Requirement
90
90
  none: false
91
91
  requirements:
92
- - - ~>
92
+ - - ! '>='
93
93
  - !ruby/object:Gem::Version
94
94
  version: 2.0.5
95
95
  - !ruby/object:Gem::Dependency
@@ -97,7 +97,7 @@ dependencies:
97
97
  requirement: !ruby/object:Gem::Requirement
98
98
  none: false
99
99
  requirements:
100
- - - ~>
100
+ - - ! '>='
101
101
  - !ruby/object:Gem::Version
102
102
  version: 2.2.2
103
103
  type: :runtime
@@ -105,7 +105,7 @@ dependencies:
105
105
  version_requirements: !ruby/object:Gem::Requirement
106
106
  none: false
107
107
  requirements:
108
- - - ~>
108
+ - - ! '>='
109
109
  - !ruby/object:Gem::Version
110
110
  version: 2.2.2
111
111
  - !ruby/object:Gem::Dependency
@@ -113,7 +113,7 @@ dependencies:
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  none: false
115
115
  requirements:
116
- - - ~>
116
+ - - ! '>='
117
117
  - !ruby/object:Gem::Version
118
118
  version: 1.1.2
119
119
  type: :runtime
@@ -121,7 +121,7 @@ dependencies:
121
121
  version_requirements: !ruby/object:Gem::Requirement
122
122
  none: false
123
123
  requirements:
124
- - - ~>
124
+ - - ! '>='
125
125
  - !ruby/object:Gem::Version
126
126
  version: 1.1.2
127
127
  - !ruby/object:Gem::Dependency
@@ -129,7 +129,7 @@ dependencies:
129
129
  requirement: !ruby/object:Gem::Requirement
130
130
  none: false
131
131
  requirements:
132
- - - ~>
132
+ - - ! '>='
133
133
  - !ruby/object:Gem::Version
134
134
  version: 0.15.2
135
135
  type: :runtime
@@ -137,7 +137,7 @@ dependencies:
137
137
  version_requirements: !ruby/object:Gem::Requirement
138
138
  none: false
139
139
  requirements:
140
- - - ~>
140
+ - - ! '>='
141
141
  - !ruby/object:Gem::Version
142
142
  version: 0.15.2
143
143
  - !ruby/object:Gem::Dependency
@@ -145,7 +145,7 @@ dependencies:
145
145
  requirement: !ruby/object:Gem::Requirement
146
146
  none: false
147
147
  requirements:
148
- - - ~>
148
+ - - ! '>='
149
149
  - !ruby/object:Gem::Version
150
150
  version: 0.9.2
151
151
  type: :runtime
@@ -153,7 +153,7 @@ dependencies:
153
153
  version_requirements: !ruby/object:Gem::Requirement
154
154
  none: false
155
155
  requirements:
156
- - - ~>
156
+ - - ! '>='
157
157
  - !ruby/object:Gem::Version
158
158
  version: 0.9.2
159
159
  - !ruby/object:Gem::Dependency
@@ -161,7 +161,7 @@ dependencies:
161
161
  requirement: !ruby/object:Gem::Requirement
162
162
  none: false
163
163
  requirements:
164
- - - ~>
164
+ - - ! '>='
165
165
  - !ruby/object:Gem::Version
166
166
  version: 0.4.0
167
167
  type: :runtime
@@ -169,7 +169,7 @@ dependencies:
169
169
  version_requirements: !ruby/object:Gem::Requirement
170
170
  none: false
171
171
  requirements:
172
- - - ~>
172
+ - - ! '>='
173
173
  - !ruby/object:Gem::Version
174
174
  version: 0.4.0
175
175
  - !ruby/object:Gem::Dependency
@@ -211,6 +211,7 @@ email:
211
211
  executables:
212
212
  - cc-knife
213
213
  - cucumber-chef
214
+ - push-cucumber-chef
214
215
  extensions: []
215
216
  extra_rdoc_files: []
216
217
  files:
@@ -226,6 +227,7 @@ files:
226
227
  - TODO.md
227
228
  - bin/cc-knife
228
229
  - bin/cucumber-chef
230
+ - bin/push-cucumber-chef
229
231
  - chef_repo/cookbooks/cucumber-chef/LICENSE
230
232
  - chef_repo/cookbooks/cucumber-chef/README.md
231
233
  - chef_repo/cookbooks/cucumber-chef/attributes/default.rb
@@ -299,7 +301,6 @@ files:
299
301
  - spec/cucumber/chef/provisioner_spec.rb
300
302
  - spec/cucumber/chef/test_lab_spec.rb
301
303
  - spec/spec_helper.rb
302
- - todo.org
303
304
  homepage: http://www.cucumber-chef.org
304
305
  licenses:
305
306
  - Apache 2.0
data/todo.org DELETED
@@ -1,17 +0,0 @@
1
- * Ideas
2
- ** TODO Vagrant LXC Basebox
3
- ** TODO Various OS baseboxes
4
- ** TODO Make it easy to use OSC server
5
- ** TODO Make it easy to use chef-solo
6
- ** TODO Provide a libvirt capability
7
- ** DONE Go through the bugs
8
- ** TODO Ship a release candidate
9
- ** DONE Merge Zac's changes
10
- ** DONE RC branch
11
- ** TODO Write test for cucumber-chef ssh
12
- ** TODO Write tests for the stuff pulled from cucumber-nagios
13
- ** TODO Make recipes food-critic compliant
14
- ** TODO Make recipes use chef-solo?
15
- ** TODO Fork ubuntu ami to 'amy'
16
- ** TODO Move from thor to mixlib cli?
17
-