Class: Puppetfactory::Plugins::Certificates
- Inherits:
-
Puppetfactory::Plugins
- Object
- Puppetfactory::Plugins
- Puppetfactory::Plugins::Certificates
- Defined in:
- lib/puppetfactory/plugins/certificates.rb
Instance Attribute Summary
Attributes inherited from Puppetfactory::Plugins
Instance Method Summary collapse
- #delete(username) ⇒ Object
-
#initialize(options) ⇒ Certificates
constructor
A new instance of Certificates.
- #repair(username) ⇒ Object
Constructor Details
#initialize(options) ⇒ Certificates
Returns a new instance of Certificates.
4 5 6 7 8 9 |
# File 'lib/puppetfactory/plugins/certificates.rb', line 4 def initialize() super() @puppet = [:puppet] @suffix = [:usersuffix] end |
Instance Method Details
#delete(username) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/puppetfactory/plugins/certificates.rb', line 11 def delete(username) certname = "#{username}.#{@suffix}" output, status = Open3.capture2e('puppet', 'cert', 'clean', certname) unless status.success? $logger.warn "Error cleaning certificate #{certname}: #{output}" return false end $logger.info "Certificate #{certname} removed" true end |
#repair(username) ⇒ Object
24 25 26 |
# File 'lib/puppetfactory/plugins/certificates.rb', line 24 def repair(username) delete(username) end |