Sha256: cafba69c350c0ee6321ecf9b4614268d63a3aaa83a9a7cbe6178d4fcf9f1fa88

Contents?: true

Size: 1.45 KB

Versions: 21

Compression:

Stored size: 1.45 KB

Contents

module Scooter
  module Utilities
    module BeakerUtilities
      extend Beaker::DSL

      # 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
      # http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-instance-addressing.html
      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

      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

      def self.pe_private_key(master)
        on(master, "cat `puppet agent --configprint hostprivkey`", :silent => true).stdout
      end

      def self.pe_hostcert(master)
        on(master, "cat `puppet agent --configprint hostcert`", :silent => true).stdout
      end
    end
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
scooter-4.5.4 lib/scooter/utilities/beaker_utilities.rb
scooter-4.5.3 lib/scooter/utilities/beaker_utilities.rb
scooter-4.5.2 lib/scooter/utilities/beaker_utilities.rb
scooter-4.5.1 lib/scooter/utilities/beaker_utilities.rb
scooter-4.5.0 lib/scooter/utilities/beaker_utilities.rb
scooter-4.4.0 lib/scooter/utilities/beaker_utilities.rb
scooter-4.3.2 lib/scooter/utilities/beaker_utilities.rb
scooter-4.3.1 lib/scooter/utilities/beaker_utilities.rb
scooter-4.3.0 lib/scooter/utilities/beaker_utilities.rb
scooter-4.2.9 lib/scooter/utilities/beaker_utilities.rb
scooter-4.2.8 lib/scooter/utilities/beaker_utilities.rb
scooter-4.2.7 lib/scooter/utilities/beaker_utilities.rb
scooter-4.2.6 lib/scooter/utilities/beaker_utilities.rb
scooter-4.2.5 lib/scooter/utilities/beaker_utilities.rb
scooter-4.2.4 lib/scooter/utilities/beaker_utilities.rb
scooter-4.2.3 lib/scooter/utilities/beaker_utilities.rb
scooter-4.2.2 lib/scooter/utilities/beaker_utilities.rb
scooter-4.2.1 lib/scooter/utilities/beaker_utilities.rb
scooter-4.2.0 lib/scooter/utilities/beaker_utilities.rb
scooter-3.2.19 lib/scooter/utilities/beaker_utilities.rb