chef 0.9.12 → 0.9.14.beta.1
Sign up to get free protection for your applications and to get access to all the features.
- data/distro/arch/etc/conf.d/chef-client.conf +5 -0
- data/distro/arch/etc/conf.d/chef-server-webui.conf +10 -0
- data/distro/arch/etc/conf.d/chef-server.conf +10 -0
- data/distro/arch/etc/conf.d/chef-solr-indexer.conf +8 -0
- data/distro/arch/etc/conf.d/chef-solr.conf +8 -0
- data/distro/arch/etc/rc.d/chef-client +76 -0
- data/distro/arch/etc/rc.d/chef-server +82 -0
- data/distro/arch/etc/rc.d/chef-server-webui +82 -0
- data/distro/arch/etc/rc.d/chef-solr +82 -0
- data/distro/arch/etc/rc.d/chef-solr-indexer +82 -0
- data/distro/common/markdown/knife.mkd +34 -1
- data/distro/debian/etc/default/chef-solr +1 -0
- data/distro/debian/etc/init.d/chef-client +1 -1
- data/distro/debian/etc/init.d/chef-solr +39 -40
- data/distro/debian/etc/init.d/chef-solr-indexer +1 -1
- data/distro/redhat/etc/init.d/chef-client +1 -1
- data/lib/chef.rb +1 -0
- data/lib/chef/api_client.rb +1 -1
- data/lib/chef/application/agent.rb +1 -1
- data/lib/chef/application/client.rb +1 -1
- data/lib/chef/application/solo.rb +1 -1
- data/lib/chef/cookbook/metadata.rb +2 -2
- data/lib/chef/cookbook/syntax_check.rb +1 -1
- data/lib/chef/cookbook_version.rb +5 -1
- data/lib/chef/couchdb.rb +1 -1
- data/lib/chef/data_bag.rb +1 -1
- data/lib/chef/data_bag_item.rb +35 -9
- data/lib/chef/exceptions.rb +2 -0
- data/lib/chef/file_cache.rb +1 -1
- data/lib/chef/handler/json_file.rb +1 -1
- data/lib/chef/index_queue/amqp_client.rb +2 -2
- data/lib/chef/index_queue/consumer.rb +2 -2
- data/lib/chef/json.rb +52 -0
- data/lib/chef/knife.rb +6 -6
- data/lib/chef/knife/bluebox_images_list.rb +54 -0
- data/lib/chef/knife/bluebox_server_create.rb +157 -0
- data/lib/chef/knife/bluebox_server_delete.rb +63 -0
- data/lib/chef/knife/bluebox_server_list.rb +59 -0
- data/lib/chef/knife/bootstrap.rb +3 -1
- data/lib/chef/knife/bootstrap/archlinux-gems.erb +2 -2
- data/lib/chef/knife/bootstrap/centos5-gems.erb +2 -2
- data/lib/chef/knife/bootstrap/fedora13-gems.erb +1 -1
- data/lib/chef/knife/client_bulk_delete.rb +1 -1
- data/lib/chef/knife/client_create.rb +1 -1
- data/lib/chef/knife/client_delete.rb +1 -1
- data/lib/chef/knife/client_edit.rb +1 -1
- data/lib/chef/knife/client_list.rb +1 -1
- data/lib/chef/knife/client_reregister.rb +1 -1
- data/lib/chef/knife/client_show.rb +1 -1
- data/lib/chef/knife/cookbook_create.rb +1 -1
- data/lib/chef/knife/cookbook_list.rb +1 -1
- data/lib/chef/knife/cookbook_metadata.rb +1 -1
- data/lib/chef/knife/cookbook_show.rb +10 -18
- data/lib/chef/knife/cookbook_site_share.rb +1 -1
- data/lib/chef/knife/cookbook_site_vendor.rb +17 -11
- data/lib/chef/knife/ec2_instance_data.rb +1 -1
- data/lib/chef/knife/ec2_server_create.rb +8 -6
- data/lib/chef/knife/ec2_server_delete.rb +5 -8
- data/lib/chef/knife/ec2_server_list.rb +5 -4
- data/lib/chef/knife/exec.rb +1 -1
- data/lib/chef/knife/node_bulk_delete.rb +1 -1
- data/lib/chef/knife/node_create.rb +1 -1
- data/lib/chef/knife/node_delete.rb +1 -1
- data/lib/chef/knife/node_edit.rb +1 -1
- data/lib/chef/knife/node_from_file.rb +2 -2
- data/lib/chef/knife/node_list.rb +1 -1
- data/lib/chef/knife/node_run_list_add.rb +1 -1
- data/lib/chef/knife/node_run_list_remove.rb +1 -1
- data/lib/chef/knife/node_show.rb +1 -1
- data/lib/chef/knife/rackspace_server_create.rb +98 -70
- data/lib/chef/knife/rackspace_server_delete.rb +2 -2
- data/lib/chef/knife/rackspace_server_list.rb +2 -2
- data/lib/chef/knife/role_bulk_delete.rb +1 -1
- data/lib/chef/knife/role_create.rb +1 -1
- data/lib/chef/knife/role_delete.rb +1 -1
- data/lib/chef/knife/role_edit.rb +1 -1
- data/lib/chef/knife/role_from_file.rb +2 -2
- data/lib/chef/knife/role_list.rb +1 -1
- data/lib/chef/knife/role_show.rb +1 -1
- data/lib/chef/knife/slicehost_images_list.rb +2 -2
- data/lib/chef/knife/slicehost_server_create.rb +2 -2
- data/lib/chef/knife/slicehost_server_delete.rb +2 -2
- data/lib/chef/knife/slicehost_server_list.rb +2 -2
- data/lib/chef/knife/ssh.rb +36 -12
- data/lib/chef/knife/status.rb +1 -1
- data/lib/chef/knife/terremark_server_create.rb +1 -1
- data/lib/chef/knife/terremark_server_delete.rb +1 -1
- data/lib/chef/knife/terremark_server_list.rb +1 -1
- data/lib/chef/log.rb +31 -4
- data/lib/chef/mixin/command.rb +1 -1
- data/lib/chef/mixin/create_path.rb +1 -1
- data/lib/chef/mixin/recipe_definition_dsl_core.rb +1 -1
- data/lib/chef/monkey_patches/numeric.rb +7 -0
- data/lib/chef/node.rb +6 -8
- data/lib/chef/node/attribute.rb +24 -2
- data/lib/chef/openid_registration.rb +1 -1
- data/lib/chef/platform.rb +11 -0
- data/lib/chef/provider/breakpoint.rb +1 -1
- data/lib/chef/provider/cookbook_file.rb +1 -1
- data/lib/chef/provider/deploy/revision.rb +1 -1
- data/lib/chef/provider/deploy/timestamped.rb +1 -1
- data/lib/chef/provider/erl_call.rb +14 -2
- data/lib/chef/provider/git.rb +79 -55
- data/lib/chef/provider/group/pw.rb +1 -1
- data/lib/chef/provider/package/easy_install.rb +35 -13
- data/lib/chef/provider/service/debian.rb +65 -40
- data/lib/chef/provider/service/insserv.rb +52 -0
- data/lib/chef/provider/service/windows.rb +74 -57
- data/lib/chef/provider/subversion.rb +45 -10
- data/lib/chef/provider/user/pw.rb +1 -1
- data/lib/chef/providers.rb +1 -0
- data/lib/chef/resource/deploy_revision.rb +1 -1
- data/lib/chef/resource/easy_install_package.rb +16 -0
- data/lib/chef/resource/file.rb +8 -1
- data/lib/chef/resource_collection/stepable_iterator.rb +1 -1
- data/lib/chef/rest.rb +7 -7
- data/lib/chef/role.rb +2 -2
- data/lib/chef/run_status.rb +1 -1
- data/lib/chef/shef.rb +2 -2
- data/lib/chef/shef/ext.rb +2 -2
- data/lib/chef/shef/model_wrapper.rb +1 -1
- data/lib/chef/shef/shef_rest.rb +1 -1
- data/lib/chef/shef/shef_session.rb +13 -5
- data/lib/chef/tasks/chef_repo.rake +1 -1
- data/lib/chef/version.rb +1 -1
- data/lib/chef/webui_user.rb +1 -1
- metadata +329 -290
@@ -538,10 +538,43 @@ Show a specific role.
|
|
538
538
|
|
539
539
|
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`.
|
540
540
|
|
541
|
-
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.
|
541
|
+
The Blue Box, 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.
|
542
542
|
|
543
543
|
In order to use knife with the various __CLOUD COMPUTING SUB-COMMANDS__, credentials need to be added to the configuration file. See __CONFIGURATION__.
|
544
544
|
|
545
|
+
## BLUE BOX SUB-COMMANDS
|
546
|
+
|
547
|
+
__bluebox server create [RUN LIST...]__ _(options)_
|
548
|
+
|
549
|
+
* `-f`, `--flavor FLAVOR`:
|
550
|
+
This is the product type (Block size) you're requesting to deploy. Requires the UUID of the image.
|
551
|
+
|
552
|
+
* `-i`, `--image IMAGE`:
|
553
|
+
The image (or OS distribution) to deploy. This can be a pre-built Blue Box template, or this can be a template you've archived previously. Requires the UUID of the image.
|
554
|
+
|
555
|
+
* `-U`, `--username USERNAME`:
|
556
|
+
Username created on the deployed server. Defaults to "deploy".
|
557
|
+
|
558
|
+
* `-P`, `--password PASSWORD`:
|
559
|
+
Password installed for the created user on the deployed server. Can be bypassed by defining a SSH key in your knife configuration ( Chef::Config[:knife][:ssh_key] ).
|
560
|
+
|
561
|
+
* `--bootstrap true/false`:
|
562
|
+
Allows you to enable or disable the bootstrap process.
|
563
|
+
|
564
|
+
Creates a new Blue Box Group Blocks instance and bootstraps it by checking out a github repo and installs a bare minimum installation of chef on the instance; it then executes the specified run list.
|
565
|
+
|
566
|
+
__bluebox server delete BLOCK-HOSTNAME__
|
567
|
+
|
568
|
+
Deletes a running Blue Box Group Blocks server.
|
569
|
+
|
570
|
+
__bluebox server list__
|
571
|
+
|
572
|
+
Lists running Blue Box Group Blocks servers.
|
573
|
+
|
574
|
+
__bluebox images list__
|
575
|
+
|
576
|
+
Lists the available Blue Box Group Blocks server images to boot.
|
577
|
+
|
545
578
|
## EC2 SUB-COMMANDS
|
546
579
|
|
547
580
|
Chef is commonly used with Amazon AWS EC2 nodes. This sub-command will generate instance metadata that can be used to automatically configure an EC2 instance with Chef. This requires an AMI that has Chef preinstalled with a configuration file that can parse the metadata at run-time. At this time this is the only sub-command for EC2, but more may be added later similar to __RACKSPACE__ and __TERREMARK__ below.
|
@@ -15,7 +15,7 @@
|
|
15
15
|
# description: starts up chef-solr in daemon mode.
|
16
16
|
|
17
17
|
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
|
18
|
-
DAEMON=/usr/
|
18
|
+
DAEMON=/usr/bin/chef-solr
|
19
19
|
DAEMON_NAME=java
|
20
20
|
NAME=chef-solr
|
21
21
|
DESC=chef-solr
|
@@ -32,57 +32,57 @@ if [ ! -d /var/run/chef ]; then
|
|
32
32
|
chown $USER:$GROUP /var/run/chef
|
33
33
|
fi
|
34
34
|
|
35
|
+
if [ ! -f $LOGFILE ]; then
|
36
|
+
touch $LOGFILE
|
37
|
+
chown $USER:$GROUP $LOGFILE
|
38
|
+
fi
|
39
|
+
|
35
40
|
DAEMON_OPTS="-d -P $PIDFILE -c $CONFIG -L $LOGFILE -u $USER -g $GROUP"
|
36
41
|
|
37
|
-
running_pid() {
|
42
|
+
running_pid() {
|
38
43
|
pid=$1
|
39
|
-
name=$2
|
40
|
-
[ -z "$pid" ] && return 1
|
41
|
-
[ ! -d /proc/$pid ] && return 1
|
44
|
+
name=$2
|
45
|
+
[ -z "$pid" ] && return 1
|
46
|
+
[ ! -d /proc/$pid ] && return 1
|
42
47
|
cmd=`cat /proc/$pid/cmdline | tr '\000' '\n' | head -1`
|
43
|
-
[ "$cmd" != "$name" ] && return 1
|
44
|
-
return 0
|
45
|
-
}
|
48
|
+
[ "$cmd" != "$name" ] && return 1
|
49
|
+
return 0
|
50
|
+
}
|
46
51
|
|
47
|
-
running() {
|
52
|
+
running() {
|
48
53
|
[ ! -f "$PIDFILE" ] && return 1
|
49
54
|
pid=`cat $PIDFILE`
|
50
|
-
running_pid $pid $DAEMON_NAME || return 1
|
55
|
+
running_pid $pid $DAEMON_NAME || return 1
|
51
56
|
return 0
|
52
|
-
}
|
57
|
+
}
|
53
58
|
|
54
|
-
start_server() {
|
55
|
-
|
56
|
-
start_daemon -p $PIDFILE $DAEMON $DAEMON_OPTS
|
59
|
+
start_server() {
|
60
|
+
start_daemon -p $PIDFILE $DAEMON $DAEMON_OPTS
|
57
61
|
errcode=$?
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
62
|
+
for i in `seq 0 $MAXTRIES`
|
63
|
+
do
|
64
|
+
if running; then
|
65
|
+
errcode=0
|
66
|
+
break
|
67
|
+
else
|
68
|
+
[ -n "$STARTTIME" ] && sleep $STARTTIME
|
69
|
+
fi
|
70
|
+
done
|
71
|
+
return $errcode
|
72
|
+
}
|
66
73
|
|
67
|
-
stop_server() {
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
start-stop-daemon --stop --quiet --pidfile $PIDFILE \
|
73
|
-
--user $DAEMONUSER \
|
74
|
-
--exec $DAEMON
|
75
|
-
errcode=$?
|
76
|
-
fi
|
77
|
-
return $errcode
|
78
|
-
}
|
74
|
+
stop_server() {
|
75
|
+
killproc -p $PIDFILE $DAEMON
|
76
|
+
errcode=$?
|
77
|
+
return $errcode
|
78
|
+
}
|
79
79
|
|
80
|
-
reload_server() {
|
81
|
-
[ ! -f "$PIDFILE" ] && return 1
|
82
|
-
pid=pidofproc $PIDFILE # This is the daemon's pid
|
80
|
+
reload_server() {
|
81
|
+
[ ! -f "$PIDFILE" ] && return 1
|
82
|
+
pid=pidofproc $PIDFILE # This is the daemon's pid
|
83
83
|
/bin/kill -1 $pid
|
84
84
|
return $?
|
85
|
-
}
|
85
|
+
}
|
86
86
|
|
87
87
|
force_stop() {
|
88
88
|
[ ! -e "$PIDFILE" ] && return
|
@@ -110,7 +110,7 @@ case "$1" in
|
|
110
110
|
exit 3
|
111
111
|
fi
|
112
112
|
if start_server ; then
|
113
|
-
[ -n "$STARTTIME" ] && sleep $STARTTIME # Wait some time
|
113
|
+
[ -n "$STARTTIME" ] && sleep $STARTTIME # Wait some time
|
114
114
|
if running ; then
|
115
115
|
log_end_msg 0
|
116
116
|
else
|
@@ -174,4 +174,3 @@ case "$1" in
|
|
174
174
|
esac
|
175
175
|
|
176
176
|
exit 0
|
177
|
-
|
@@ -15,7 +15,7 @@
|
|
15
15
|
# description: starts up chef-solr-indexer in daemon mode.
|
16
16
|
|
17
17
|
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
|
18
|
-
DAEMON=/usr/
|
18
|
+
DAEMON=/usr/bin/chef-solr-indexer
|
19
19
|
NAME=chef-solr-indexer
|
20
20
|
DESC=chef-solr-indexer
|
21
21
|
PIDFILE=/var/run/chef/solr-indexer.pid
|
@@ -35,7 +35,7 @@ start() {
|
|
35
35
|
[ -x $exec ] || exit 5
|
36
36
|
[ -f $config ] || exit 6
|
37
37
|
echo -n $"Starting $prog: "
|
38
|
-
daemon chef-client -d -c "$config" -L "$logfile" -
|
38
|
+
daemon chef-client -d -c "$config" -L "$logfile" -P "$pidfile" -i "$interval" -s "$splay" "$options"
|
39
39
|
retval=$?
|
40
40
|
echo
|
41
41
|
[ $retval -eq 0 ] && touch $lockfile
|
data/lib/chef.rb
CHANGED
data/lib/chef/api_client.rb
CHANGED
@@ -181,7 +181,7 @@ class Chef::Application::Client < Chef::Application
|
|
181
181
|
end
|
182
182
|
|
183
183
|
begin
|
184
|
-
@chef_client_json = JSON.
|
184
|
+
@chef_client_json = Chef::JSON.from_json(json_io.read)
|
185
185
|
json_io.close unless json_io.closed?
|
186
186
|
rescue JSON::ParserError => error
|
187
187
|
Chef::Application.fatal!("Could not parse the provided JSON file (#{Chef::Config[:json_attribs]})!: " + error.message, 2)
|
@@ -145,7 +145,7 @@ class Chef::Application::Solo < Chef::Application
|
|
145
145
|
end
|
146
146
|
|
147
147
|
begin
|
148
|
-
@chef_solo_json = JSON.
|
148
|
+
@chef_solo_json = Chef::JSON.from_json(json_io.read)
|
149
149
|
json_io.close unless json_io.closed?
|
150
150
|
rescue JSON::ParserError => error
|
151
151
|
Chef::Application.fatal!("Could not parse the provided JSON file (#{Chef::Config[:json_attribs]})!: " + error.message, 2)
|
@@ -430,12 +430,12 @@ class Chef
|
|
430
430
|
end
|
431
431
|
|
432
432
|
def self.from_json(string)
|
433
|
-
o = JSON.
|
433
|
+
o = Chef::JSON.from_json(string)
|
434
434
|
self.from_hash(o)
|
435
435
|
end
|
436
436
|
|
437
437
|
def from_json(string)
|
438
|
-
o = JSON.
|
438
|
+
o = Chef::JSON.from_json(string)
|
439
439
|
from_hash(o)
|
440
440
|
end
|
441
441
|
|
@@ -24,6 +24,7 @@ require 'chef/node'
|
|
24
24
|
require 'chef/resource_definition_list'
|
25
25
|
require 'chef/recipe'
|
26
26
|
require 'chef/cookbook/file_vendor'
|
27
|
+
require 'chef/checksum'
|
27
28
|
|
28
29
|
class Chef
|
29
30
|
# == Chef::CookbookVersion
|
@@ -809,7 +810,10 @@ class Chef
|
|
809
810
|
# checksum documents
|
810
811
|
def purge
|
811
812
|
checksums.keys.each do |checksum|
|
812
|
-
|
813
|
+
begin
|
814
|
+
Chef::Checksum.cdb_load(checksum, couchdb).purge
|
815
|
+
rescue Chef::Exceptions::CouchDBNotFound
|
816
|
+
end
|
813
817
|
end
|
814
818
|
cdb_destroy
|
815
819
|
end
|
data/lib/chef/couchdb.rb
CHANGED
data/lib/chef/data_bag.rb
CHANGED
data/lib/chef/data_bag_item.rb
CHANGED
@@ -18,6 +18,8 @@
|
|
18
18
|
# limitations under the License.
|
19
19
|
#
|
20
20
|
|
21
|
+
require 'forwardable'
|
22
|
+
|
21
23
|
require 'chef/config'
|
22
24
|
require 'chef/mixin/params_validate'
|
23
25
|
require 'chef/mixin/from_file'
|
@@ -25,10 +27,12 @@ require 'chef/couchdb'
|
|
25
27
|
require 'chef/index_queue'
|
26
28
|
require 'chef/data_bag'
|
27
29
|
require 'extlib'
|
28
|
-
require 'json'
|
30
|
+
require 'chef/json'
|
29
31
|
|
30
32
|
class Chef
|
31
33
|
class DataBagItem
|
34
|
+
|
35
|
+
extend Forwardable
|
32
36
|
|
33
37
|
include Chef::Mixin::FromFile
|
34
38
|
include Chef::Mixin::ParamsValidate
|
@@ -59,6 +63,9 @@ class Chef
|
|
59
63
|
}
|
60
64
|
}
|
61
65
|
|
66
|
+
# Define all Hash's instance methods as delegating to @raw_data
|
67
|
+
def_delegators(:@raw_data, *(Hash.instance_methods - Object.instance_methods))
|
68
|
+
|
62
69
|
attr_accessor :couchdb_rev, :couchdb_id, :couchdb
|
63
70
|
attr_reader :raw_data
|
64
71
|
|
@@ -134,7 +141,13 @@ class Chef
|
|
134
141
|
result["_rev"] = @couchdb_rev if @couchdb_rev
|
135
142
|
result.to_json(*a)
|
136
143
|
end
|
137
|
-
|
144
|
+
|
145
|
+
def self.from_hash(h)
|
146
|
+
item = new
|
147
|
+
item.raw_data = h
|
148
|
+
item
|
149
|
+
end
|
150
|
+
|
138
151
|
# Create a Chef::DataBagItem from JSON
|
139
152
|
def self.json_create(o)
|
140
153
|
bag_item = new
|
@@ -156,11 +169,6 @@ class Chef
|
|
156
169
|
bag_item
|
157
170
|
end
|
158
171
|
|
159
|
-
# The Data Bag Item behaves like a hash - we pass all that stuff along to @raw_data.
|
160
|
-
def method_missing(method_symbol, *args, &block)
|
161
|
-
self.raw_data.send(method_symbol, *args, &block)
|
162
|
-
end
|
163
|
-
|
164
172
|
# Load a Data Bag Item by name from CouchDB
|
165
173
|
def self.cdb_load(data_bag, name, couchdb=nil)
|
166
174
|
(couchdb || Chef::CouchDB.new).load("data_bag_item", object_name(data_bag, name))
|
@@ -168,7 +176,14 @@ class Chef
|
|
168
176
|
|
169
177
|
# Load a Data Bag Item by name via RESTful API
|
170
178
|
def self.load(data_bag, name)
|
171
|
-
Chef::REST.new(Chef::Config[:chef_server_url]).get_rest("data/#{data_bag}/#{name}")
|
179
|
+
item = Chef::REST.new(Chef::Config[:chef_server_url]).get_rest("data/#{data_bag}/#{name}")
|
180
|
+
if item.kind_of?(DataBagItem)
|
181
|
+
item
|
182
|
+
else
|
183
|
+
item = from_hash(item)
|
184
|
+
item.data_bag(data_bag)
|
185
|
+
item
|
186
|
+
end
|
172
187
|
end
|
173
188
|
|
174
189
|
# Remove this Data Bag Item from CouchDB
|
@@ -208,12 +223,23 @@ class Chef
|
|
208
223
|
def self.create_design_document(couchdb=nil)
|
209
224
|
(couchdb || Chef::CouchDB.new).create_design_document("data_bag_items", DESIGN_DOCUMENT)
|
210
225
|
end
|
211
|
-
|
226
|
+
|
227
|
+
def ==(other)
|
228
|
+
other.respond_to?(:to_hash) &&
|
229
|
+
other.respond_to?(:data_bag) &&
|
230
|
+
(other.to_hash == to_hash) &&
|
231
|
+
(other.data_bag.to_s == data_bag.to_s)
|
232
|
+
end
|
233
|
+
|
212
234
|
# As a string
|
213
235
|
def to_s
|
214
236
|
"data_bag_item[#{id}]"
|
215
237
|
end
|
216
238
|
|
239
|
+
def inspect
|
240
|
+
"data_bag_item[#{data_bag.inspect}, #{raw_data['id'].inspect}, #{raw_data.inspect}]"
|
241
|
+
end
|
242
|
+
|
217
243
|
def pretty_print(pretty_printer)
|
218
244
|
pretty_printer.pp({"data_bag_item('#{data_bag}', '#{id}')" => self.to_hash})
|
219
245
|
end
|
data/lib/chef/exceptions.rb
CHANGED
@@ -62,5 +62,7 @@ class Chef
|
|
62
62
|
class InvalidResourceSpecification < ArgumentError; end
|
63
63
|
class SolrConnectionError < RuntimeError; end
|
64
64
|
class IllegalChecksumRevert < RuntimeError; end
|
65
|
+
class MissingParentDirectory < RuntimeError; end
|
66
|
+
class UnresolvableGitReference < RuntimeError; end
|
65
67
|
end
|
66
68
|
end
|
data/lib/chef/file_cache.rb
CHANGED
@@ -41,7 +41,7 @@ class Chef
|
|
41
41
|
build_report_dir
|
42
42
|
savetime = Time.now.strftime("%Y%m%d%H%M%S")
|
43
43
|
File.open(File.join(config[:path], "chef-run-report-#{savetime}.json"), "w") do |file|
|
44
|
-
file.puts JSON.
|
44
|
+
file.puts Chef::JSON.to_json_pretty(data)
|
45
45
|
end
|
46
46
|
end
|
47
47
|
|
@@ -76,7 +76,7 @@ class Chef
|
|
76
76
|
def send_action(action, data)
|
77
77
|
retries = 0
|
78
78
|
begin
|
79
|
-
exchange.publish({"action" => action.to_s, "payload" => data}
|
79
|
+
exchange.publish(Chef::JSON.to_json({"action" => action.to_s, "payload" => data}))
|
80
80
|
rescue Bunny::ServerDownError, Bunny::ConnectionError, Errno::ECONNRESET
|
81
81
|
disconnected!
|
82
82
|
if (retries += 1) < 2
|
@@ -110,4 +110,4 @@ class Chef
|
|
110
110
|
|
111
111
|
end
|
112
112
|
end
|
113
|
-
end
|
113
|
+
end
|
@@ -56,7 +56,7 @@ class Chef
|
|
56
56
|
alias :start :run
|
57
57
|
|
58
58
|
def call_action_for_message(message)
|
59
|
-
amqp_payload = JSON.
|
59
|
+
amqp_payload = Chef::JSON.from_json(message[:payload], :create_additions => false, :max_nesting => false)
|
60
60
|
action = amqp_payload["action"].to_sym
|
61
61
|
app_payload = amqp_payload["payload"]
|
62
62
|
assert_method_whitelisted(action)
|
@@ -73,4 +73,4 @@ class Chef
|
|
73
73
|
|
74
74
|
end
|
75
75
|
end
|
76
|
-
end
|
76
|
+
end
|