chef 10.14.0.beta.3 → 10.14.0.rc.0
Sign up to get free protection for your applications and to get access to all the features.
- data/distro/common/html/chef-client.8.html +4 -6
- data/distro/common/html/chef-expander.8.html +4 -4
- data/distro/common/html/chef-expanderctl.8.html +4 -4
- data/distro/common/html/chef-server-webui.8.html +4 -4
- data/distro/common/html/chef-server.8.html +4 -4
- data/distro/common/html/chef-solo.8.html +4 -4
- data/distro/common/html/chef-solr.8.html +4 -4
- data/distro/common/html/knife-bootstrap.1.html +4 -4
- data/distro/common/html/knife-client.1.html +4 -4
- data/distro/common/html/knife-configure.1.html +5 -5
- data/distro/common/html/knife-cookbook-site.1.html +7 -7
- data/distro/common/html/knife-cookbook.1.html +4 -4
- data/distro/common/html/knife-data-bag.1.html +4 -4
- data/distro/common/html/knife-environment.1.html +4 -4
- data/distro/common/html/knife-exec.1.html +4 -4
- data/distro/common/html/knife-index.1.html +4 -4
- data/distro/common/html/knife-node.1.html +5 -5
- data/distro/common/html/knife-role.1.html +4 -4
- data/distro/common/html/knife-search.1.html +4 -4
- data/distro/common/html/knife-ssh.1.html +5 -5
- data/distro/common/html/knife-status.1.html +4 -4
- data/distro/common/html/knife-tag.1.html +4 -4
- data/distro/common/html/knife.1.html +5 -5
- data/distro/common/html/shef.1.html +4 -4
- data/distro/common/man/man1/knife-bootstrap.1 +1 -1
- data/distro/common/man/man1/knife-client.1 +1 -1
- data/distro/common/man/man1/knife-configure.1 +1 -1
- data/distro/common/man/man1/knife-cookbook-site.1 +1 -1
- data/distro/common/man/man1/knife-cookbook.1 +1 -1
- data/distro/common/man/man1/knife-data-bag.1 +1 -1
- data/distro/common/man/man1/knife-environment.1 +1 -1
- data/distro/common/man/man1/knife-exec.1 +1 -1
- data/distro/common/man/man1/knife-index.1 +1 -1
- data/distro/common/man/man1/knife-node.1 +1 -1
- data/distro/common/man/man1/knife-role.1 +1 -1
- data/distro/common/man/man1/knife-search.1 +1 -1
- data/distro/common/man/man1/knife-ssh.1 +1 -1
- data/distro/common/man/man1/knife-status.1 +1 -1
- data/distro/common/man/man1/knife-tag.1 +1 -1
- data/distro/common/man/man1/knife.1 +5 -5
- data/distro/common/man/man1/shef.1 +1 -1
- data/distro/common/man/man8/chef-client.8 +1 -5
- data/distro/common/man/man8/chef-expander.8 +1 -1
- data/distro/common/man/man8/chef-expanderctl.8 +1 -1
- data/distro/common/man/man8/chef-server-webui.8 +1 -1
- data/distro/common/man/man8/chef-server.8 +1 -1
- data/distro/common/man/man8/chef-solo.8 +1 -1
- data/distro/common/man/man8/chef-solr.8 +1 -1
- data/distro/common/markdown/man1/knife.mkd +2 -2
- data/distro/common/markdown/man8/chef-client.mkd +0 -3
- data/lib/chef/client.rb +13 -3
- data/lib/chef/config.rb +29 -0
- data/lib/chef/environment.rb +5 -2
- data/lib/chef/file_access_control/unix.rb +3 -3
- data/lib/chef/knife.rb +11 -5
- data/lib/chef/knife/bootstrap.rb +9 -5
- data/lib/chef/knife/bootstrap/archlinux-gems.erb +1 -1
- data/lib/chef/knife/bootstrap/centos5-gems.erb +1 -1
- data/lib/chef/knife/bootstrap/chef-full.erb +1 -1
- data/lib/chef/knife/bootstrap/fedora13-gems.erb +1 -1
- data/lib/chef/knife/bootstrap/ubuntu10.04-apt.erb +1 -1
- data/lib/chef/knife/bootstrap/ubuntu10.04-gems.erb +1 -1
- data/lib/chef/knife/bootstrap/ubuntu12.04-gems.erb +1 -1
- data/lib/chef/knife/cookbook_create.rb +24 -1
- data/lib/chef/knife/ssh.rb +14 -2
- data/lib/chef/platform.rb +22 -2
- data/lib/chef/provider/file.rb +9 -3
- data/lib/chef/provider/group/usermod.rb +7 -4
- data/lib/chef/provider/mdadm.rb +3 -3
- data/lib/chef/provider/package/ips.rb +101 -0
- data/lib/chef/provider/package/solaris.rb +21 -12
- data/lib/chef/provider/service/solaris.rb +0 -3
- data/lib/chef/provider/user/dscl.rb +1 -1
- data/lib/chef/providers.rb +1 -0
- data/lib/chef/resource/ips_package.rb +42 -0
- data/lib/chef/resource/package.rb +6 -7
- data/lib/chef/resources.rb +1 -0
- data/lib/chef/rest/auth_credentials.rb +4 -3
- data/lib/chef/scan_access_control.rb +3 -9
- data/lib/chef/shef/ext.rb +22 -0
- data/lib/chef/version.rb +1 -1
- data/spec/functional/knife/cookbook_delete_spec.rb +5 -2
- data/spec/functional/knife/exec_spec.rb +5 -2
- data/spec/functional/knife/ssh_spec.rb +4 -2
- data/spec/functional/resource/link_spec.rb +4 -4
- data/spec/functional/resource/remote_file_spec.rb +17 -1
- data/spec/support/platform_helpers.rb +8 -0
- data/spec/support/shared/functional/securable_resource.rb +2 -2
- data/spec/tiny_server.rb +5 -1
- data/spec/unit/client_spec.rb +24 -0
- data/spec/unit/environment_spec.rb +26 -0
- data/spec/unit/knife/bootstrap_spec.rb +34 -11
- data/spec/unit/knife/config_file_selection_spec.rb +2 -2
- data/spec/unit/knife/configure_spec.rb +6 -0
- data/spec/unit/knife/cookbook_create_spec.rb +20 -0
- data/spec/unit/knife/ssh_spec.rb +145 -0
- data/spec/unit/mixin/command_spec.rb +8 -4
- data/spec/unit/mixin/enforce_ownership_and_permissions_spec.rb +2 -1
- data/spec/unit/mixin/securable_spec.rb +2 -2
- data/spec/unit/provider/file_spec.rb +6 -4
- data/spec/unit/provider/group/usermod_spec.rb +6 -1
- data/spec/unit/provider/link_spec.rb +4 -1
- data/spec/unit/provider/mdadm_spec.rb +10 -13
- data/spec/unit/provider/package/ips_spec.rb +210 -0
- data/spec/unit/provider/package/solaris_spec.rb +6 -4
- data/spec/unit/provider/subversion_spec.rb +2 -2
- data/spec/unit/provider/user/dscl_spec.rb +15 -0
- data/spec/unit/resource/ips_package_spec.rb +43 -0
- data/spec/unit/rest/auth_credentials_spec.rb +36 -14
- data/spec/unit/scan_access_control_spec.rb +20 -0
- metadata +13 -8
data/lib/chef/provider/file.rb
CHANGED
@@ -58,9 +58,15 @@ class Chef
|
|
58
58
|
|
59
59
|
def diff_current source_path
|
60
60
|
begin
|
61
|
-
|
61
|
+
# Solaris diff doesn't support -N (treat missing files as empty)
|
62
|
+
# For compatibility we'll create a temp file if the file does not exist
|
63
|
+
# and substitute it
|
64
|
+
unless ::File.exists?(source_path)
|
65
|
+
altfile = Tempfile.new('chef-tempfile')
|
66
|
+
source_path = altfile.path
|
67
|
+
end
|
62
68
|
# -u: Unified diff format
|
63
|
-
result = shell_out("diff -u
|
69
|
+
result = shell_out("diff -u #{@current_resource.path} #{source_path}" )
|
64
70
|
# diff will set a non-zero return code even when there's
|
65
71
|
# valid stdout results, if it encounters something unexpected
|
66
72
|
# So as long as we have output, we'll show it.
|
@@ -76,7 +82,7 @@ class Chef
|
|
76
82
|
rescue Exception => e
|
77
83
|
# Should *not* receive this, but in some circumstances it seems that
|
78
84
|
# an exception can be thrown even using shell_out instead of shell_out!
|
79
|
-
"Could not determine diff"
|
85
|
+
"Could not determine diff. Error: #{e.message}"
|
80
86
|
end
|
81
87
|
end
|
82
88
|
|
@@ -35,11 +35,17 @@ class Chef
|
|
35
35
|
a.failure_message Chef::Exceptions::Group, "Could not find binary /usr/sbin/usermod for #{@new_resource}"
|
36
36
|
# No whyrun alternative: this component should be available in the base install of any given system that uses it
|
37
37
|
end
|
38
|
+
|
39
|
+
requirements.assert(:modify, :create) do |a|
|
40
|
+
a.assertion { @new_resource.members.empty? || @new_resource.append }
|
41
|
+
a.failure_message Chef::Exceptions::Group, "setting group members directly is not supported by #{self.to_s}, must set append true in group"
|
42
|
+
# No whyrun alternative - this action is simply not supported.
|
43
|
+
end
|
38
44
|
end
|
39
45
|
|
40
46
|
def modify_group_members
|
41
47
|
case node[:platform]
|
42
|
-
when "openbsd", "netbsd", "aix"
|
48
|
+
when "openbsd", "netbsd", "aix", "solaris2"
|
43
49
|
append_flags = "-G"
|
44
50
|
when "solaris"
|
45
51
|
append_flags = "-a -G"
|
@@ -50,10 +56,7 @@ class Chef
|
|
50
56
|
@new_resource.members.each do |member|
|
51
57
|
Chef::Log.debug("#{@new_resource} appending member #{member} to group #{@new_resource.group_name}")
|
52
58
|
run_command(:command => "usermod #{append_flags} #{@new_resource.group_name} #{member}" )
|
53
|
-
|
54
59
|
end
|
55
|
-
else
|
56
|
-
raise Chef::Exceptions::Group, "setting group members directly is not supported by #{self.to_s}"
|
57
60
|
end
|
58
61
|
else
|
59
62
|
Chef::Log.debug("#{@new_resource} not changing group members, the group has no members")
|
data/lib/chef/provider/mdadm.rb
CHANGED
@@ -39,13 +39,13 @@ class Chef
|
|
39
39
|
@current_resource.raid_device(@new_resource.raid_device)
|
40
40
|
Chef::Log.debug("#{@new_resource} checking for software raid device #{@current_resource.raid_device}")
|
41
41
|
|
42
|
-
|
43
|
-
|
42
|
+
device_not_found = 4
|
43
|
+
mdadm = shell_out!("mdadm --detail --test #{@new_resource.raid_device}", :returns => [0,device_not_found])
|
44
|
+
exists = (mdadm.status == 0)
|
44
45
|
@current_resource.exists(exists)
|
45
46
|
end
|
46
47
|
|
47
48
|
def action_create
|
48
|
-
|
49
49
|
unless @current_resource.exists
|
50
50
|
converge_by("create RAID device #{new_resource.raid_device}") do
|
51
51
|
command = "yes | mdadm --create #{@new_resource.raid_device} --chunk=#{@new_resource.chunk} --level #{@new_resource.level}"
|
@@ -0,0 +1,101 @@
|
|
1
|
+
#
|
2
|
+
# Author:: Jason J. W. Williams (<williamsjj@digitar.com>)
|
3
|
+
# Author:: Stephen Nelson-Smith (<sns@opscode.com>)
|
4
|
+
# Copyright:: Copyright (c) 2011 Opscode, Inc.
|
5
|
+
# License:: Apache License, Version 2.0
|
6
|
+
#
|
7
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
8
|
+
# you may not use this file except in compliance with the License.
|
9
|
+
# You may obtain a copy of the License at
|
10
|
+
#
|
11
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
12
|
+
#
|
13
|
+
# Unless required by applicable law or agreed to in writing, software
|
14
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
15
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
16
|
+
# See the License for the specific language governing permissions and
|
17
|
+
# limitations under the License.
|
18
|
+
#
|
19
|
+
|
20
|
+
require 'open3'
|
21
|
+
require 'chef/provider/package'
|
22
|
+
require 'chef/mixin/command'
|
23
|
+
require 'chef/resource/package'
|
24
|
+
require 'chef/mixin/shell_out'
|
25
|
+
|
26
|
+
class Chef
|
27
|
+
class Provider
|
28
|
+
class Package
|
29
|
+
class Ips < Chef::Provider::Package
|
30
|
+
|
31
|
+
include Chef::Mixin::ShellOut
|
32
|
+
attr_accessor :virtual
|
33
|
+
|
34
|
+
def define_resource_requirements
|
35
|
+
super
|
36
|
+
|
37
|
+
requirements.assert(:all_actions) do |a|
|
38
|
+
a.assertion { ! @candidate_version.nil? }
|
39
|
+
a.failure_message Chef::Exceptions::Package, "Package #{@new_resource.package_name} not found"
|
40
|
+
a.whyrun "Assuming package #{@new_resource.package_name} would have been made available."
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
def load_current_resource
|
45
|
+
@current_resource = Chef::Resource::Package.new(@new_resource.name)
|
46
|
+
@current_resource.package_name(@new_resource.name)
|
47
|
+
check_package_state(@new_resource.package_name)
|
48
|
+
@current_resource
|
49
|
+
end
|
50
|
+
|
51
|
+
def check_package_state(package)
|
52
|
+
Chef::Log.debug("Checking package status for #{package}")
|
53
|
+
installed = false
|
54
|
+
depends = false
|
55
|
+
|
56
|
+
shell_out!("pkg info -r #{package}").stdout.each_line do |line|
|
57
|
+
case line
|
58
|
+
when /^\s+State: Installed/
|
59
|
+
installed = true
|
60
|
+
when /^\s+Version: (.*)/
|
61
|
+
@candidate_version = $1.split[0]
|
62
|
+
if installed
|
63
|
+
@current_resource.version($1)
|
64
|
+
else
|
65
|
+
@current_resource.version(nil)
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
return installed
|
71
|
+
end
|
72
|
+
|
73
|
+
def install_package(name, version)
|
74
|
+
package_name = "#{name}@#{version}"
|
75
|
+
normal_command = "pkg#{expand_options(@new_resource.options)} install -q #{package_name}"
|
76
|
+
if @new_resource.respond_to?(:accept_license) and @new_resource.accept_license
|
77
|
+
command = normal_command.gsub('-q', '-q --accept')
|
78
|
+
else
|
79
|
+
command = normal_command
|
80
|
+
end
|
81
|
+
begin
|
82
|
+
run_command_with_systems_locale(:command => command)
|
83
|
+
rescue
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
def upgrade_package(name, version)
|
88
|
+
install_package(name, version)
|
89
|
+
end
|
90
|
+
|
91
|
+
def remove_package(name, version)
|
92
|
+
package_name = "#{name}@#{version}"
|
93
|
+
run_command_with_systems_locale(
|
94
|
+
:command => "pkg#{expand_options(@new_resource.options)} uninstall -q #{package_name}"
|
95
|
+
)
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
@@ -31,6 +31,18 @@ class Chef
|
|
31
31
|
# super
|
32
32
|
# @current_resource = Chef::Resource::Package.new(@new_resource.name)
|
33
33
|
# end
|
34
|
+
def define_resource_requirements
|
35
|
+
super
|
36
|
+
requirements.assert(:install) do |a|
|
37
|
+
a.assertion { @new_resource.source }
|
38
|
+
a.failure_message Chef::Exceptions::Package, "Source for package #{@new_resource.name} required for action install"
|
39
|
+
end
|
40
|
+
requirements.assert(:all_actions) do |a|
|
41
|
+
a.assertion { !@new_resource.source || @package_source_found }
|
42
|
+
a.failure_message Chef::Exceptions::Package, "Package #{@new_resource.name} not found: #{@new_resource.source}"
|
43
|
+
a.whyrun "would assume #{@new_resource.source} would be have previously been made available"
|
44
|
+
end
|
45
|
+
end
|
34
46
|
|
35
47
|
def load_current_resource
|
36
48
|
@current_resource = Chef::Resource::Package.new(@new_resource.name)
|
@@ -38,21 +50,18 @@ class Chef
|
|
38
50
|
@new_resource.version(nil)
|
39
51
|
|
40
52
|
if @new_resource.source
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
@new_resource.version($1)
|
53
|
+
@package_source_found = ::File.exists?(@new_resource.source)
|
54
|
+
if @package_source_found
|
55
|
+
Chef::Log.debug("#{@new_resource} checking pkg status")
|
56
|
+
status = popen4("pkginfo -l -d #{@new_resource.source} #{@new_resource.package_name}") do |pid, stdin, stdout, stderr|
|
57
|
+
stdout.each do |line|
|
58
|
+
case line
|
59
|
+
when /VERSION:\s+(.+)/
|
60
|
+
@new_resource.version($1)
|
61
|
+
end
|
51
62
|
end
|
52
63
|
end
|
53
64
|
end
|
54
|
-
elsif Array(@new_resource.action).include?(:install)
|
55
|
-
raise Chef::Exceptions::Package, "Source for package #{@new_resource.name} required for action install"
|
56
65
|
end
|
57
66
|
|
58
67
|
Chef::Log.debug("#{@new_resource} checking install state")
|
@@ -164,7 +164,7 @@ class Chef
|
|
164
164
|
dscl_create_user if diverged?(:username)
|
165
165
|
dscl_create_comment if diverged?(:comment)
|
166
166
|
set_uid if diverged?(:uid)
|
167
|
-
dscl_set_gid if diverged?(:
|
167
|
+
dscl_set_gid if diverged?(:gid)
|
168
168
|
modify_home if diverged?(:home)
|
169
169
|
dscl_set_shell if diverged?(:shell)
|
170
170
|
modify_password if diverged?(:password)
|
data/lib/chef/providers.rb
CHANGED
@@ -52,6 +52,7 @@ require 'chef/provider/package/apt'
|
|
52
52
|
require 'chef/provider/package/dpkg'
|
53
53
|
require 'chef/provider/package/easy_install'
|
54
54
|
require 'chef/provider/package/freebsd'
|
55
|
+
require 'chef/provider/package/ips'
|
55
56
|
require 'chef/provider/package/macports'
|
56
57
|
require 'chef/provider/package/pacman'
|
57
58
|
require 'chef/provider/package/portage'
|
@@ -0,0 +1,42 @@
|
|
1
|
+
#
|
2
|
+
# Author:: Jason Williams (<williamsjj@digitar.com>)
|
3
|
+
# Copyright:: Copyright (c) 2011 Opscode, Inc.
|
4
|
+
# License:: Apache License, Version 2.0
|
5
|
+
#
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
+
# you may not use this file except in compliance with the License.
|
8
|
+
# You may obtain a copy of the License at
|
9
|
+
#
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
#
|
12
|
+
# Unless required by applicable law or agreed to in writing, software
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
+
# See the License for the specific language governing permissions and
|
16
|
+
# limitations under the License.
|
17
|
+
#
|
18
|
+
|
19
|
+
require 'chef/resource/package'
|
20
|
+
require 'chef/provider/package/ips'
|
21
|
+
|
22
|
+
class Chef
|
23
|
+
class Resource
|
24
|
+
class IpsPackage < ::Chef::Resource::Package
|
25
|
+
def initialize(name, run_context = nil)
|
26
|
+
super(name, run_context)
|
27
|
+
@resource_name = :ips_package
|
28
|
+
@provider = Chef::Provider::Package::Ips
|
29
|
+
@allowed_actions = [ :install, :remove, :upgrade ]
|
30
|
+
@accept_license = false
|
31
|
+
end
|
32
|
+
|
33
|
+
def accept_license(arg=nil)
|
34
|
+
set_or_return(
|
35
|
+
:purge,
|
36
|
+
arg,
|
37
|
+
:kind_of => [ TrueClass, FalseClass ]
|
38
|
+
)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -28,15 +28,15 @@ class Chef
|
|
28
28
|
|
29
29
|
def initialize(name, run_context=nil)
|
30
30
|
super
|
31
|
-
@
|
32
|
-
@
|
33
|
-
@version = nil
|
31
|
+
@action = :install
|
32
|
+
@allowed_actions.push(:install, :upgrade, :remove, :purge, :reconfig)
|
34
33
|
@candidate_version = nil
|
34
|
+
@options = nil
|
35
|
+
@package_name = name
|
36
|
+
@resource_name = :package
|
35
37
|
@response_file = nil
|
36
38
|
@source = nil
|
37
|
-
@
|
38
|
-
@options = nil
|
39
|
-
@allowed_actions.push(:install, :upgrade, :remove, :purge, :reconfig)
|
39
|
+
@version = nil
|
40
40
|
end
|
41
41
|
|
42
42
|
def package_name(arg=nil)
|
@@ -78,7 +78,6 @@ class Chef
|
|
78
78
|
:kind_of => [ String ]
|
79
79
|
)
|
80
80
|
end
|
81
|
-
|
82
81
|
end
|
83
82
|
end
|
84
83
|
end
|
data/lib/chef/resources.rb
CHANGED
@@ -33,6 +33,7 @@ require 'chef/resource/erl_call'
|
|
33
33
|
require 'chef/resource/execute'
|
34
34
|
require 'chef/resource/file'
|
35
35
|
require 'chef/resource/freebsd_package'
|
36
|
+
require 'chef/resource/ips_package'
|
36
37
|
require 'chef/resource/gem_package'
|
37
38
|
require 'chef/resource/git'
|
38
39
|
require 'chef/resource/group'
|
@@ -43,9 +43,10 @@ class Chef
|
|
43
43
|
Chef::Log.debug("Signing the request as #{client_name}")
|
44
44
|
|
45
45
|
# params_in = {:http_method => :GET, :path => "/clients", :body => "", :host => "localhost"}
|
46
|
-
request_params
|
47
|
-
request_params[:timestamp]
|
48
|
-
request_params[:user_id]
|
46
|
+
request_params = request_params.dup
|
47
|
+
request_params[:timestamp] = Time.now.utc.iso8601
|
48
|
+
request_params[:user_id] = client_name
|
49
|
+
request_params[:proto_version] = Chef::Config[:authentication_protocol_version]
|
49
50
|
host = request_params.delete(:host) || "localhost"
|
50
51
|
|
51
52
|
sign_obj = Mixlib::Authentication::SignedHeaderAuth.signing_object(request_params)
|
@@ -65,9 +65,7 @@ class Chef
|
|
65
65
|
|
66
66
|
def current_owner
|
67
67
|
case new_resource.owner
|
68
|
-
when nil
|
69
|
-
nil
|
70
|
-
when String
|
68
|
+
when String, nil
|
71
69
|
lookup_uid
|
72
70
|
when Integer
|
73
71
|
stat.uid
|
@@ -90,9 +88,7 @@ class Chef
|
|
90
88
|
|
91
89
|
def current_group
|
92
90
|
case new_resource.group
|
93
|
-
when nil
|
94
|
-
nil
|
95
|
-
when String
|
91
|
+
when String, nil
|
96
92
|
lookup_gid
|
97
93
|
when Integer
|
98
94
|
stat.gid
|
@@ -114,9 +110,7 @@ class Chef
|
|
114
110
|
|
115
111
|
def current_mode
|
116
112
|
case new_resource.mode
|
117
|
-
when nil
|
118
|
-
nil
|
119
|
-
when String
|
113
|
+
when String, nil
|
120
114
|
(stat.mode & 007777).to_s(8)
|
121
115
|
when Integer
|
122
116
|
stat.mode & 007777
|
data/lib/chef/shef/ext.rb
CHANGED
@@ -510,6 +510,28 @@ E
|
|
510
510
|
@named_databags_wrappers[databag_name] ||= Shef::NamedDataBagWrapper.new(databag_name)
|
511
511
|
end
|
512
512
|
|
513
|
+
desc "Find and edit environments via the API"
|
514
|
+
explain(<<-E)
|
515
|
+
## SUMMARY ##
|
516
|
+
+environments+ allows you to query and edit environments on your Chef server.
|
517
|
+
|
518
|
+
## SUBCOMMANDS ##
|
519
|
+
* all (list)
|
520
|
+
* show (load)
|
521
|
+
* search (find)
|
522
|
+
* transform (bulk_edit)
|
523
|
+
|
524
|
+
## SEE ALSO ##
|
525
|
+
See the help for +nodes+ for more information about the subcommands.
|
526
|
+
E
|
527
|
+
subcommands :all => "list all environments",
|
528
|
+
:show => "load an environment by name",
|
529
|
+
:search => "search for environments",
|
530
|
+
:transform => "edit all environments via a code block and save them"
|
531
|
+
def environments
|
532
|
+
@environments ||= Shef::ModelWrapper.new(Chef::Environment)
|
533
|
+
end
|
534
|
+
|
513
535
|
desc "A REST Client configured to authenticate with the API"
|
514
536
|
def api
|
515
537
|
@rest = Shef::ShefREST.new(Chef::Config[:chef_server_url])
|
data/lib/chef/version.rb
CHANGED
@@ -21,6 +21,8 @@ require 'tiny_server'
|
|
21
21
|
|
22
22
|
describe Chef::Knife::CookbookDelete do
|
23
23
|
before(:all) do
|
24
|
+
@original_config = Chef::Config.hash_dup
|
25
|
+
|
24
26
|
Thin::Logging.silent = true
|
25
27
|
|
26
28
|
@server = TinyServer::Manager.new
|
@@ -32,12 +34,13 @@ describe Chef::Knife::CookbookDelete do
|
|
32
34
|
@api = TinyServer::API.instance
|
33
35
|
@api.clear
|
34
36
|
|
35
|
-
Chef::Config[:node_name] =
|
36
|
-
Chef::Config[:client_key] =
|
37
|
+
Chef::Config[:node_name] = nil
|
38
|
+
Chef::Config[:client_key] = nil
|
37
39
|
Chef::Config[:chef_server_url] = 'http://localhost:9000'
|
38
40
|
end
|
39
41
|
|
40
42
|
after(:all) do
|
43
|
+
Chef::Config.configuration = @original_config
|
41
44
|
@server.stop
|
42
45
|
end
|
43
46
|
|