Skip to content

Commit af24c8c

Browse files
committed
Merge pull request #62 from elyscape/remove_prompt
(MODULES-1638) Remove prompt parameter
2 parents 26f5b60 + 2512a53 commit af24c8c

File tree

7 files changed

+5
-50
lines changed

7 files changed

+5
-50
lines changed

README.md

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@ The main type of the module, responsible for all its functionality.
8888

8989
####Features
9090

91-
* `supports_reboot_prompting`: Notifies the node's user that a reboot is pending, and let them cancel the pending reboot process. (Available with the `windows` provider. Linux terminal users get a shutdown notice regardless of this parameter, but they can't cancel the reboot.)
9291
* `manages_reboot_pending`: Detects whether a reboot is pending due to a prior change. If so, reboot the node. (Available with the `windows` provider.)
9392

9493
####Parameters
@@ -111,14 +110,6 @@ The main type of the module, responsible for all its functionality.
111110

112111
*Required.* Sets the name of the reboot resource. Valid options: a string.
113112

114-
#####`prompt`
115-
116-
*Optional.* Specifies whether to prompt the user to continue the reboot. Only for use in a masterless configuration. Valid options: 'true' and 'false'. Default value: 'false'.
117-
118-
**Note:** If this parameter is set to 'true', you must prompt Puppet agent runs manually using `puppet apply`. Otherwise, the prompt is never displayed to the user, and the agent run waits indefinitely.
119-
120-
Prompts are only available in Windows. Linux terminal users get a shutdown notice regardless of this parameter, but they can't cancel the reboot.
121-
122113
#####`timeout`
123114

124115
*Optional.* Sets the number of seconds to wait after the Puppet run completes for the reboot to happen. If the timeout is exceeded, the provider cancels the reboot. Valid options: any positive integer. Default value: '60'.
@@ -139,4 +130,4 @@ For more information, see our [module contribution guide.](https://docs.puppetla
139130

140131
###Contributors
141132

142-
To see who's already involved, see the [list of contributors.](https://github.com/puppetlabs/puppetlabs-reboot/graphs/contributors)
133+
To see who's already involved, see the [list of contributors.](https://github.com/puppetlabs/puppetlabs-reboot/graphs/contributors)

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

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: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -99,17 +99,11 @@
9999
provider.reboot
100100
end
101101

102-
it "does not include the interactive flag by default" do
102+
it "does not include the interactive flag" do
103103
provider.expects(:async_shutdown).with(Not(includes('/i')))
104104
provider.reboot
105105
end
106106

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-
113107
it "includes the restart flag" do
114108
provider.expects(:async_shutdown).with(includes('/r'))
115109
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)