trove_datastore_version: Validate status

The status argument of datastore_version update command accepts only
0 or 1. This ensures a correct value is used by property validation
instead of attempting to execute the command with an invalid value.

Change-Id: I3eeace41c677157d6b5913a7ab9092e3456106a7
This commit is contained in:
Takashi Kajinami 2023-02-24 03:21:20 +09:00
parent ead07878ba
commit 0541ab7507
2 changed files with 3 additions and 3 deletions

View File

@ -9,7 +9,7 @@ Puppet::Type.newtype(:trove_datastore_version) do
end
newparam(:datastore) do
desc "Datastore name)"
desc "Datastore name"
end
newparam(:manager) do
@ -26,6 +26,8 @@ Puppet::Type.newtype(:trove_datastore_version) do
newparam(:active) do
desc "State"
newvalues('0', '1')
defaultto('1')
end
validate do
@ -33,7 +35,6 @@ Puppet::Type.newtype(:trove_datastore_version) do
raise(Puppet::Error, 'Manager must be set') unless self[:manager]
raise(Puppet::Error, 'Image must be set') unless self[:image_id]
raise(Puppet::Error, 'Packages must be set') unless self[:packages]
raise(Puppet::Error, 'State must be set') unless self[:active]
end
autorequire(:anchor) do

View File

@ -22,7 +22,6 @@ describe 'basic trove' do
manager => 'mysql',
image_id => 'dummy',
packages => '',
active => 1,
}
EOS