Class: Provider::ChefServer::Client
- Inherits:
-
Object
- Object
- Provider::ChefServer::Client
- Defined in:
- lib/providers/chefserver/client.rb
Instance Method Summary collapse
- #destroy(name = nil) ⇒ Object
- #exists? ⇒ Boolean
-
#initialize(name) ⇒ Client
constructor
A new instance of Client.
Constructor Details
Instance Method Details
#destroy(name = nil) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/providers/chefserver/client.rb', line 10 def destroy(name=nil) @logger.info "Destroying client #{@name} from chef-server ..." knife = Chef::Knife.new() knife.config[:yes] = true if self.exists? knife.delete_object(Chef::ApiClient, @name) @logger.info "Client #{@name} destroy from chef-server" else @logger.info "Unabled to find client #{@name}" end end |
#exists? ⇒ Boolean
22 23 24 25 26 27 28 29 |
# File 'lib/providers/chefserver/client.rb', line 22 def exists? begin Chef::ApiClient.load(@name) rescue return false end return true end |