Module: HammerCLIForeman::ResourceSupportedTest

Instance Method Summary collapse

Instance Method Details

#executeObject



7
8
9
10
11
12
13
# File 'lib/hammer_cli_foreman/resource_supported_test.rb', line 7

def execute
  if resource_supported?
    super
  else
    raise OperationNotSupportedError, _("The server does not support such operation.")
  end
end

#resource_supported?Boolean

Returns:

  • (Boolean)


15
16
17
18
19
20
# File 'lib/hammer_cli_foreman/resource_supported_test.rb', line 15

def resource_supported?
  resource.call(:index)
  true
rescue RestClient::ResourceNotFound
  false
end