Module: ForemanChef::Concerns::SmartProxyExtensions
- Extended by:
- ActiveSupport::Concern
- Defined in:
- app/models/foreman_chef/concerns/smart_proxy_extensions.rb
Class Method Summary collapse
Instance Method Summary collapse
- #create_client(fqdn) ⇒ Object
- #delete_client(fqdn) ⇒ Object
- #delete_node(fqdn) ⇒ Object
- #show_client(fqdn) ⇒ Object
-
#show_node(fqdn) ⇒ Object
create or overwrite instance methods…
- #taxonomy_foreign_conditions ⇒ Object
- #update_node(fqdn, attributes) ⇒ Object
Class Method Details
.prepended(base) ⇒ Object
6 7 8 |
# File 'app/models/foreman_chef/concerns/smart_proxy_extensions.rb', line 6 def self.prepended(base) base.has_many :chef_environments, :class_name => "::ForemanChef::Environment", :foreign_key => 'chef_proxy_id' end |
Instance Method Details
#create_client(fqdn) ⇒ Object
50 51 52 53 54 55 |
# File 'app/models/foreman_chef/concerns/smart_proxy_extensions.rb', line 50 def create_client(fqdn) begin reply = ProxyAPI::ForemanChef::ChefProxy.new(:url => url).create_client(fqdn) JSON.parse(reply) end end |
#delete_client(fqdn) ⇒ Object
57 58 59 60 61 62 63 |
# File 'app/models/foreman_chef/concerns/smart_proxy_extensions.rb', line 57 def delete_client(fqdn) begin reply = ProxyAPI::ForemanChef::ChefProxy.new(:url => url).delete_client(fqdn) JSON.parse(reply) #rescue RestClient:: end end |
#delete_node(fqdn) ⇒ Object
34 35 36 37 38 39 40 |
# File 'app/models/foreman_chef/concerns/smart_proxy_extensions.rb', line 34 def delete_node(fqdn) begin reply = ProxyAPI::ForemanChef::ChefProxy.new(:url => url).delete_node(fqdn) JSON.parse(reply) #rescue RestClient:: end end |
#show_client(fqdn) ⇒ Object
42 43 44 45 46 47 48 |
# File 'app/models/foreman_chef/concerns/smart_proxy_extensions.rb', line 42 def show_client(fqdn) reply = ProxyAPI::ForemanChef::ChefProxy.new(:url => url).show_client(fqdn) JSON.parse(reply) rescue RestClient::ResourceNotFound Foreman::Logging.logger('foreman_chef').debug "Client '#{fqdn}' not found" return false end |
#show_node(fqdn) ⇒ Object
create or overwrite instance methods…
19 20 21 22 23 24 25 |
# File 'app/models/foreman_chef/concerns/smart_proxy_extensions.rb', line 19 def show_node(fqdn) reply = ProxyAPI::ForemanChef::ChefProxy.new(:url => url).show_node(fqdn) JSON.parse(reply) rescue RestClient::ResourceNotFound Foreman::Logging.logger('foreman_chef').debug "Node '#{fqdn}' not found" return false end |
#taxonomy_foreign_conditions ⇒ Object
10 11 12 13 14 15 16 |
# File 'app/models/foreman_chef/concerns/smart_proxy_extensions.rb', line 10 def taxonomy_foreign_conditions conditions = super if has_feature?('Chef') conditions[:chef_proxy_id] = id end conditions end |
#update_node(fqdn, attributes) ⇒ Object
27 28 29 30 31 32 |
# File 'app/models/foreman_chef/concerns/smart_proxy_extensions.rb', line 27 def update_node(fqdn, attributes) begin reply = ProxyAPI::ForemanChef::ChefProxy.new(:url => url).update_node(fqdn, attributes) JSON.parse(reply) end end |