2 # this script verifies that keystone has
3 # been successfully installed using the instructions
4 # found here: http://keystone.openstack.org/configuration.html
9 puts 'Could not require rubygems. This assumes puppet is not installed as a gem'
16 password='admin_password'
17 # required to get a real services catalog
21 service_token='service_token'
24 Open3.popen3(cmd) do |stdin, stdout, stderr|
27 puts "Response from token request:#{stdout}"
30 puts "Request failed, this sh*t is borked :( : details: #{e}"
36 puts `puppet apply -e "package {curl: ensure => present }"`
38 get_token = %(curl -d '{"auth":{"passwordCredentials":{"username": "#{username}", "password": "#{password}"}}}' -H "Content-type: application/json" http://localhost:35357/v2.0/tokens)
41 puts "Running auth command: #{get_token}"
42 token = PSON.load(run_command(get_token))["access"]["token"]["id"]
45 puts "We were able to retrieve a token"
47 verify_token = "curl -H 'X-Auth-Token: #{service_token}' http://localhost:35357/v2.0/tokens/#{token}"
48 puts 'verifying token'
49 run_command(verify_token)
50 ['endpoints', 'tenants', 'users'].each do |x|
52 get_keystone_data = "curl -H 'X-Auth-Token: #{service_token}' http://localhost:35357/v2.0/#{x}"
53 run_command(get_keystone_data)