Use boolean for refreshonly
Puppet::Type supports `:boolean => true` to create a `resource.<property>?` method that is true or false based on the `:true`, `:false`, `true`, or `false` value of the parameter. This will allow accurate assesment of the refreshonly attribute for testing.
This commit is contained in:
parent
b2b9b13df8
commit
8919359bca
2 changed files with 4 additions and 3 deletions
|
@ -2,7 +2,7 @@ Puppet::Type.type(:postgresql_psql).provide(:ruby) do
|
|||
|
||||
def command()
|
||||
if ((! resource[:unless]) or (resource[:unless].empty?))
|
||||
if (resource[:refreshonly])
|
||||
if (resource.refreshonly?)
|
||||
# So, if there's no 'unless', and we're in "refreshonly" mode,
|
||||
# we need to return the target command here. If we don't,
|
||||
# then Puppet will generate an event indicating that this
|
||||
|
|
|
@ -24,7 +24,7 @@ Puppet::Type.newtype(:postgresql_psql) do
|
|||
# method, and then inside of the body of 'sync' we can tell
|
||||
# whether or not we're refreshing.
|
||||
|
||||
if ((@resource[:refreshonly] == :false) || refreshing)
|
||||
if (!@resource.refreshonly? || refreshing)
|
||||
# If we're not in 'refreshonly' mode, or we're not currently
|
||||
# refreshing, then we just call the parent method.
|
||||
super()
|
||||
|
@ -69,10 +69,11 @@ Puppet::Type.newtype(:postgresql_psql) do
|
|||
defaultto("/tmp")
|
||||
end
|
||||
|
||||
newparam(:refreshonly) do
|
||||
newparam(:refreshonly, :boolean => true) do
|
||||
desc "If 'true', then the SQL will only be executed via a notify/subscribe event."
|
||||
|
||||
defaultto(:false)
|
||||
newvalues(:true, :false)
|
||||
end
|
||||
|
||||
def refresh()
|
||||
|
|
Loading…
Reference in a new issue