Module: Conjur::Exists
Instance Method Summary collapse
Instance Method Details
#exists?(options = {}) ⇒ Boolean
23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/conjur/exists.rb', line 23 def exists?( = {}) begin self.head() true rescue RestClient::Forbidden # rationale is: exists? should return true iff creating a resource with # the same name would fail (not by client's fault). Why it would fail # doesn't matter that much. # (Plus, currently it always 403s when the resource exists but is unaccessible.) true rescue RestClient::ResourceNotFound false end end |