Skip to content

Commit 7b81a68

Browse files
committed
(MODULES-1638) Remove prompt parameter
1 parent bad5422 commit 7b81a68

File tree

8 files changed

+3
-51
lines changed

8 files changed

+3
-51
lines changed

README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,6 @@ By default, when the provider triggers a reboot, it will skip any resources in t
7070
* If using `when => pending` style reboots, puppet will apply heuristics to determine if a reboot is pending, e.g. the existence of the PendingFileRenameOperations registry key. If the system reboots, but does not resolve the reboot pending condition, then puppet will reboot the system again. This could lead to a reboot cycle.
7171
* If puppet performs a reboot, any remaining items in the catalog will be applied the next time puppet runs. In other words, it may take more than one run to reach consistency. In situations where puppet is running as a service, puppet should execute again after the machine boots.
7272
* In puppet 3.3.0 and up, if puppet performs a reboot, any resource in the catalog that is skipped will be marked as such in the report. In versions prior, skipped resources are omitted from the report.
73-
* The `prompt` parameter should only be used with `puppet apply`. The prompt isn't displayed during puppet agent runs, which causes the operation to wait indefinitely.
74-
* The `prompt` parameter is only supported with providers that offer the `supports_reboot_prompting` feature. Currently, only the Windows provider offers this.
7573

7674
##License
7775

lib/puppet/provider/reboot/windows.rb

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
confine :kernel => :windows
66
defaultfor :kernel => :windows
77

8-
has_features :manages_reboot_pending, :supports_reboot_prompting
8+
has_features :manages_reboot_pending
99

1010
def self.shutdown_command
1111
if File.exists?("#{ENV['SYSTEMROOT']}\\sysnative\\shutdown.exe")
@@ -51,17 +51,14 @@ def reboot
5151
cancel_transaction
5252
end
5353

54-
# for demo/testing
55-
interactive = @resource[:prompt] ? '/i' : nil
56-
5754
shutdown_path = command(:shutdown)
5855
unless shutdown_path
5956
raise ArgumentError, "The shutdown.exe command was not found. On Windows 2003 x64 hotfix 942589 must be installed to access the 64-bit version of shutdown.exe from 32-bit version of ruby.exe."
6057
end
6158

6259
# Reason code
6360
# E P 4 1 Application: Maintenance (Planned)
64-
shutdown_cmd = [shutdown_path, interactive, '/r', '/t', @resource[:timeout], '/d', 'p:4:1', '/c', "\"#{@resource[:message]}\""].join(' ')
61+
shutdown_cmd = [shutdown_path, '/r', '/t', @resource[:timeout], '/d', 'p:4:1', '/c', "\"#{@resource[:message]}\""].join(' ')
6562
async_shutdown(shutdown_cmd)
6663
end
6764

lib/puppet/type/reboot.rb

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@
5555
EOT
5656

5757
feature :manages_reboot_pending, "The provider can detect if a reboot is pending, and reboot as needed."
58-
feature :supports_reboot_prompting, "The provider can prompt the user to continue the reboot."
5958

6059
newparam(:name) do
6160
desc "The name of the reboot resource. Used for uniqueness."
@@ -110,13 +109,6 @@ def insync?(is)
110109
defaultto "Puppet is rebooting the computer"
111110
end
112111

113-
newparam(:prompt, {:boolean => true, :required_features => :supports_reboot_prompting}) do
114-
desc "Whether to prompt the user to continue the reboot. By default, the
115-
user will not be prompted."
116-
newvalues(:true, :false)
117-
defaultto(false)
118-
end
119-
120112
newparam(:catalog_apply_timeout) do
121113
desc "The maximum amount of time in seconds to wait for puppet to finish
122114
applying the catalog. If puppet is still running when the timeout is

manifests/init.pp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,6 @@
2929
# [*message*]
3030
# The message to log when the reboot is performed.
3131
#
32-
# [*prompt*]
33-
# Whether to prompt the user to continue the reboot. By default, the
34-
# user will not be prompted. Valid values are true, false. Should only
35-
# be used with `puppet apply`, not puppet agent runs.
36-
#
3732
# [*catalog_apply_timeout*]
3833
# The maximum amount of time in seconds to wait for puppet to finish
3934
# applying the catalog. If puppet is still running when the timeout is

metadata.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "puppetlabs-reboot",
3-
"version": "0.1.10-SNAPSHOT",
3+
"version": "0.2.0-SNAPSHOT",
44
"author": "puppetlabs",
55
"summary": "Adds a type and provider for managing system reboots.",
66
"license": "Apache-2.0",

spec/unit/provider/reboot/windows_spec.rb

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -99,17 +99,6 @@
9999
provider.reboot
100100
end
101101

102-
it "does not include the interactive flag by default" do
103-
provider.expects(:async_shutdown).with(Not(includes('/i')))
104-
provider.reboot
105-
end
106-
107-
it "includes the interactive flag if specified" do
108-
resource[:prompt] = true
109-
provider.expects(:async_shutdown).with(includes('/i'))
110-
provider.reboot
111-
end
112-
113102
it "includes the restart flag" do
114103
provider.expects(:async_shutdown).with(includes('/r'))
115104
provider.reboot

spec/unit/type/reboot_spec.rb

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -92,24 +92,6 @@
9292
end
9393
end
9494

95-
context "parameter :prompt" do
96-
it "should default to nil" do
97-
resource[:prompt].must be_nil
98-
end
99-
100-
it "should accept true on platforms that support prompting" do
101-
reboot = Puppet::Type.type(:reboot).new(:name => 'reboot', :provider => :windows)
102-
reboot[:prompt] = true
103-
end
104-
105-
it "should reject non-boolean values on platforms that support prompting" do
106-
reboot = Puppet::Type.type(:reboot).new(:name => 'reboot', :provider => :windows)
107-
expect {
108-
reboot[:prompt] = "I'm not sure"
109-
}.to raise_error(Puppet::ResourceError, /Invalid value "I'm not sure"/)
110-
end
111-
end
112-
11395
context "parameter :catalog_apply_timeout" do
11496
it "should default to 7200 seconds" do
11597
resource[:catalog_apply_timeout].must == 7200

tests/sample.pp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
}
55

66
reboot { 'now':
7-
prompt => true,
87
subscribe => File['c:/before.txt']
98
}
109

0 commit comments

Comments
 (0)