Skip to content

Commit

Permalink
Merge pull request #399 from cbntss/ensure_absent
Browse files Browse the repository at this point in the history
Don't require certificate or private key params when ensure: absent
  • Loading branch information
chelnak authored May 24, 2022
2 parents 7048b5a + eb0df8b commit b51a8e4
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions lib/puppet/type/java_ks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -240,16 +240,18 @@ def self.title_patterns
end

validate do
unless value(:certificate) || value(:certificate_content)
raise Puppet::Error, "You must pass one of 'certificate' or 'certificate_content'"
end
if self[:ensure] != :absent
unless value(:certificate) || value(:certificate_content)
raise Puppet::Error, "You must pass one of 'certificate' or 'certificate_content'"
end

if value(:certificate) && value(:certificate_content)
raise Puppet::Error, "You must pass either 'certificate' or 'certificate_content', not both."
end
if value(:certificate) && value(:certificate_content)
raise Puppet::Error, "You must pass either 'certificate' or 'certificate_content', not both."
end

if value(:private_key) && value(:private_key_content)
raise Puppet::Error, "You must pass either 'private_key' or 'private_key_content', not both."
if value(:private_key) && value(:private_key_content)
raise Puppet::Error, "You must pass either 'private_key' or 'private_key_content', not both."
end
end

if value(:password) && value(:password_file)
Expand Down

0 comments on commit b51a8e4

Please sign in to comment.