chef 0.9.8.beta.1 → 0.9.8.beta.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -11,26 +11,28 @@ This manual page documents knife, a command-line utility used to interact with a
11
11
 
12
12
  Unless otherwise specified, output is in JSON format, and input files are also JSON format.
13
13
 
14
+ The Chef class `Chef::Config` that configures the behavior of how knife runs has options that correspond to command-line options. These are noted as `Chef::Config` values.
15
+
14
16
  ## GENERAL OPTIONS
15
17
 
16
18
  * `-s`, `--server-url` URL:
17
- Chef Server URL
19
+ Chef Server URL, corresponds to `Chef::Config` `chef_server_url`.
18
20
  * `-k`, `--key` KEY:
19
- API Client Key
21
+ API Client Key, corresponds to `Chef::Config` `client_key`.
20
22
  * `-c`, `--config` CONFIG:
21
23
  The configuration file to use
22
24
  * `-e`, `--editor` EDITOR:
23
25
  Set the editor to use for interactive commands
24
- * `-f`, `--format` FORMAT:
26
+ * `-F`, `--format` FORMAT:
25
27
  Which format to use for output
26
28
  * `-l`, `--log_level` LEVEL:
27
- Set the log level (debug, info, warn, error, fatal)
29
+ Set the log level (debug, info, warn, error, fatal), corresponds to `Chef::Config` `log_level`.
28
30
  * `-L`, `--logfile` LOGLOCATION:
29
- Set the log file location, defaults to STDOUT
31
+ Set the log file location, defaults to STDOUT, corresponds to `Chef::Config` `log_location`.
30
32
  * `-n`, `--no-editor`:
31
33
  Do not open EDITOR, just accept the data as is
32
34
  * `-u`, `--user` USER:
33
- API Client Username
35
+ API Client Username, corresponds to `Chef::Config` `node_name`.
34
36
  * `-p`, `--print-after`:
35
37
  Show the data after a destructive operation
36
38
  * `-v`, `--version`:
@@ -40,6 +42,8 @@ Unless otherwise specified, output is in JSON format, and input files are also J
40
42
  * `-h`, `--help`:
41
43
  Show this message
42
44
 
45
+ Usage information for sub-commands can be displayed with `knife SUB-COMMAND --help`.
46
+
43
47
  ## SUB-COMMANDS
44
48
 
45
49
  Knife sub-commands are structured as _NOUN verb NOUN (options)_. The sub-commands are meant to be intuitively named. Because the Chef Server API is RESTful, sub-commands generally utilize CRUD operations.
@@ -64,6 +68,10 @@ __configure__ _(options)_
64
68
 
65
69
  Create a configuration file for knife. This will prompt for values to enter into the file. Default values are listed in square brackets if no other entry is typed. See __CONFIGURATION__ below for available options.
66
70
 
71
+ __configure client DIRECTORY__
72
+
73
+ Read the `knife.rb` config file and generate a config file suitable for use in `/etc/chef/client.rb` and copy the validation certificate into the specified _DIRECTORY_.
74
+
67
75
  __index rebuild__ _(options)_
68
76
 
69
77
  * `-y`, `--yes`:
@@ -105,7 +113,67 @@ __ssh QUERY COMMAND__ _(options)_
105
113
  * `-x`, `--ssh-user USERNAME `:
106
114
  The ssh username
107
115
 
108
- The __ssh__ sub-command opens an ssh session to each of the nodes in the search results of the _QUERY_. This sub-command requires that the net-ssh-multi and highline Ruby libraries are installed. On Debian systems, these are the libnet-ssh-multi-ruby and libhighline-ruby packages. They can also be installed as RubyGems (net-ssh-multi and highline, respectively).
116
+ The _ssh_ sub-command opens an ssh session to each of the nodes in the search results of the _QUERY_. This sub-command requires that the net-ssh-multi and highline Ruby libraries are installed. On Debian systems, these are the libnet-ssh-multi-ruby and libhighline-ruby packages. They can also be installed as RubyGems (net-ssh-multi and highline, respectively).
117
+
118
+ ## BOOTSTRAP SUB-COMMANDS
119
+
120
+ __bootstrap FQDN__ _(options)_
121
+
122
+ * `-i`, `--identity-file IDENTITY_FILE`:
123
+ The SSH identity file used for authentication
124
+ * `-N`, `--node-name NAME`:
125
+ The Chef node name for your new node
126
+ * `-P`, `--ssh-password PASSWORD`:
127
+ The ssh password
128
+ * `-x`, `--ssh-user USERNAME`:
129
+ The ssh username
130
+ * `--prerelease`:
131
+ Install pre-release Chef gems
132
+ * `-r`, `--run-list RUN_LIST`:
133
+ Comma separated list of roles/recipes to apply
134
+ * `-P`, `--ssh-password PASSWORD`:
135
+ The ssh password
136
+ * `-x`, `--ssh-user USERNAME`:
137
+ The ssh username
138
+ * `--template-file TEMPLATE`:
139
+ Full path to location of template to use
140
+ * `--sudo`:
141
+ Execute the bootstrap via sudo
142
+ * `-d`, `--distro DISTRO`:
143
+ Bootstrap a distro using a template
144
+
145
+ Performs a Chef Bootstrap on the target node. The goal of the bootstrap is to get Chef installed on the target system so it can run Chef Client with a Chef Server. The main assumption is a baseline OS installation exists. This sub-command is used internally by some cloud computing server create commands and the others will be migrated in a future version of Chef.
146
+
147
+ As of Chef 0.9.8, the bootstrap sub-command supports supplying a template to perform the bootstrap steps. If the distro is not specified (via `-d` or `--distro` option), an Ubuntu 10.04 with RubyGems is assumed. The __DISTRO__ value corresponds to the base filename of the template, in other words `DISTRO`.erb. A template file can be specified with the `--template-file` option in which case the __DISTRO__ is not used. The sub-command looks in the following locations for the template to use:
148
+
149
+ * `bootstrap` directory in the installed Chef Knife library.
150
+ * `bootstrap` directory in the `$PWD/.chef`.
151
+ * `bootstrap` directory in the users `$HOME/.chef`.
152
+
153
+ The default bootstrap templates are scripts that get copied to the target node (FQDN). As of Chef 0.9.8, the following distros are supported:
154
+
155
+ * centos5-gems
156
+ * fedora13-gems
157
+ * ubuntu10.04-gems
158
+ * ubuntu10.04-apt
159
+
160
+ The gems installations will use RubyGems 1.3.6 and Chef installed as a gem. The apt installation will use the Opscode APT repository. The RubyGems installation requires installing gems with native extensions, so development related packages (ruby-dev, build-essential) are installed. These are not installed with the apt installation, as native extensions are already compiled in the required packages.
161
+
162
+ In addition to handling the software installation, these bootstrap templates do the following:
163
+
164
+ - Write the validation.pem per the local knife configuration.
165
+ - Write a default config file for Chef (`/etc/chef/client.rb`) using values from the `knife.rb`.
166
+ - Create a JSON attributes file containing the specified run list and run Chef.
167
+
168
+ In the case of the RubyGems, the `client.rb` will be written from scratch with a minimal set of values; see __EXAMPLES__. In the case of APT Package installation, `client.rb` will have the `validation_client_name` appended if it is not set to `chef-validator` (default config value), and the `node_name` will be added if `chef_node_name` option is specified.
169
+
170
+ When this is complete, the bootstrapped node will have:
171
+
172
+ - Latest Chef version installed from RubyGems or APT Packages from Opscode. This may be a later version than the local system.
173
+ - Be validated with the configured Chef Server.
174
+ - Have run Chef with its default run list if one is specfied.
175
+
176
+ Additional custom bootstrap templates can be created and stored in `.chef/bootstrap/DISTRO.erb`, replacing __DISTRO__ with the value passed with the `-d` or `--distro` option. See __EXAMPLES__ for more information.
109
177
 
110
178
  ## CLIENT SUB-COMMANDS
111
179
 
@@ -166,11 +234,50 @@ __cookbook bulk delete REGEX__ _(options)_
166
234
 
167
235
  Delete cookbooks on the Chef Server based on a regular expression. The regular expression (_REGEX_) should be in quotes, not in //'s.
168
236
 
237
+ __cookbook create COOKBOOK__ _(options)_
238
+
239
+ * `-o`, `--cookbook-path PATH`:
240
+ The directory where the cookbook will be created
241
+ * `-r`, `--readme-format FORMAT`:
242
+ Format of the README file
243
+ * `-C`, `--copyright COPYRIGHT`:
244
+ Name of Copyright holder
245
+ * `-I`, `--license LICENSE`:
246
+ License for cookbook, apachev2 or none
247
+ * `-E`, `--email EMAIL`:
248
+ Email address of cookbook maintainer
249
+
250
+ This is a helper command that creates a new cookbook directory in the `cookbook_path`. The following directories and files are created for the named cookbook.
251
+
252
+ * COOKBOOK/attributes
253
+ * COOKBOOK/definitions
254
+ * COOKBOOK/files/default
255
+ * COOKBOOK/libraries
256
+ * COOKBOOK/metadata.rb
257
+ * COOKBOOK/providers
258
+ * COOKBOOK/README.rdoc
259
+ * COOKBOOK/recipes/default.rb
260
+ * COOKBOOK/resources
261
+ * COOKBOOK/templates/default
262
+
263
+ Supported README formats are 'rdoc' (default), 'md', 'mkd', 'txt'. The README file will be written with the specified extension and a set of helpful starting headers.
264
+
265
+ Specify `-C` or `--copyright` with the name of the copyright holder as your name or your company/organization name in a quoted string. If this value is not specified an all-caps string `YOUR_COMPANY_NAME` is used which can be easily changed with find/replace.
266
+
267
+ Specify `-I` or `--license` with the license that the cookbook is distributed under for sharing with other people or posting to the Opscode Cookbooks site. Be aware of the licenses of files you put inside the cookbook and follow any restrictions they describe. When using `none` (default) or `apachev2`, comment header text and metadata file are pre-filled. The `none` license will be treated as non-redistributable.
268
+
269
+ Specify `-E` or `--email` with the email address of the cookbook's maintainer. If this value is not specified, an all-caps string `YOUR_EMAIL` is used which can easily be changed with find/replace.
270
+
271
+ The cookbook copyright, license and email settings can be filled in the `knife.rb`, for example with default values:
272
+
273
+ cookbook_copyright "YOUR_COMPANY_NAME"
274
+ cookbook_license "none"
275
+ cookbook_email "YOUR_EMAIL"
276
+
169
277
  __cookbook delete COOKBOOK [VERSION]__ _(options)_
170
278
 
171
279
  * `-a`, `--all`:
172
280
  Delete all versions
173
-
174
281
  * `-p`, `--purge`:
175
282
  Purge files from backing store. This will disable any cookbook that contains any of the same files as the cookbook being purged.
176
283
 
@@ -267,6 +374,21 @@ __cookbook site search QUERY__ _(options)_
267
374
 
268
375
  Searches the Community site with the specified query.
269
376
 
377
+ __cookbook site share COOKBOOK CATEGORY__ _(options)_
378
+
379
+ * `-k`, `--key KEY`:
380
+ API Client Key
381
+ * `-u`, `--user USER`:
382
+ API Client Username
383
+ * `-o`, `--cookbook-path PATH:PATH`:
384
+ A colon-separated path to look for cookbooks in
385
+
386
+ Uploads the specified cookbook using the given category to the Opscode cookbooks site. Requires a login user and certificate for the Opscode Cookbooks site. See __EXAMPLES__ for usage if the Opscode user and certificate pair are not used for authenticating with the Chef Server. In other words, if the Chef Server is not the Opscode Platform.
387
+
388
+ __cookbook site unshare COOKBOOK__
389
+
390
+ Stops sharing the specified cookbook on the Opscode cookbooks site.
391
+
270
392
  __cookbook site show COOKBOOK [VERSION]__ _(options)_
271
393
 
272
394
  Shows information from the site about a particular cookbook.
@@ -276,7 +398,7 @@ __cookbook site vendor COOKBOOK [VERSION]__ _(options)_
276
398
  * `-d`, `--dependencies`:
277
399
  Grab dependencies automatically
278
400
 
279
- Downloads a cookbook and untars it in the cookbooks directory. If _-d_ is specified, all the cookbooks it depends on (via metadata _dependencies_) are downloaded and untarred as well.
401
+ Uses `git` version control in conjunction with the cookbook site to download upstream cookbooks. A new vendor branch is created in git, the cookbook downloaded from the site and untarred, then the master branch is merged. This allows the user to track upstream changes to cookbooks while merging in customizations. If _-d_ is specified, all the cookbooks it depends on (via metadata _dependencies_) are downloaded and untarred as well, each using their own vendor branch.
280
402
 
281
403
  ## DATA BAG SUB-COMMANDS
282
404
 
@@ -361,6 +483,7 @@ __node show NODE__ _(options)_
361
483
  Show a node.
362
484
 
363
485
  ## RECIPE SUB-COMMANDS
486
+
364
487
  __recipe list [PATTERN]__
365
488
 
366
489
  List the recipes available on the server. The results shown can be limited with the optional PATTERN, which is a regular expression. PATTERN should be given in quotes, without slashes.
@@ -406,38 +529,11 @@ Show a specific role.
406
529
 
407
530
  ## CLOUD COMPUTING SUB-COMMANDS
408
531
 
409
- The next sections describe sub-commands to work with various Cloud Computing APIs to launch server instances with validation and run-time configuration that Chef knows about. These sub-commands require the fog Ruby library. On Debian and Ubuntu systems this is the package `libfog-ruby`. It is also available as a RubyGem, `fog`.
410
-
411
- The Rackspace and Terremark sub-commands are early stage of development. Right now when creating instances of these types, knife will assume an Ubuntu image, install Ruby from packages, RubyGems from source and Chef as a RubyGem. As these commands are developed, other installation styles may become available, as options.
412
-
413
- __bootstrap FQDN [RUN LIST...]__ _(options)_
414
-
415
- * `-N`, `--node-name NAME`:
416
- The Chef node name for your new node
417
- * `-P`, `--ssh-password PASSWORD`:
418
- The ssh password
419
- * `-x`, `--ssh-user USERNAME`:
420
- The ssh username
421
- * `--prerelease`:
422
- Install pre-release Chef gems
423
-
424
- Performs a Chef Bootstrap on the target node. This subcommand is used internally by the various cloud computing server create commands. Currently assumes an Ubuntu base OS image and will take the following actions:
532
+ The next sections describe sub-commands to work with various Cloud Computing APIs to launch server instances with validation and run-time configuration that Chef knows about. These sub-commands require the fog Ruby library. On Debian and Ubuntu systems with Opscode's apt repository (apt.opscode.com), this is the package `libfog-ruby`. It is also available as a RubyGem, `fog`.
425
533
 
426
- - Updates APT cache.
427
- - Installs Ruby and packages required to build RubyGems with native extensions.
428
- - Installs RubyGems 1.3.6 **from source**.
429
- - Installs Chef and Ohai RubyGems.
430
- - Writes the validation.pem per the local knife configuration.
431
- - Writes a default config file for Chef.
432
- - Creates a JSON attributes file containing the node's run list and runs Chef.
534
+ The Rackspace and Terremark server creation sub-commands are at an early stage of development. They do not yet use the `bootstrap` sub-command to install Chef, and make a few assumptions to be aware. Right now when creating instances of these types, knife will assume an Ubuntu image, install Ruby from packages, RubyGems from source and Chef as a RubyGem. As these commands are developed further, they will utilize the `bootstrap` sub-command.
433
535
 
434
- When this is complete, the bootstrapped node will have:
435
-
436
- - Latest Chef version installed from RubyGems.
437
- - Be validated with the configured Chef Server.
438
- - Have run Chef with its default run list.
439
-
440
- Future versions of this sub-command will support performing Chef Bootstrap on other platforms.
536
+ In order to use knife with the various __CLOUD COMPUTING SUB-COMMANDS__, credentials need to be added to the configuration file. See __CONFIGURATION__.
441
537
 
442
538
  ## EC2 SUB-COMMANDS
443
539
 
@@ -454,6 +550,8 @@ __ec2 server create [RUN LIST...]__ _(options)_
454
550
 
455
551
  * `-Z`, `--availability-zone ZONE`:
456
552
  The Availability Zone
553
+ * `--region`:
554
+ Your AWS region
457
555
  * `-A`, `--aws-access-key-id KEY `:
458
556
  Your AWS Access Key ID
459
557
  * `-K SECRET`, `--aws-secret-access-key`:
@@ -462,16 +560,24 @@ __ec2 server create [RUN LIST...]__ _(options)_
462
560
  The flavor of server (m1.small, m1.medium, etc)
463
561
  * `-i`, `--image IMAGE`:
464
562
  The AMI for the server
465
- * `--prerelease`:
466
- Install the pre-release chef gems
467
563
  * `-G`, `--groups X,Y,Z `:
468
564
  The security groups for this server
469
565
  * `-S`, `--ssh-key KEY `:
470
- The SSH root key
566
+ The SSH root key, corresponds to an Amazon Keypair.
567
+ * `-I`, `--identity-file IDENTITY_FILE`:
568
+ The SSH identity file used for authentication, passed to `bootstrap`.
569
+ * `-P`, `--ssh-password PASSWORD`:
570
+ The ssh password, passed to `bootstrap`.
471
571
  * `-x`, `--ssh-user USERNAME`:
472
- The ssh username
572
+ The ssh username, passed to `bootstrap`.
573
+ * `--prerelease`:
574
+ Install pre-release Chef gems, passed to `bootstrap`.
575
+ * `--template-file TEMPLATE`:
576
+ Full path to location of template to use, passed to `bootstrap`.
577
+ * `-d`, `--distro DISTRO`:
578
+ Bootstrap a distro using a template, passed to `bootstrap`.
473
579
 
474
- Creates a new Amazon AWS EC2 instance.
580
+ Creates a new Amazon AWS EC2 instance and bootstraps it by calling the `bootstrap` sub-command. The `[RUN LIST...]` items are passed to the bootstrap's `run_list` config parameter/option. See the __BOOTSTRAP SUB-COMMANDS__ section above for more information.
475
581
 
476
582
  __ec2 server delete SERVER [SERVER]__ _(options)_
477
583
 
@@ -518,6 +624,34 @@ __rackspace server list__ _(options)_
518
624
 
519
625
  Lists running Rackspace Cloud servers.
520
626
 
627
+ ## SLICEHOST SUB-COMMANDS
628
+
629
+ As above, Chef can also be used on Slicehost nodes. The following sub-commands allow manipulating Slicehost nodes via the `fog` library.
630
+
631
+ __slicehost server create [RUN LIST...]__ _(options)_
632
+ * `-f`, `--flavor FLAVOR`:
633
+ The flavor of server
634
+ * `-i`, `--image IMAGE`:
635
+ The image of the server
636
+ * `-N`, `--server-name NAME`:
637
+ The server name
638
+ * `-K`, `--slicehost-password PASSWORD`:
639
+ Your slicehost API password
640
+
641
+ Creates a new slicehost server.
642
+
643
+ __slicehost server list__ _(options)_
644
+
645
+ Lists running Slicehost servers.
646
+
647
+ __slicehost server delete SLICENAME__
648
+
649
+ Deletes a running Slicehost server.
650
+
651
+ __slicehost images list__
652
+
653
+ Lists the available Slicehost server images to boot.
654
+
521
655
  ## TERREMARK SUB-COMMANDS
522
656
 
523
657
  As above, Chef can also be used on Terremark vCloud nodes. The following sub-commands allow manipulating Terremark vCloud nodes via the `fog` library.
@@ -595,12 +729,83 @@ Specifies the name of the client used to validate new clients. This is requested
595
729
 
596
730
  Specifies the private key file to use for generating ec2 instance data for validating new clients. This is implied from the `validation_client_name`.
597
731
 
732
+ `cookbook_copyright`
733
+ `cookbook_email`
734
+ `cookbook_license`
735
+
736
+ Used by `knife cookbook create` sub-command to specify the copyright holder, maintainer email and license (respectively) for new cookbooks. The copyright holder is listed as the maintainer in the cookbook's metadata and as the Copyright in the comments of the default recipe. The maintainer email is used in the cookbook metadata. The license determines what preamble to put in the comment of the default recipe, and is listed as the license in the cookbook metadata. Currently supported licenses are "apachev2" and "none". Any other values will result in an empty license in the metadata (needs to be filled in by the author), and no comment preamble in the default recipe.
737
+
738
+ `knife[:aws_access_key_id]`
739
+ `knife[:aws_secret_access_key]`
740
+
741
+ Specifies the Amazon AWS EC2 credentials to use when running the ec2 sub-commands.
742
+
743
+ `knife[:rackspace_api_username]`
744
+ `knife[:rackspace_api_key]`
745
+
746
+ Specifies the Rackspace Cloud credentials to use when running the rackspace sub-commands.
747
+
748
+ `knife[:terremark_username]`
749
+ `knife[:terremark_password]`
750
+ `knife[:terremark_service]`
751
+
752
+ Specifies the Terremark vCloud credentials to use when running the terremark sub-commands.
753
+
754
+ `knife[:slicehost_password]`
755
+
756
+ Specifies the Slicehost password to use when running the slicdehost sub-commands.
757
+
598
758
  ## FILES
599
759
 
600
760
  _~/.chef/knife.rb_
601
761
 
602
762
  Ruby DSL configuration file for knife. See __CONFIGURATION__.
603
763
 
764
+ ## CHEF WORKFLOW
765
+
766
+ When working with Chef and Knife in the local repository, the recommended workflow outline looks like:
767
+
768
+ * Create repository. A skeleton sample is provided at _http://github.com/opscode/chef-repo/_.
769
+ * Configure knife, see __CONFIGURATION__.
770
+ * Download cookbooks from the Opscode cookbooks site, see __COOKBOOK SITE SUB-COMMANDS__.
771
+ * Or, create new cookbooks, see `cookbook create` sub-command.
772
+ * Commit changes to the version control system. See your tool's documentation.
773
+ * Upload cookbooks to the Chef Server, see __COOKBOOK SUB-COMMANDS__.
774
+ * Launch instances in the Cloud, OR provision new hosts; see __CLOUD COMPUTING SUB-COMMANDS__ and __BOOTSTRAP SUB-COMMANDS__.
775
+ * Watch Chef configure systems!
776
+
777
+ A note about git: Opscode and many folks in the Chef community use git, but it is not required, except in the case of the `cookbook site vendor` sub-command, as it uses git directly. Version control is strongly recommended though, and git fits with a lot of the workflow paradigms.
778
+
779
+ ## EXAMPLES
780
+
781
+ Example client config (`/etc/chef/client.rb`) from `knife configure client`. The same configuration is used when using the `knife bootstrap` command with the default `gem` templates that come with Chef.
782
+
783
+ log_level :info
784
+ log_location STDOUT
785
+ chef_server_url 'https://api.opscode.com/organizations/ORGNAME'
786
+ validation_client_name 'ORGNAME-validator'
787
+
788
+ Setting up a custom bootstrap is fairly straightforward. Create `.chef/bootstrap` in your Chef Repository directory or in `$HOME/.chef/bootstrap`. Then create the ERB template file.
789
+
790
+ mkdir ~/.chef/bootstrap
791
+ vi ~/.chef/bootstrap/debian5.0-apt.erb
792
+
793
+ For example, to create a new bootstrap template that should be used when setting up a new Debian node. Edit the template to run the commands, set up the validation certificate and the client configuration file, and finally to run chef-client on completion. The bootstrap template can be called with:
794
+
795
+ knife bootstrap mynode.example.com --template-file ~/.chef/bootstrap/debian5.0-apt.erb
796
+
797
+ Or,
798
+
799
+ knife bootstrap mynode.example.com --distro debian5.0-apt
800
+
801
+ The `--distro` parameter will automatically look in the `~/.chef/bootstrap` directory for a file named `debian5.0-apt.erb`.
802
+
803
+ Templates provided by the Chef installation are located in `BASEDIR/lib/chef/knife/bootstrap/*.erb`, where _BASEDIR_ is the location where the package or Gem installed the Chef client libraries.
804
+
805
+ Uploading cookbooks to the Opscode cookbooks site using the user/certificate specifically:
806
+
807
+ knife cookbook site share example Other -k ~/.chef/USERNAME.pem -u USERNAME
808
+
604
809
  ## SEE ALSO
605
810
 
606
811
  Full documentation for Chef is located on the Chef wiki, http://wiki.opscode.com/display/chef/Home/.
@@ -609,6 +814,8 @@ JSON is JavaScript Object Notation and more information can be found at http://j
609
814
 
610
815
  SOLR is an open source search engine. The Chef Server includes a SOLR installation. More information about SOLR, including the search query syntax, can be found at http://lucene.apache.org/solr/.
611
816
 
817
+ Git is a version control system and documented at http://git-scm.com/.
818
+
612
819
  This manual page was generated in nroff from Markdown with ronn. Ryan Tomayko wrote ronn and more information can be found at http://rtomayko.github.com/ronn/ronn.5.html.
613
820
 
614
821
  ## AUTHOR
@@ -89,6 +89,10 @@ class Chef::Application::Knife < Chef::Application
89
89
  :long => "--yes",
90
90
  :description => "Say yes to all prompts for confirmation"
91
91
 
92
+ option :defaults,
93
+ :long => "--defaults",
94
+ :description => "Accept default values for all questions"
95
+
92
96
  option :print_after,
93
97
  :short => "-p",
94
98
  :long => "--print-after",
@@ -129,11 +129,11 @@ class Chef
129
129
 
130
130
  def self.list(inflate=false)
131
131
  if inflate
132
- response = Hash.new
133
- Chef::Search::Query.new.search(:data) do |n|
134
- response[n.name] = n
132
+ # Can't search for all data bags like other objects, fall back to N+1 :(
133
+ list(false).inject({}) do |response, bag_and_uri|
134
+ response[bag_and_uri.first] = load(bag_and_uri.first)
135
+ response
135
136
  end
136
- response
137
137
  else
138
138
  Chef::REST.new(Chef::Config[:chef_server_url]).get_rest("data")
139
139
  end
@@ -211,7 +211,15 @@ class Chef
211
211
 
212
212
  # As a string
213
213
  def to_s
214
- "data_bag_item[#{@name}]"
214
+ "data_bag_item[#{id}]"
215
+ end
216
+
217
+ def pretty_print(pretty_printer)
218
+ pretty_printer.pp({"data_bag_item('#{data_bag}', '#{id}')" => self.to_hash})
219
+ end
220
+
221
+ def id
222
+ @raw_data['id']
215
223
  end
216
224
 
217
225
  end