Sha256: 975e3bea5eb7111f8b93eace6a78111257275d2370af3752a176bccfc2240f54

Contents?: true

Size: 598 Bytes

Versions: 17

Compression:

Stored size: 598 Bytes

Contents

require 'puppetfactory'
class Puppetfactory::Plugins::Certificates < Puppetfactory::Plugins

  def initialize(options)
    super(options)

    @puppet = options[:puppet]
    @suffix = options[:usersuffix]
  end

  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

  def repair(username)
    delete(username)
  end

end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
puppetfactory-0.6.5 lib/puppetfactory/plugins/certificates.rb
puppetfactory-0.6.4 lib/puppetfactory/plugins/certificates.rb
puppetfactory-0.6.3 lib/puppetfactory/plugins/certificates.rb
puppetfactory-0.6.2 lib/puppetfactory/plugins/certificates.rb
puppetfactory-0.6.1 lib/puppetfactory/plugins/certificates.rb
puppetfactory-0.6.0 lib/puppetfactory/plugins/certificates.rb
puppetfactory-0.5.9 lib/puppetfactory/plugins/certificates.rb
puppetfactory-0.5.8 lib/puppetfactory/plugins/certificates.rb
puppetfactory-0.5.7 lib/puppetfactory/plugins/certificates.rb
puppetfactory-0.5.6 lib/puppetfactory/plugins/certificates.rb
puppetfactory-0.5.5 lib/puppetfactory/plugins/certificates.rb
puppetfactory-0.5.4 lib/puppetfactory/plugins/certificates.rb
puppetfactory-0.5.3 lib/puppetfactory/plugins/certificates.rb
puppetfactory-0.5.2 lib/puppetfactory/plugins/certificates.rb
puppetfactory-0.5.1 lib/puppetfactory/plugins/certificates.rb
puppetfactory-0.5.0 lib/puppetfactory/plugins/certificates.rb
puppetfactory-0.4.0 lib/puppetfactory/plugins/certificates.rb