From d3c3ff0124529afe15fc9a8773b372a01ac953d5 Mon Sep 17 00:00:00 2001 From: Tobias Urdin Date: Wed, 12 Dec 2018 11:35:11 +0100 Subject: [PATCH] Fix module structure Fixes so that the top level structure of the modules conform to the puppet standard [1]. [1] https://puppet.com/docs/puppet/5.3/modules_fundamentals.html#module-structure Change-Id: I7bcccdd4ddfc5dbbfd74e1a161ec424a3f7c5be2 --- ext/keystone_test.rb | 55 ---------------------------------- ext/keystone_test_v3.rb | 64 ---------------------------------------- tests/site.pp | 65 ----------------------------------------- 3 files changed, 184 deletions(-) delete mode 100644 ext/keystone_test.rb delete mode 100644 ext/keystone_test_v3.rb delete mode 100644 tests/site.pp diff --git a/ext/keystone_test.rb b/ext/keystone_test.rb deleted file mode 100644 index 0d9b1f0b2..000000000 --- a/ext/keystone_test.rb +++ /dev/null @@ -1,55 +0,0 @@ -#!/usr/bin/env ruby -# this script verifies that keystone has -# been successfully installed using the instructions -# found here: https://docs.openstack.org/keystone/latest/configuration.html - -begin - require 'rubygems' -rescue - puts 'Could not require rubygems. This assumes puppet is not installed as a gem' -end -require 'open3' -require 'fileutils' -require 'puppet' - -username='admin' -password='admin_password' -# required to get a real services catalog -tenant='openstack' - -# shared secret -service_token='service_token' - -def run_command(cmd) - Open3.popen3(cmd) do |stdin, stdout, stderr| - begin - stdout = stdout.read - puts "Response from token request:#{stdout}" - return stdout - rescue Exception => e - puts "Request failed, this sh*t is borked :( : details: #{e}" - exit 1 - end - end -end - -puts `puppet apply -e "package {curl: ensure => present }"` - -get_token = %(curl -d '{"auth":{"passwordCredentials":{"username": "#{username}", "password": "#{password}"}}}' -H "Content-type: application/json" http://localhost:5000/v2.0/tokens) -token = nil - -puts "Running auth command: #{get_token}" -token = PSON.load(run_command(get_token))["access"]["token"]["id"] - -if token - puts "We were able to retrieve a token" - puts token - verify_token = "curl -H 'X-Auth-Token: #{service_token}' http://localhost:5000/v2.0/tokens/#{token}" - puts 'verifying token' - run_command(verify_token) - ['endpoints', 'tenants', 'users'].each do |x| - puts "getting #{x}" - get_keystone_data = "curl -H 'X-Auth-Token: #{service_token}' http://localhost:5000/v2.0/#{x}" - run_command(get_keystone_data) - end -end diff --git a/ext/keystone_test_v3.rb b/ext/keystone_test_v3.rb deleted file mode 100644 index 7d4e99cbc..000000000 --- a/ext/keystone_test_v3.rb +++ /dev/null @@ -1,64 +0,0 @@ -#!/usr/bin/env ruby -# this script verifies that keystone has -# been successfully installed using the instructions -# found here: https://docs.openstack.org/keystone/latest/configuration.html -# and can use the v3 api http://developer.openstack.org/api-ref-identity-v3.html - -begin - require 'rubygems' -rescue - puts 'Could not require rubygems. This assumes puppet is not installed as a gem' -end -require 'open3' -require 'fileutils' -require 'puppet' -require 'pp' - -username='admin' -password='a_big_secret' -# required to get a real services catalog -project='openstack' -user_domain='admin' -project_domain='admin' - -# shared secret -service_token='admin_token' - -def run_command(cmd) - Open3.popen3(cmd) do |stdin, stdout, stderr| - begin - stdout = stdout.read - puts "Response from token request:#{stdout}" - return stdout - rescue Exception => e - puts "Request failed, this sh*t is borked :( : details: #{e}" - exit 1 - end - end -end - -puts `puppet apply -e "package {curl: ensure => present }"` -get_token = %(curl -D - -d '{"auth":{"identity":{"methods":["password"],"password":{"user":{"domain":{"name":"#{user_domain}"},"name":"#{username}","password": "#{password}"}}},"scope":{"project":{"domain":{"name":"#{project_domain}"},"name": "#{project}"}}}}' -H "Content-type: application/json" http://localhost:5000/v3/auth/tokens) -token = nil - -puts "Running auth command: #{get_token}" -rawoutput = run_command(get_token) -if rawoutput =~ /X-Subject-Token: ([\w]+)/ - token = $1 -else - puts "No token in output! #{rawoutput}" - exit 1 -end - -if token - puts "We were able to retrieve a token" - puts token - verify_token = "curl -H 'X-Auth-Token: #{service_token}' 'X-Subject-Token: #{token}' http://localhost:5000/v3/auth/tokens" - puts 'verifying token' - run_command(verify_token) - ['endpoints', 'projects', 'users'].each do |x| - puts "getting #{x}" - get_keystone_data = "curl -H 'X-Auth-Token: #{token}' http://localhost:5000/v3/#{x}" - pp PSON.load(run_command(get_keystone_data)) - end -end diff --git a/tests/site.pp b/tests/site.pp deleted file mode 100644 index fffeebac4..000000000 --- a/tests/site.pp +++ /dev/null @@ -1,65 +0,0 @@ -Exec { logoutput => 'on_failure' } - -package { 'curl': ensure => present } - -# example of how to build a single node -# keystone instance backed by sqlite -# with all of the default admin roles -node 'keystone_sqlite' { - class { '::keystone': - debug => true, - catalog_type => 'sql', - admin_token => 'admin_token', - } - class { '::keystone::roles::admin': - email => 'example@abc.com', - password => 'ChangeMe', - } - class { '::keystone::endpoint': - public_url => "http://${::fqdn}:5000/", - admin_url => "http://${::fqdn}:5000/", - } -} - -node 'keystone_mysql' { - class { '::mysql::server': } - class { '::keystone::db::mysql': - password => 'keystone', - } - class { '::keystone': - debug => true, - database_connection => 'mysql://keystone:keystone@127.0.0.1/keystone', - catalog_type => 'sql', - admin_token => 'admin_token', - } - class { '::keystone::roles::admin': - email => 'test@puppetlabs.com', - password => 'ChangeMe', - } -} - - -# keystone with mysql on another node -node 'keystone' { - class { '::keystone': - debug => true, - database_connection => 'mysql://keystone:password@127.0.0.1/keystone', - catalog_type => 'sql', - admin_token => 'admin_token', - } - class { '::keystone::db::mysql': - password => 'keystone', - } - class { '::keystone::roles::admin': - email => 'example@abc.com', - password => 'ChangeMe', - } - class { '::keystone::endpoint': - public_url => "http://${::fqdn}:5000/", - admin_url => "http://${::fqdn}:5000/", - } -} - -node default { - fail("could not find a matching node entry for ${clientcert}") -}