Class: Commands
- Inherits:
-
Object
- Object
- Commands
- Defined in:
- lib/puppetclassify/commands.rb
Instance Method Summary collapse
-
#initialize(nc_api_url, puppet_https) ⇒ Commands
constructor
A new instance of Commands.
- #unpin_from_all(nodes) ⇒ Object
Constructor Details
#initialize(nc_api_url, puppet_https) ⇒ Commands
Returns a new instance of Commands.
5 6 7 8 |
# File 'lib/puppetclassify/commands.rb', line 5 def initialize(nc_api_url, puppet_https) @puppet_https = puppet_https @nc_api_url = nc_api_url end |
Instance Method Details
#unpin_from_all(nodes) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/puppetclassify/commands.rb', line 10 def unpin_from_all(nodes) all_nodes = {} all_nodes['nodes'] = nodes response = @puppet_https.post("#{@nc_api_url}/v1/commands/unpin-from-all", all_nodes.to_json) unless response.code.to_i != 200 nodez = JSON.parse(response.body) else STDERR.puts "An error occured with your request: HTTP #{response.code} #{response.}" STDERR.puts response.body end end |