Module: Conjur::Exists
Instance Method Summary collapse
Instance Method Details
#exists?(options = {}) ⇒ Boolean
3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/conjur/exists.rb', line 3 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 |