Module: Beaker::Http::Helpers
- Included in:
- Connection
- Defined in:
- lib/beaker-http/helpers/puppet_helpers.rb
Instance Method Summary collapse
-
#get_host_cacert(host) ⇒ String
Given a Beaker::Host object, introspect the host for the CA cert and save it to the coordinator’s filesystem.
-
#get_host_cert(host) ⇒ String
Given a Beaker::Host object, introspect the host for the host cert and save it to the coordinator’s filesystem.
-
#get_host_private_key(host) ⇒ String
Given a Beaker::Host object, introspect the host for the private key and save it to the coordinator’s filesystem.
Instance Method Details
#get_host_cacert(host) ⇒ String
Given a Beaker::Host object, introspect the host for the CA cert and save it to the coordinator’s filesystem.
9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/beaker-http/helpers/puppet_helpers.rb', line 9 def get_host_cacert(host) cacert_on_host= host.puppet['localcacert'] # puppet may not have laid down the cacert yet, so check to make sure # the file exists host.execute("test -f #{cacert_on_host}") ca_cert = host.execute("cat #{cacert_on_host}", :silent => true) cert_dir = Dir.mktmpdir("pe_certs") ca_cert_file = File.join(cert_dir, "cacert.pem") File.open(ca_cert_file, "w+") do |f| f.write(ca_cert) end ca_cert_file end |
#get_host_cert(host) ⇒ String
Given a Beaker::Host object, introspect the host for the host cert and save it to the coordinator’s filesystem.
39 40 41 42 43 44 45 |
# File 'lib/beaker-http/helpers/puppet_helpers.rb', line 39 def get_host_cert(host) hostcert = host.puppet['hostcert'] # puppet may not have laid down the hostcert yet, so check to make sure # the file exists host.execute("test -f #{hostcert}") host.execute("cat #{hostcert}", :silent => true) end |
#get_host_private_key(host) ⇒ String
Given a Beaker::Host object, introspect the host for the private key and save it to the coordinator’s filesystem.
27 28 29 30 31 32 33 |
# File 'lib/beaker-http/helpers/puppet_helpers.rb', line 27 def get_host_private_key(host) private_key = host.puppet['hostprivkey'] # puppet may not have laid down the private_key yet, so check to make sure # the file exists host.execute("test -f #{private_key}") host.execute("cat #{private_key}", :silent => true) end |