Module: Scooter::Utilities::BeakerUtilities
- Extended by:
- Beaker::DSL
- Defined in:
- lib/scooter/utilities/beaker_utilities.rb
Class Method Summary collapse
-
.get_public_ip(host) ⇒ Object
Beaker and ec2 don’t play nice with getting the public ip.
- .pe_ca_cert_file(master) ⇒ Object
- .pe_hostcert(master) ⇒ Object
- .pe_private_key(master) ⇒ Object
Class Method Details
.get_public_ip(host) ⇒ Object
Beaker and ec2 don’t play nice with getting the public ip. It is only set during initial provision and can be over-ridden. If you also have to run the script several times, or are using an existing set of nodes for testing, beaker has no way to get the ec2 instanes public ip address, mostly because the box it self does not expose it anywhere. According to the docs, you can curl the below to get it docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-instance-addressing.html
12 13 14 15 16 17 18 |
# File 'lib/scooter/utilities/beaker_utilities.rb', line 12 def self.get_public_ip(host) if host['hypervisor'] == 'ec2' on(host, "curl http://169.254.169.254/latest/meta-data/public-ipv4").stdout else host.ip end end |
.pe_ca_cert_file(master) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/scooter/utilities/beaker_utilities.rb', line 20 def self.pe_ca_cert_file(master) ca_cert = on(master, "cat `puppet agent --configprint localcacert`", :silent => true).stdout 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 |
.pe_hostcert(master) ⇒ Object
36 37 38 |
# File 'lib/scooter/utilities/beaker_utilities.rb', line 36 def self.pe_hostcert(master) on(master, "cat `puppet agent --configprint hostcert`", :silent => true).stdout end |
.pe_private_key(master) ⇒ Object
32 33 34 |
# File 'lib/scooter/utilities/beaker_utilities.rb', line 32 def self.pe_private_key(master) on(master, "cat `puppet agent --configprint hostprivkey`", :silent => true).stdout end |