Module: Proxy::Salt

Defined in:
lib/smart_proxy_salt/salt.rb,
lib/smart_proxy_salt/cli.rb,
lib/smart_proxy_salt/rest.rb,
lib/smart_proxy_salt/version.rb,
lib/smart_proxy_salt/salt_api.rb,
lib/smart_proxy_salt/api_request.rb,
lib/smart_proxy_salt/salt_runner.rb,
lib/smart_proxy_salt/salt_task_launcher.rb

Overview

Salt module

Defined Under Namespace

Modules: CLI, Rest Classes: Api, ApiError, ApiRequest, ConfigurationError, NotFound, Plugin, SaltRunner, SaltTaskLauncher

Constant Summary collapse

VERSION =
'5.0.1'.freeze

Class Method Summary collapse

Class Method Details

.method_missing(m, *args, &block) ⇒ Object



37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/smart_proxy_salt/salt.rb', line 37

def method_missing(m, *args, &block)
  # Use API, if it supports it, otherwise fallback to the CLI
  if Proxy::Salt::Plugin.settings.use_api && Proxy::Salt::Rest.respond_to?(m)
    Proxy::Salt::Rest.send(m, *args, &block)
  elsif Proxy::Salt::CLI.respond_to?(m)
    Proxy::Salt::CLI.send(m, *args, &block)
  elsif !Proxy::Salt::Plugin.settings.use_api && Proxy::Salt::Rest.respond_to?(m)
    raise NotImplementedError.new('You must enable the Salt API to use this feature.')
  else
    super
  end
end

.respond_to_missing?(method, include_private = false) ⇒ Boolean

Returns:

  • (Boolean)


50
51
52
# File 'lib/smart_proxy_salt/salt.rb', line 50

def respond_to_missing?(method, include_private = false)
  Proxy::Salt::Rest.respond_to?(method) || Proxy::Salt::CLI.respond_to?(method) || super
end