chef 0.10.0.beta.6 → 0.10.0.beta.7
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/chef/application.rb +3 -0
- data/lib/chef/application/client.rb +34 -2
- data/lib/chef/checksum.rb +2 -2
- data/lib/chef/checksum_cache.rb +2 -2
- data/lib/chef/client.rb +7 -5
- data/lib/chef/cookbook/remote_file_vendor.rb +1 -1
- data/lib/chef/cookbook/syntax_check.rb +2 -2
- data/lib/chef/cookbook_version.rb +5 -0
- data/lib/chef/data_bag_item.rb +1 -1
- data/lib/chef/environment.rb +31 -9
- data/lib/chef/file_access_control.rb +7 -3
- data/lib/chef/index_queue/indexable.rb +2 -2
- data/lib/chef/knife.rb +1 -1
- data/lib/chef/knife/bootstrap.rb +1 -1
- data/lib/chef/knife/cookbook_site_install.rb +1 -1
- data/lib/chef/knife/cookbook_site_share.rb +2 -2
- data/lib/chef/knife/cookbook_upload.rb +32 -11
- data/lib/chef/knife/core/subcommand_loader.rb +24 -13
- data/lib/chef/knife/core/text_formatter.rb +2 -2
- data/lib/chef/knife/core/ui.rb +1 -1
- data/lib/chef/knife/search.rb +1 -1
- data/lib/chef/knife/ssh.rb +1 -0
- data/lib/chef/mixin/shell_out.rb +2 -2
- data/lib/chef/node.rb +7 -4
- data/lib/chef/provider/cookbook_file.rb +4 -5
- data/lib/chef/provider/cron.rb +3 -3
- data/lib/chef/provider/cron/solaris.rb +7 -7
- data/lib/chef/provider/deploy.rb +52 -29
- data/lib/chef/provider/directory.rb +8 -8
- data/lib/chef/provider/env.rb +8 -8
- data/lib/chef/provider/erl_call.rb +7 -6
- data/lib/chef/provider/execute.rb +7 -2
- data/lib/chef/provider/file.rb +9 -9
- data/lib/chef/provider/git.rb +17 -8
- data/lib/chef/provider/group.rb +6 -6
- data/lib/chef/provider/group/aix.rb +1 -1
- data/lib/chef/provider/group/dscl.rb +2 -2
- data/lib/chef/provider/group/gpasswd.rb +3 -3
- data/lib/chef/provider/group/groupadd.rb +1 -1
- data/lib/chef/provider/group/pw.rb +3 -3
- data/lib/chef/provider/group/usermod.rb +2 -2
- data/lib/chef/provider/group/windows.rb +1 -1
- data/lib/chef/provider/ifconfig.rb +9 -7
- data/lib/chef/provider/link.rb +27 -24
- data/lib/chef/provider/mdadm.rb +10 -10
- data/lib/chef/provider/mount.rb +10 -13
- data/lib/chef/provider/mount/mount.rb +10 -10
- data/lib/chef/provider/mount/windows.rb +4 -3
- data/lib/chef/provider/ohai.rb +2 -1
- data/lib/chef/provider/package.rb +10 -6
- data/lib/chef/provider/package/apt.rb +18 -18
- data/lib/chef/provider/package/dpkg.rb +3 -3
- data/lib/chef/provider/package/easy_install.rb +2 -2
- data/lib/chef/provider/package/freebsd.rb +4 -5
- data/lib/chef/provider/package/macports.rb +2 -2
- data/lib/chef/provider/package/pacman.rb +2 -2
- data/lib/chef/provider/package/portage.rb +1 -1
- data/lib/chef/provider/package/rpm.rb +3 -3
- data/lib/chef/provider/package/rubygems.rb +7 -7
- data/lib/chef/provider/package/solaris.rb +9 -9
- data/lib/chef/provider/package/yum.rb +4 -4
- data/lib/chef/provider/package/zypper.rb +5 -11
- data/lib/chef/provider/remote_directory.rb +15 -14
- data/lib/chef/provider/remote_file.rb +11 -12
- data/lib/chef/provider/route.rb +8 -10
- data/lib/chef/provider/ruby_block.rb +1 -0
- data/lib/chef/provider/service.rb +10 -16
- data/lib/chef/provider/service/debian.rb +1 -1
- data/lib/chef/provider/service/freebsd.rb +16 -18
- data/lib/chef/provider/service/gentoo.rb +2 -3
- data/lib/chef/provider/service/simple.rb +7 -5
- data/lib/chef/provider/service/upstart.rb +8 -8
- data/lib/chef/provider/service/windows.rb +3 -3
- data/lib/chef/provider/subversion.rb +12 -9
- data/lib/chef/provider/template.rb +2 -3
- data/lib/chef/provider/user.rb +13 -14
- data/lib/chef/provider/user/dscl.rb +2 -2
- data/lib/chef/provider/user/pw.rb +4 -4
- data/lib/chef/provider/user/useradd.rb +3 -3
- data/lib/chef/provider/user/windows.rb +3 -3
- data/lib/chef/resource.rb +4 -3
- data/lib/chef/resource/deploy.rb +1 -1
- data/lib/chef/rest/rest_request.rb +2 -2
- data/lib/chef/run_context.rb +1 -1
- data/lib/chef/shell_out.rb +13 -1
- data/lib/chef/solr_query.rb +1 -1
- data/lib/chef/solr_query/solr_http_request.rb +1 -1
- data/lib/chef/tasks/chef_repo.rake +74 -0
- data/lib/chef/version.rb +1 -1
- metadata +2 -2
@@ -65,14 +65,14 @@ class Chef
|
|
65
65
|
opt = ""
|
66
66
|
unless @new_resource.members.empty?
|
67
67
|
opt << " -M #{@new_resource.members.join(',')}"
|
68
|
-
Chef::Log.debug("#{@new_resource}
|
68
|
+
Chef::Log.debug("#{@new_resource} setting group members to #{@new_resource.members.join(', ')}")
|
69
69
|
else
|
70
70
|
# New member list is empty so we should delete any old group members
|
71
71
|
unless @current_resource.members.empty?
|
72
72
|
opt << " -d #{@current_resource.members.join(',')}"
|
73
|
-
Chef::Log.debug("#{@new_resource}
|
73
|
+
Chef::Log.debug("#{@new_resource} removing group members #{@current_resource.members.join(', ')}")
|
74
74
|
else
|
75
|
-
Chef::Log.debug("#{@new_resource}
|
75
|
+
Chef::Log.debug("#{@new_resource} not changing group members, the group has no members")
|
76
76
|
end
|
77
77
|
end
|
78
78
|
opt
|
@@ -40,7 +40,7 @@ class Chef
|
|
40
40
|
unless @new_resource.members.empty?
|
41
41
|
if(@new_resource.append)
|
42
42
|
@new_resource.members.each do |member|
|
43
|
-
Chef::Log.debug("#{@new_resource}
|
43
|
+
Chef::Log.debug("#{@new_resource} appending member #{member} to group #{@new_resource.group_name}")
|
44
44
|
run_command(:command => "usermod #{append_flags} #{@new_resource.group_name} #{member}" )
|
45
45
|
|
46
46
|
end
|
@@ -48,7 +48,7 @@ class Chef
|
|
48
48
|
raise Chef::Exceptions::Group, "setting group members directly is not supported by #{self.to_s}"
|
49
49
|
end
|
50
50
|
else
|
51
|
-
Chef::Log.debug("#{@new_resource}
|
51
|
+
Chef::Log.debug("#{@new_resource} not changing group members, the group has no members")
|
52
52
|
end
|
53
53
|
end
|
54
54
|
end
|
@@ -6,9 +6,9 @@
|
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
7
|
# you may not use this file except in compliance with the License.
|
8
8
|
# You may obtain a copy of the License at
|
9
|
-
#
|
9
|
+
#
|
10
10
|
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
-
#
|
11
|
+
#
|
12
12
|
# Unless required by applicable law or agreed to in writing, software
|
13
13
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
14
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
@@ -76,12 +76,12 @@ class Chef
|
|
76
76
|
command << " metric #{@new_resource.metric}" if @new_resource.metric
|
77
77
|
command << " mtu #{@new_resource.mtu}" if @new_resource.mtu
|
78
78
|
end
|
79
|
-
|
79
|
+
|
80
80
|
run_command(
|
81
81
|
:command => command
|
82
82
|
)
|
83
|
+
Chef::Log.info("#{@new_resource} added")
|
83
84
|
@new_resource.updated_by_last_action(true)
|
84
|
-
|
85
85
|
end
|
86
86
|
|
87
87
|
# Write out the config files
|
@@ -92,13 +92,14 @@ class Chef
|
|
92
92
|
# check to see if load_current_resource found the interface
|
93
93
|
if @current_resource.device
|
94
94
|
command = "ifconfig #{@new_resource.device} down"
|
95
|
-
|
95
|
+
|
96
96
|
run_command(
|
97
97
|
:command => command
|
98
98
|
)
|
99
|
+
Chef::Log.info("#{@new_resource} deleted")
|
99
100
|
@new_resource.updated_by_last_action(true)
|
100
101
|
else
|
101
|
-
Chef::Log.debug("
|
102
|
+
Chef::Log.debug("#{@new_resource} does not exist - nothing to do")
|
102
103
|
end
|
103
104
|
end
|
104
105
|
|
@@ -121,12 +122,13 @@ class Chef
|
|
121
122
|
network_file = ::File.new("/etc/sysconfig/network-scripts/ifcfg-#{@new_resource.device}", "w")
|
122
123
|
network_file.puts(template.result(b))
|
123
124
|
network_file.close
|
125
|
+
Chef::Log.info("#{@new_resource} created configuration file")
|
124
126
|
when "debian","ubuntu"
|
125
127
|
# template
|
126
128
|
when "slackware"
|
127
129
|
# template
|
128
130
|
end
|
129
|
-
end
|
131
|
+
end
|
130
132
|
end
|
131
133
|
end
|
132
134
|
end
|
data/lib/chef/provider/link.rb
CHANGED
@@ -6,9 +6,9 @@
|
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
7
|
# you may not use this file except in compliance with the License.
|
8
8
|
# You may obtain a copy of the License at
|
9
|
-
#
|
9
|
+
#
|
10
10
|
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
-
#
|
11
|
+
#
|
12
12
|
# Unless required by applicable law or agreed to in writing, software
|
13
13
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
14
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
@@ -36,12 +36,12 @@ class Chef
|
|
36
36
|
end
|
37
37
|
|
38
38
|
private :negative_complement
|
39
|
-
|
39
|
+
|
40
40
|
def load_current_resource
|
41
41
|
@current_resource = Chef::Resource::Link.new(@new_resource.name)
|
42
42
|
@current_resource.target_file(@new_resource.target_file)
|
43
43
|
@current_resource.link_type(@new_resource.link_type)
|
44
|
-
if @new_resource.link_type == :symbolic
|
44
|
+
if @new_resource.link_type == :symbolic
|
45
45
|
if ::File.exists?(@current_resource.target_file) && ::File.symlink?(@current_resource.target_file)
|
46
46
|
@current_resource.to(
|
47
47
|
::File.expand_path(::File.readlink(@current_resource.target_file))
|
@@ -64,68 +64,71 @@ class Chef
|
|
64
64
|
end
|
65
65
|
end
|
66
66
|
@current_resource
|
67
|
-
end
|
68
|
-
|
67
|
+
end
|
68
|
+
|
69
69
|
# Compare the ownership of a symlink. Returns true if they are the same, false if they are not.
|
70
70
|
def compare_owner
|
71
71
|
return false if @new_resource.owner.nil?
|
72
|
-
|
72
|
+
|
73
73
|
@set_user_id = case @new_resource.owner
|
74
74
|
when /^\d+$/, Integer
|
75
75
|
@new_resource.owner.to_i
|
76
76
|
else
|
77
|
-
# This raises an ArgumentError if you can't find the user
|
77
|
+
# This raises an ArgumentError if you can't find the user
|
78
78
|
Etc.getpwnam(@new_resource.owner).uid
|
79
79
|
end
|
80
|
-
|
80
|
+
|
81
81
|
@set_user_id == @current_resource.owner
|
82
82
|
end
|
83
|
-
|
83
|
+
|
84
84
|
# Set the ownership on the symlink, assuming it is not set correctly already.
|
85
85
|
def set_owner
|
86
86
|
unless compare_owner
|
87
|
-
Chef::Log.info("Setting owner to #{@set_user_id} for #{@new_resource}")
|
88
87
|
@set_user_id = negative_complement(@set_user_id)
|
89
88
|
::File.lchown(@set_user_id, nil, @new_resource.target_file)
|
89
|
+
Chef::Log.info("#{@new_resource} owner changed to #{@set_user_id}")
|
90
90
|
@new_resource.updated_by_last_action(true)
|
91
91
|
end
|
92
92
|
end
|
93
|
-
|
93
|
+
|
94
94
|
# Compares the group of a symlink. Returns true if they are the same, false if they are not.
|
95
95
|
def compare_group
|
96
96
|
return false if @new_resource.group.nil?
|
97
|
-
|
97
|
+
|
98
98
|
@set_group_id = case @new_resource.group
|
99
99
|
when /^\d+$/, Integer
|
100
100
|
@new_resource.group.to_i
|
101
101
|
else
|
102
102
|
Etc.getgrnam(@new_resource.group).gid
|
103
103
|
end
|
104
|
-
|
104
|
+
|
105
105
|
@set_group_id == @current_resource.group
|
106
106
|
end
|
107
|
-
|
107
|
+
|
108
108
|
def set_group
|
109
109
|
unless compare_group
|
110
|
-
Chef::Log.info("Setting group to #{@set_group_id} for #{@new_resource}")
|
111
110
|
@set_group_id = negative_complement(@set_group_id)
|
112
111
|
::File.lchown(nil, @set_group_id, @new_resource.target_file)
|
112
|
+
Chef::Log.info("#{@new_resource} group changed to #{@set_group_id}")
|
113
113
|
@new_resource.updated_by_last_action(true)
|
114
114
|
end
|
115
115
|
end
|
116
|
-
|
116
|
+
|
117
117
|
def action_create
|
118
118
|
if @current_resource.to != ::File.expand_path(@new_resource.to, @new_resource.target_file)
|
119
|
-
Chef::Log.info("Creating a #{@new_resource.link_type} link from #{@new_resource.to} -> #{@new_resource.target_file} for #{@new_resource}")
|
120
119
|
if @new_resource.link_type == :symbolic
|
121
120
|
unless (::File.symlink?(@new_resource.target_file) && ::File.readlink(@new_resource.target_file) == @new_resource.to)
|
122
121
|
if ::File.symlink?(@new_resource.target_file) || ::File.exist?(@new_resource.target_file)
|
123
122
|
::File.unlink(@new_resource.target_file)
|
124
123
|
end
|
125
124
|
::File.symlink(@new_resource.to,@new_resource.target_file)
|
126
|
-
|
125
|
+
Chef::Log.debug("#{@new_resource} created #{@new_resource.link_type} link from #{@new_resource.to} -> #{@new_resource.target_file}")
|
126
|
+
Chef::Log.info("#{@new_resource} created")
|
127
|
+
end
|
127
128
|
elsif @new_resource.link_type == :hard
|
128
129
|
::File.link(@new_resource.to, @new_resource.target_file)
|
130
|
+
Chef::Log.debug("#{@new_resource} created #{@new_resource.link_type} link from #{@new_resource.to} -> #{@new_resource.target_file}")
|
131
|
+
Chef::Log.info("#{@new_resource} created")
|
129
132
|
end
|
130
133
|
@new_resource.updated_by_last_action(true)
|
131
134
|
end
|
@@ -134,21 +137,21 @@ class Chef
|
|
134
137
|
set_group unless @new_resource.group.nil?
|
135
138
|
end
|
136
139
|
end
|
137
|
-
|
140
|
+
|
138
141
|
def action_delete
|
139
|
-
if @new_resource.link_type == :symbolic
|
142
|
+
if @new_resource.link_type == :symbolic
|
140
143
|
if ::File.symlink?(@new_resource.target_file)
|
141
|
-
Chef::Log.info("Deleting #{@new_resource} at #{@new_resource.target_file}")
|
142
144
|
::File.delete(@new_resource.target_file)
|
145
|
+
Chef::Log.info("#{@new_resource} deleted")
|
143
146
|
@new_resource.updated_by_last_action(true)
|
144
147
|
elsif ::File.exists?(@new_resource.target_file)
|
145
148
|
raise Chef::Exceptions::Link, "Cannot delete #{@new_resource} at #{@new_resource.target_file}! Not a symbolic link."
|
146
149
|
end
|
147
|
-
elsif @new_resource.link_type == :hard
|
150
|
+
elsif @new_resource.link_type == :hard
|
148
151
|
if ::File.exists?(@new_resource.target_file)
|
149
152
|
if ::File.exists?(@new_resource.to) && ::File.stat(@current_resource.target_file).ino == ::File.stat(@new_resource.to).ino
|
150
|
-
Chef::Log.info("Deleting #{@new_resource} at #{@new_resource.target_file}")
|
151
153
|
::File.delete(@new_resource.target_file)
|
154
|
+
Chef::Log.info("#{@new_resource} deleted")
|
152
155
|
@new_resource.updated_by_last_action(true)
|
153
156
|
else
|
154
157
|
raise Chef::Exceptions::Link, "Cannot delete #{@new_resource} at #{@new_resource.target_file}! Not a hard link."
|
data/lib/chef/provider/mdadm.rb
CHANGED
@@ -34,7 +34,7 @@ class Chef
|
|
34
34
|
def load_current_resource
|
35
35
|
@current_resource = Chef::Resource::Mdadm.new(@new_resource.name)
|
36
36
|
@current_resource.raid_device(@new_resource.raid_device)
|
37
|
-
Chef::Log.debug("
|
37
|
+
Chef::Log.debug("#{@new_resource} checking for software raid device #{@current_resource.raid_device}")
|
38
38
|
|
39
39
|
mdadm = shell_out!("mdadm --detail --scan")
|
40
40
|
exists = mdadm.stdout.include?(@new_resource.raid_device)
|
@@ -52,37 +52,37 @@ class Chef
|
|
52
52
|
def action_create
|
53
53
|
unless @current_resource.exists
|
54
54
|
command = "yes | mdadm --create #{@new_resource.raid_device} --chunk=#{@new_resource.chunk} --level #{@new_resource.level} --raid-devices #{@new_resource.devices.length} #{@new_resource.devices.join(" ")}"
|
55
|
-
Chef::Log.debug("mdadm command: #{command}")
|
55
|
+
Chef::Log.debug("#{@new_resource} mdadm command: #{command}")
|
56
56
|
#pid, stdin, stdout, stderr = popen4(command)
|
57
57
|
shell_out!(command)
|
58
|
-
Chef::Log.info("
|
58
|
+
Chef::Log.info("#{@new_resource} created raid device (#{@new_resource.raid_device})")
|
59
59
|
@new_resource.updated_by_last_action(true)
|
60
60
|
else
|
61
|
-
Chef::Log.debug("
|
61
|
+
Chef::Log.debug("#{@new_resource} raid device already exists, skipping create (#{@new_resource.raid_device})")
|
62
62
|
end
|
63
63
|
end
|
64
64
|
|
65
65
|
def action_assemble
|
66
66
|
unless @current_resource.exists
|
67
67
|
command = "yes | mdadm --assemble #{@new_resource.raid_device} #{@new_resource.devices.join(" ")}"
|
68
|
-
Chef::Log.debug("mdadm command: #{command}")
|
68
|
+
Chef::Log.debug("#{@new_resource} mdadm command: #{command}")
|
69
69
|
shell_out!(command)
|
70
|
-
Chef::Log.info("
|
70
|
+
Chef::Log.info("#{@new_resource} assembled raid device (#{@new_resource.raid_device})")
|
71
71
|
@new_resource.updated_by_last_action(true)
|
72
72
|
else
|
73
|
-
Chef::Log.debug("
|
73
|
+
Chef::Log.debug("#{@new_resource} raid device already exists, skipping assemble (#{@new_resource.raid_device})")
|
74
74
|
end
|
75
75
|
end
|
76
76
|
|
77
77
|
def action_stop
|
78
78
|
if @current_resource.exists
|
79
79
|
command = "yes | mdadm --stop #{@new_resource.raid_device}"
|
80
|
-
Chef::Log.debug("mdadm command: #{command}")
|
80
|
+
Chef::Log.debug("#{@new_resource} mdadm command: #{command}")
|
81
81
|
shell_out!(command)
|
82
|
-
Chef::Log.info("
|
82
|
+
Chef::Log.info("#{@new_resource} stopped raid device (#{@new_resource.raid_device})")
|
83
83
|
@new_resource.updated_by_last_action(true)
|
84
84
|
else
|
85
|
-
Chef::Log.debug("
|
85
|
+
Chef::Log.debug("#{@new_resource} raid device doesn't exist (#{@new_resource.raid_device}) - not stopping")
|
86
86
|
end
|
87
87
|
end
|
88
88
|
|
data/lib/chef/provider/mount.rb
CHANGED
@@ -28,27 +28,25 @@ class Chef
|
|
28
28
|
|
29
29
|
def action_mount
|
30
30
|
unless @current_resource.mounted
|
31
|
-
Chef::Log.debug("#{@new_resource}: attempting to mount")
|
32
31
|
status = mount_fs()
|
33
32
|
if status
|
34
33
|
@new_resource.updated_by_last_action(true)
|
35
|
-
Chef::Log.info("#{@new_resource}
|
34
|
+
Chef::Log.info("#{@new_resource} mounted")
|
36
35
|
end
|
37
36
|
else
|
38
|
-
Chef::Log.debug("#{@new_resource}
|
37
|
+
Chef::Log.debug("#{@new_resource} is already mounted")
|
39
38
|
end
|
40
39
|
end
|
41
40
|
|
42
41
|
def action_umount
|
43
42
|
if @current_resource.mounted
|
44
|
-
Chef::Log.debug("#{@new_resource}: attempting to unmount")
|
45
43
|
status = umount_fs()
|
46
44
|
if status
|
47
45
|
@new_resource.updated_by_last_action(true)
|
48
|
-
Chef::Log.info("#{@new_resource}
|
46
|
+
Chef::Log.info("#{@new_resource} unmounted")
|
49
47
|
end
|
50
48
|
else
|
51
|
-
Chef::Log.debug("#{@new_resource}
|
49
|
+
Chef::Log.debug("#{@new_resource} is already unmounted")
|
52
50
|
end
|
53
51
|
end
|
54
52
|
|
@@ -57,14 +55,13 @@ class Chef
|
|
57
55
|
raise Chef::Exceptions::UnsupportedAction, "#{self.to_s} does not support :remount"
|
58
56
|
else
|
59
57
|
if @current_resource.mounted
|
60
|
-
Chef::Log.debug("#{@new_resource}: attempting to remount")
|
61
58
|
status = remount_fs()
|
62
59
|
if status
|
63
60
|
@new_resource.updated_by_last_action(true)
|
64
|
-
Chef::Log.info("#{@new_resource}
|
61
|
+
Chef::Log.info("#{@new_resource} remounted")
|
65
62
|
end
|
66
63
|
else
|
67
|
-
Chef::Log.debug("#{@new_resource}
|
64
|
+
Chef::Log.debug("#{@new_resource} not mounted, nothing to remount")
|
68
65
|
end
|
69
66
|
end
|
70
67
|
end
|
@@ -74,9 +71,9 @@ class Chef
|
|
74
71
|
status = enable_fs
|
75
72
|
if status
|
76
73
|
@new_resource.updated_by_last_action(true)
|
77
|
-
Chef::Log.info("#{@new_resource}
|
74
|
+
Chef::Log.info("#{@new_resource} enabled")
|
78
75
|
else
|
79
|
-
Chef::Log.debug("#{@new_resource}
|
76
|
+
Chef::Log.debug("#{@new_resource} already enabled")
|
80
77
|
end
|
81
78
|
end
|
82
79
|
end
|
@@ -86,9 +83,9 @@ class Chef
|
|
86
83
|
status = disable_fs
|
87
84
|
if status
|
88
85
|
@new_resource.updated_by_last_action(true)
|
89
|
-
Chef::Log.info("#{@new_resource}
|
86
|
+
Chef::Log.info("#{@new_resource} disabled")
|
90
87
|
else
|
91
|
-
Chef::Log.debug("#{@new_resource}
|
88
|
+
Chef::Log.debug("#{@new_resource} already disabled")
|
92
89
|
end
|
93
90
|
end
|
94
91
|
end
|
@@ -94,18 +94,18 @@ class Chef
|
|
94
94
|
end
|
95
95
|
command << " #{@new_resource.mount_point}"
|
96
96
|
shell_out!(command)
|
97
|
-
Chef::Log.
|
97
|
+
Chef::Log.debug("#{@new_resource} is mounted at #{@new_resource.mount_point}")
|
98
98
|
else
|
99
|
-
Chef::Log.debug("#{@new_resource
|
99
|
+
Chef::Log.debug("#{@new_resource} is already mounted at #{@new_resource.mount_point}")
|
100
100
|
end
|
101
101
|
end
|
102
102
|
|
103
103
|
def umount_fs
|
104
104
|
if @current_resource.mounted
|
105
105
|
shell_out!("umount #{@new_resource.mount_point}")
|
106
|
-
Chef::Log.
|
106
|
+
Chef::Log.debug("#{@new_resource} is no longer mounted at #{@new_resource.mount_point}")
|
107
107
|
else
|
108
|
-
Chef::Log.debug("#{@new_resource
|
108
|
+
Chef::Log.debug("#{@new_resource} is not mounted at #{@new_resource.mount_point}")
|
109
109
|
end
|
110
110
|
end
|
111
111
|
|
@@ -114,19 +114,19 @@ class Chef
|
|
114
114
|
shell_out!("mount -o remount #{@new_resource.mount_point}")
|
115
115
|
|
116
116
|
@new_resource.updated_by_last_action(true)
|
117
|
-
Chef::Log.
|
117
|
+
Chef::Log.debug("#{@new_resource} is remounted at #{@new_resource.mount_point}")
|
118
118
|
elsif @current_resource.mounted
|
119
119
|
umount_fs
|
120
120
|
sleep 1
|
121
121
|
mount_fs
|
122
122
|
else
|
123
|
-
Chef::Log.debug("#{@new_resource
|
123
|
+
Chef::Log.debug("#{@new_resource} is not mounted at #{@new_resource.mount_point} - nothing to do")
|
124
124
|
end
|
125
125
|
end
|
126
126
|
|
127
127
|
def enable_fs
|
128
128
|
if @current_resource.enabled && mount_options_unchanged?
|
129
|
-
Chef::Log.debug("#{@new_resource
|
129
|
+
Chef::Log.debug("#{@new_resource} is already enabled - nothing to do")
|
130
130
|
return nil
|
131
131
|
end
|
132
132
|
|
@@ -137,7 +137,7 @@ class Chef
|
|
137
137
|
end
|
138
138
|
::File.open("/etc/fstab", "a") do |fstab|
|
139
139
|
fstab.puts("#{device_fstab} #{@new_resource.mount_point} #{@new_resource.fstype} #{@new_resource.options.nil? ? "defaults" : @new_resource.options.join(",")} #{@new_resource.dump} #{@new_resource.pass}")
|
140
|
-
Chef::Log.
|
140
|
+
Chef::Log.debug("#{@new_resource} is enabled at #{@new_resource.mount_point}")
|
141
141
|
end
|
142
142
|
end
|
143
143
|
|
@@ -149,7 +149,7 @@ class Chef
|
|
149
149
|
::File.readlines("/etc/fstab").reverse_each do |line|
|
150
150
|
if !found && line =~ /^#{device_fstab_regex}\s+#{Regexp.escape(@new_resource.mount_point)}/
|
151
151
|
found = true
|
152
|
-
Chef::Log.debug("
|
152
|
+
Chef::Log.debug("#{@new_resource} is removed from fstab")
|
153
153
|
next
|
154
154
|
else
|
155
155
|
contents << line
|
@@ -160,7 +160,7 @@ class Chef
|
|
160
160
|
contents.reverse_each { |line| fstab.puts line}
|
161
161
|
end
|
162
162
|
else
|
163
|
-
Chef::Log.debug("#{@new_resource
|
163
|
+
Chef::Log.debug("#{@new_resource} is not enabled - nothing to do")
|
164
164
|
end
|
165
165
|
end
|
166
166
|
|
@@ -60,17 +60,18 @@ class Chef
|
|
60
60
|
def mount_fs
|
61
61
|
unless @current_resource.mounted
|
62
62
|
@mount.add(@new_resource.device)
|
63
|
+
Chef::Log.debug("#{@new_resource} is mounted at #{@new_resource.mount_point}")
|
63
64
|
else
|
64
|
-
Chef::Log.debug("#{@new_resource
|
65
|
+
Chef::Log.debug("#{@new_resource} is already mounted at #{@new_resource.mount_point}")
|
65
66
|
end
|
66
67
|
end
|
67
68
|
|
68
69
|
def umount_fs
|
69
70
|
if @current_resource.mounted
|
70
71
|
@mount.delete
|
71
|
-
Chef::Log.
|
72
|
+
Chef::Log.debug("#{@new_resource} is no longer mounted at #{@new_resource.mount_point}")
|
72
73
|
else
|
73
|
-
Chef::Log.debug("#{@new_resource
|
74
|
+
Chef::Log.debug("#{@new_resource} is not mounted at #{@new_resource.mount_point}")
|
74
75
|
end
|
75
76
|
end
|
76
77
|
|