From 5fff5a49648c55de7f416f452d6c667a923dfdf0 Mon Sep 17 00:00:00 2001 From: Ivan Zinoviev Date: Tue, 18 Jul 2017 20:29:21 +0300 Subject: [PATCH] Import plugin's code Change-Id: I8d7f3d88401eadfb627795c4dc72ec1b8a1d9769 --- LICENSE | 201 ++++ .../puppet/manifests/tempest_install.pp | 52 ++ .../puppet/manifests/tempest_run.pp | 35 + .../puppet/modules/openstacklib/.gitignore | 15 + .../puppet/modules/openstacklib/.gitreview | 4 + .../puppet/modules/openstacklib/CHANGELOG.md | 78 ++ .../puppet/modules/openstacklib/Gemfile | 21 + .../puppet/modules/openstacklib/LICENSE | 13 + .../puppet/modules/openstacklib/README.md | 333 +++++++ .../puppet/modules/openstacklib/Rakefile | 1 + .../puppet/modules/openstacklib/bindep.txt | 0 .../openstacklib/examples/virtual_packages.pp | 11 + .../facts.d/os_service_default.txt | 1 + .../lib/facter/os_package_type.rb | 38 + .../lib/facter/os_service_default.rb | 14 + .../openstacklib/lib/facter/os_workers.rb | 50 + .../parser/functions/is_service_default.rb | 27 + .../parser/functions/normalize_ip_for_uri.rb | 37 + .../functions/os_database_connection.rb | 81 ++ .../parser/functions/os_transport_url.rb | 157 ++++ .../lib/puppet/provider/openstack.rb | 153 +++ .../lib/puppet/provider/openstack/auth.rb | 51 + .../puppet/provider/openstack/credentials.rb | 95 ++ .../provider/openstack_config/ini_setting.rb | 73 ++ .../puppet/provider/openstack_config/ruby.rb | 94 ++ .../puppet/provider/policy_rcd/policy_rcd.rb | 91 ++ .../lib/puppet/type/openstack_config.rb | 3 + .../lib/puppet/type/policy_rcd.rb | 21 + .../lib/puppet/util/openstackconfig.rb | 117 +++ .../puppet/util/openstackconfig/section.rb | 178 ++++ .../openstacklib/manifests/db/mysql.pp | 91 ++ .../manifests/db/mysql/host_access.pp | 63 ++ .../openstacklib/manifests/db/postgresql.pp | 47 + .../openstacklib/manifests/defaults.pp | 14 + .../manifests/messaging/rabbitmq.pp | 105 +++ .../openstacklib/manifests/openstackclient.pp | 15 + .../modules/openstacklib/manifests/policy.pp | 19 + .../openstacklib/manifests/policy/base.pp | 45 + .../openstacklib/manifests/policyrcd.pp | 43 + .../manifests/service_validation.pp | 99 ++ .../openstacklib/manifests/wsgi/apache.pp | 248 +++++ .../puppet/modules/openstacklib/metadata.json | 73 ++ ...-mysql-user-creation-172536d7f3963ce2.yaml | 6 + .../bugfix-1664561-f5964a3777b9ed93.yaml | 4 + .../notes/catch_403-237b79f33ab3364f.yaml | 3 + ...t_config_placeholder-280f69c0edbf76c6.yaml | 12 + ...n_to_retry_mechanism-2acb52fa25bd315c.yaml | 5 + .../feature_add_transform_for_config.yaml | 5 + .../ipv6_array_support-ea28cf0939e820f6.yaml | 4 + .../notes/ipv6_brackets-7a453aea5e091855.yaml | 6 + ...age_policy_rc_d_file-747510db06792d52.yaml | 11 + .../more_db_options-d96316ae4eb5a78c.yaml | 4 + ...-and-grants-optional-fd34f4686d44aec3.yaml | 9 + ...nsport-alt-transport-7cd300380ece2fc9.yaml | 4 + .../os_transport_url-b6fe15a8f21d387b.yaml | 4 + .../os_workers-fact-0ce731f0536c2792.yaml | 12 + .../os_workers-fact-420e6ad783cba982.yaml | 6 + ...ers_for_worker_count-34eb55ddf55f4a11.yaml | 5 + .../policy_rcd_provider-1ef3d203b9af1110.yaml | 3 + .../notes/retry_client-b8a0e1f9ff679281.yaml | 7 + ...on_name_in_providers-cde6d75f0ddbec28.yaml | 4 + .../notes/use-reno-1caaec4ba5aa4285.yaml | 4 + .../releasenotes/source/_static/.placeholder | 0 .../openstacklib/releasenotes/source/conf.py | 262 ++++++ .../releasenotes/source/index.rst | 21 + .../releasenotes/source/mitaka.rst | 6 + .../releasenotes/source/newton.rst | 6 + .../releasenotes/source/ocata.rst | 6 + .../releasenotes/source/unreleased.rst | 5 + .../puppet/modules/openstacklib/setup.cfg | 13 + .../puppet/modules/openstacklib/setup.py | 22 + .../spec/acceptance/defaults_spec.rb | 7 + .../spec/acceptance/mysql_spec.rb | 35 + .../acceptance/nodesets/centos-70-x64.yml | 11 + .../spec/acceptance/nodesets/default.yml | 10 + .../acceptance/nodesets/nodepool-centos7.yml | 10 + .../acceptance/nodesets/nodepool-trusty.yml | 10 + .../acceptance/nodesets/nodepool-xenial.yml | 10 + .../nodesets/ubuntu-server-1404-x64.yml | 11 + .../openstacklib_config_provider_spec.rb | 57 ++ .../spec/acceptance/rabbitmq_spec.rb | 55 ++ .../classes/openstacklib_defaults_spec.rb | 33 + .../spec/classes/openstacklib_policy_spec.rb | 41 + .../classes/openstacklib_policyrcd_spec.rb | 102 ++ .../openstacklib_db_mysql_host_access_spec.rb | 102 ++ .../defines/openstacklib_db_mysql_spec.rb | 229 +++++ .../openstacklib_db_postgresql_spec.rb | 81 ++ .../openstacklib_messaging_rabbitmq_spec.rb | 98 ++ .../spec/defines/openstacklib_policy_spec.rb | 54 ++ .../openstacklib_service_validation_spec.rb | 117 +++ .../defines/openstacklib_wsgi_apache_spec.rb | 161 ++++ .../spec/functions/is_service_default_spec.rb | 40 + .../functions/normalize_ip_for_uri_spec.rb | 15 + .../functions/os_database_connection_spec.rb | 157 ++++ .../spec/functions/os_transport_url_spec.rb | 324 +++++++ .../openstacklib/spec/shared_examples.rb | 5 + .../modules/openstacklib/spec/spec_helper.rb | 10 + .../spec/spec_helper_acceptance.rb | 1 + .../spec/unit/provider/openstack/auth_spec.rb | 241 +++++ .../provider/openstack/credentials_spec.rb | 160 ++++ .../openstack_config/ini_setting_spec.rb | 113 +++ .../spec/unit/provider/openstack_spec.rb | 182 ++++ .../provider/policy_rcd/policy_rcd_spec.rb | 137 +++ .../unit/puppet/util/openstackconfig_spec.rb | 322 +++++++ .../spec/unit/type/policy_rcd_spec.rb | 25 + .../openstacklib/templates/policy-rc.d.erb | 8 + .../openstacklib/test-requirements.txt | 7 + .../puppet/modules/openstacklib/tox.ini | 8 + .../puppet/modules/oslo/.gitignore | 11 + .../puppet/modules/oslo/.gitreview | 4 + .../puppet/modules/oslo/Gemfile | 21 + .../puppet/modules/oslo/LICENSE | 13 + .../puppet/modules/oslo/README.md | 111 +++ .../puppet/modules/oslo/Rakefile | 1 + .../puppet/modules/oslo/bindep.txt | 0 .../provider/oslo_config/ini_setting.rb | 10 + .../oslo/lib/puppet/type/oslo_config.rb | 53 ++ .../puppet/modules/oslo/manifests/cache.pp | 182 ++++ .../modules/oslo/manifests/concurrency.pp | 30 + .../puppet/modules/oslo/manifests/cors.pp | 60 ++ .../puppet/modules/oslo/manifests/db.pp | 203 ++++ .../puppet/modules/oslo/manifests/init.pp | 14 + .../puppet/modules/oslo/manifests/log.pp | 157 ++++ .../modules/oslo/manifests/messaging/amqp.pp | 184 ++++ .../oslo/manifests/messaging/default.pp | 42 + .../oslo/manifests/messaging/notifications.pp | 54 ++ .../oslo/manifests/messaging/rabbit.pp | 233 +++++ .../modules/oslo/manifests/messaging/zmq.pp | 119 +++ .../modules/oslo/manifests/middleware.pp | 29 + .../puppet/modules/oslo/manifests/params.pp | 27 + .../puppet/modules/oslo/manifests/policy.pp | 45 + .../puppet/modules/oslo/manifests/privsep.pp | 59 ++ ...mq-connection-params-1a8ace0c23e7249e.yaml | 6 + .../puppet/modules/oslo/manifests/service.pp | 141 +++ .../oslo/manifests/versionedobjects.pp | 18 + .../puppet/modules/oslo/metadata.json | 61 ++ .../add_oslo_privsep-3f125445bce8b431.yaml | 4 + .../add_zmq_messaging-7ea20df747c78035.yaml | 3 + ...ckend_package_ensure-54b4525895ce9acd.yaml | 6 + ...ate_config_sqlite_db-1a239175d42378e3.yaml | 7 + .../notes/first_release-a7268e1c8959eca3.yaml | 3 + ...og_dir_documentation-050052366584e83e.yaml | 3 + .../remove_verbose-0b599cd4810a8c51.yaml | 4 + ...secure-transport-url-d67d307cf85a16b1.yaml | 3 + .../update-amqp-opts-1f14b8d3648b2b30.yaml | 3 + .../releasenotes/source/_static/.placeholder | 0 .../modules/oslo/releasenotes/source/conf.py | 262 ++++++ .../oslo/releasenotes/source/index.rst | 20 + .../oslo/releasenotes/source/newton.rst | 6 + .../oslo/releasenotes/source/ocata.rst | 6 + .../oslo/releasenotes/source/unreleased.rst | 5 + .../puppet/modules/oslo/setup.cfg | 13 + .../puppet/modules/oslo/setup.py | 22 + .../acceptance/nodesets/centos-70-x64.yml | 11 + .../oslo/spec/acceptance/nodesets/default.yml | 10 + .../acceptance/nodesets/nodepool-centos7.yml | 10 + .../acceptance/nodesets/nodepool-trusty.yml | 10 + .../acceptance/nodesets/nodepool-xenial.yml | 10 + .../nodesets/ubuntu-server-1404-x64.yml | 11 + .../oslo/spec/classes/oslo_init_spec.rb | 15 + .../oslo/spec/defines/oslo_cache_spec.rb | 136 +++ .../spec/defines/oslo_concurrency_spec.rb | 42 + .../oslo/spec/defines/oslo_cors_spec.rb | 33 + .../modules/oslo/spec/defines/oslo_db_spec.rb | 191 ++++ .../oslo/spec/defines/oslo_log_spec.rb | 100 ++ .../spec/defines/oslo_messaging_amqp_spec.rb | 76 ++ .../defines/oslo_messaging_default_spec.rb | 46 + .../oslo_messaging_notifications_spec.rb | 59 ++ .../defines/oslo_messaging_rabbit_spec.rb | 213 +++++ .../spec/defines/oslo_messaging_zmq_spec.rb | 66 ++ .../oslo/spec/defines/oslo_middleware_spec.rb | 43 + .../oslo/spec/defines/oslo_policy_spec.rb | 57 ++ .../oslo/spec/defines/oslo_privsep_spec.rb | 53 ++ .../oslo/spec/defines/oslo_service_spec.rb | 88 ++ .../defines/oslo_versionedobjects_spec.rb | 40 + .../modules/oslo/spec/shared_examples.rb | 5 + .../puppet/modules/oslo/spec/spec_helper.rb | 10 + .../oslo/spec/spec_helper_acceptance.rb | 1 + .../provider/oslo_config/ini_setting_spec.rb | 68 ++ .../oslo/spec/unit/type/oslo_config_spec.rb | 64 ++ .../puppet/modules/oslo/test-requirements.txt | 7 + .../puppet/modules/oslo/tests/init.pp | 12 + .../puppet/modules/oslo/tox.ini | 8 + .../puppet/modules/tempest/.rspec | 2 + .../puppet/modules/tempest/CHANGELOG.md | 89 ++ .../puppet/modules/tempest/Gemfile | 21 + .../puppet/modules/tempest/LICENSE | 13 + .../puppet/modules/tempest/README.md | 29 + .../puppet/modules/tempest/Rakefile | 1 + .../puppet/modules/tempest/bindep.txt | 0 .../tempest/lib/puppet/provider/tempest.rb | 51 + .../provider/tempest_config/ini_setting.rb | 10 + .../tempest_ec2_credentials/openstack.rb | 85 ++ .../tempest_glance_id_setter/openstack.rb | 88 ++ .../openstack.rb | 87 ++ .../tempest/lib/puppet/type/tempest_config.rb | 62 ++ .../puppet/type/tempest_ec2_credentials.rb | 24 + .../puppet/type/tempest_glance_id_setter.rb | 26 + .../type/tempest_neutron_net_id_setter.rb | 20 + .../modules/tempest/manifests/config.pp | 37 + .../puppet/modules/tempest/manifests/init.pp | 877 ++++++++++++++++++ .../modules/tempest/manifests/params.pp | 90 ++ .../puppet/modules/tempest/metadata.json | 69 ++ .../add-bgpvpn-support-d08ba23ce786a46a.yaml | 3 + .../add-l2gw-driver-dea71457310f31bd.yaml | 3 + .../add-octavia-support-9fb2e93e7ce38be7.yaml | 3 + .../notes/add_congress-879513a345de563f.yaml | 3 + .../notes/add_gnocchi-f8b3d64466d021ce.yaml | 3 + .../notes/add_watcher-2f24b0881c28cd82.yaml | 3 + ...re_package_parameter-9a39a2831316791f.yaml | 4 + .../notes/designate-e22d3f4ebe2e9a19.yaml | 3 + .../ec2api-package-db30bb668b138b03.yaml | 3 + ...utron-api-extensions-b5ae613fa6ea32f9.yaml | 6 + ...tempest-from-package-dbf74b77aced0ec4.yaml | 3 + .../mitaka_features-985958b8632659c0.yaml | 7 + .../notes/osclient-fccb30722f2d46a0.yaml | 5 + .../notes/panko-80f401254e26f83c.yaml | 3 + .../remove_verbose-712eaabc11a60423.yaml | 4 + ...e-deprecated-options-fdc3761398ee88ed.yaml | 4 + .../switch_to_oslo-524aee1c79d121a4.yaml | 4 + .../notes/use-reno-1caaec4ba5aa4285.yaml | 4 + .../verbose_deprecated-199b555f384fb0fc.yaml | 4 + .../releasenotes/source/_static/.placeholder | 0 .../tempest/releasenotes/source/conf.py | 261 ++++++ .../tempest/releasenotes/source/index.rst | 21 + .../tempest/releasenotes/source/mitaka.rst | 6 + .../tempest/releasenotes/source/newton.rst | 6 + .../tempest/releasenotes/source/ocata.rst | 6 + .../releasenotes/source/unreleased.rst | 5 + .../puppet/modules/tempest/setup.cfg | 13 + .../puppet/modules/tempest/setup.py | 22 + .../spec/acceptance/basic_tempest_spec.rb | 27 + .../acceptance/nodesets/centos-70-x64.yml | 11 + .../spec/acceptance/nodesets/default.yml | 10 + .../acceptance/nodesets/nodepool-centos7.yml | 10 + .../acceptance/nodesets/nodepool-trusty.yml | 10 + .../acceptance/nodesets/nodepool-xenial.yml | 10 + .../nodesets/ubuntu-server-1404-x64.yml | 11 + .../spec/classes/tempest_config_spec.rb | 20 + .../tempest/spec/classes/tempest_init_spec.rb | 450 +++++++++ .../modules/tempest/spec/shared_examples.rb | 5 + .../modules/tempest/spec/spec_helper.rb | 10 + .../tempest/spec/spec_helper_acceptance.rb | 1 + .../tempest_config/ini_setting_spec.rb | 65 ++ .../spec/unit/puppet/provider/ruby_spec.rb | 144 +++ .../spec/unit/type/tempest_config_spec.rb | 63 ++ .../type/tempest_glance_id_setter_spec.rb | 31 + .../tempest_neutron_net_id_setter_spec.rb | 31 + .../modules/tempest/test-requirements.txt | 7 + .../puppet/modules/tempest/tests/init.pp | 12 + .../puppet/modules/tempest/tox.ini | 8 + deployment_tasks.yaml | 21 + environment_config.yaml | 37 + metadata.yaml | 35 + node_roles.yaml | 9 + pre_build_hook | 7 + 256 files changed, 13246 insertions(+) create mode 100644 LICENSE create mode 100644 deployment_scripts/puppet/manifests/tempest_install.pp create mode 100644 deployment_scripts/puppet/manifests/tempest_run.pp create mode 100644 deployment_scripts/puppet/modules/openstacklib/.gitignore create mode 100644 deployment_scripts/puppet/modules/openstacklib/.gitreview create mode 100644 deployment_scripts/puppet/modules/openstacklib/CHANGELOG.md create mode 100644 deployment_scripts/puppet/modules/openstacklib/Gemfile create mode 100644 deployment_scripts/puppet/modules/openstacklib/LICENSE create mode 100644 deployment_scripts/puppet/modules/openstacklib/README.md create mode 100644 deployment_scripts/puppet/modules/openstacklib/Rakefile create mode 100644 deployment_scripts/puppet/modules/openstacklib/bindep.txt create mode 100644 deployment_scripts/puppet/modules/openstacklib/examples/virtual_packages.pp create mode 100644 deployment_scripts/puppet/modules/openstacklib/facts.d/os_service_default.txt create mode 100644 deployment_scripts/puppet/modules/openstacklib/lib/facter/os_package_type.rb create mode 100644 deployment_scripts/puppet/modules/openstacklib/lib/facter/os_service_default.rb create mode 100644 deployment_scripts/puppet/modules/openstacklib/lib/facter/os_workers.rb create mode 100644 deployment_scripts/puppet/modules/openstacklib/lib/puppet/parser/functions/is_service_default.rb create mode 100644 deployment_scripts/puppet/modules/openstacklib/lib/puppet/parser/functions/normalize_ip_for_uri.rb create mode 100644 deployment_scripts/puppet/modules/openstacklib/lib/puppet/parser/functions/os_database_connection.rb create mode 100644 deployment_scripts/puppet/modules/openstacklib/lib/puppet/parser/functions/os_transport_url.rb create mode 100644 deployment_scripts/puppet/modules/openstacklib/lib/puppet/provider/openstack.rb create mode 100644 deployment_scripts/puppet/modules/openstacklib/lib/puppet/provider/openstack/auth.rb create mode 100644 deployment_scripts/puppet/modules/openstacklib/lib/puppet/provider/openstack/credentials.rb create mode 100644 deployment_scripts/puppet/modules/openstacklib/lib/puppet/provider/openstack_config/ini_setting.rb create mode 100644 deployment_scripts/puppet/modules/openstacklib/lib/puppet/provider/openstack_config/ruby.rb create mode 100644 deployment_scripts/puppet/modules/openstacklib/lib/puppet/provider/policy_rcd/policy_rcd.rb create mode 100644 deployment_scripts/puppet/modules/openstacklib/lib/puppet/type/openstack_config.rb create mode 100644 deployment_scripts/puppet/modules/openstacklib/lib/puppet/type/policy_rcd.rb create mode 100644 deployment_scripts/puppet/modules/openstacklib/lib/puppet/util/openstackconfig.rb create mode 100644 deployment_scripts/puppet/modules/openstacklib/lib/puppet/util/openstackconfig/section.rb create mode 100644 deployment_scripts/puppet/modules/openstacklib/manifests/db/mysql.pp create mode 100644 deployment_scripts/puppet/modules/openstacklib/manifests/db/mysql/host_access.pp create mode 100644 deployment_scripts/puppet/modules/openstacklib/manifests/db/postgresql.pp create mode 100644 deployment_scripts/puppet/modules/openstacklib/manifests/defaults.pp create mode 100644 deployment_scripts/puppet/modules/openstacklib/manifests/messaging/rabbitmq.pp create mode 100644 deployment_scripts/puppet/modules/openstacklib/manifests/openstackclient.pp create mode 100644 deployment_scripts/puppet/modules/openstacklib/manifests/policy.pp create mode 100644 deployment_scripts/puppet/modules/openstacklib/manifests/policy/base.pp create mode 100644 deployment_scripts/puppet/modules/openstacklib/manifests/policyrcd.pp create mode 100644 deployment_scripts/puppet/modules/openstacklib/manifests/service_validation.pp create mode 100644 deployment_scripts/puppet/modules/openstacklib/manifests/wsgi/apache.pp create mode 100644 deployment_scripts/puppet/modules/openstacklib/metadata.json create mode 100644 deployment_scripts/puppet/modules/openstacklib/releasenotes/notes/Add-TLS-options-for-mysql-user-creation-172536d7f3963ce2.yaml create mode 100644 deployment_scripts/puppet/modules/openstacklib/releasenotes/notes/bugfix-1664561-f5964a3777b9ed93.yaml create mode 100644 deployment_scripts/puppet/modules/openstacklib/releasenotes/notes/catch_403-237b79f33ab3364f.yaml create mode 100644 deployment_scripts/puppet/modules/openstacklib/releasenotes/notes/feature_add_default_config_placeholder-280f69c0edbf76c6.yaml create mode 100644 deployment_scripts/puppet/modules/openstacklib/releasenotes/notes/feature_add_exclusion_to_retry_mechanism-2acb52fa25bd315c.yaml create mode 100644 deployment_scripts/puppet/modules/openstacklib/releasenotes/notes/feature_add_transform_for_config.yaml create mode 100644 deployment_scripts/puppet/modules/openstacklib/releasenotes/notes/ipv6_array_support-ea28cf0939e820f6.yaml create mode 100644 deployment_scripts/puppet/modules/openstacklib/releasenotes/notes/ipv6_brackets-7a453aea5e091855.yaml create mode 100644 deployment_scripts/puppet/modules/openstacklib/releasenotes/notes/manage_policy_rc_d_file-747510db06792d52.yaml create mode 100644 deployment_scripts/puppet/modules/openstacklib/releasenotes/notes/more_db_options-d96316ae4eb5a78c.yaml create mode 100644 deployment_scripts/puppet/modules/openstacklib/releasenotes/notes/mysql-user-and-grants-optional-fd34f4686d44aec3.yaml create mode 100644 deployment_scripts/puppet/modules/openstacklib/releasenotes/notes/os_transport-alt-transport-7cd300380ece2fc9.yaml create mode 100644 deployment_scripts/puppet/modules/openstacklib/releasenotes/notes/os_transport_url-b6fe15a8f21d387b.yaml create mode 100644 deployment_scripts/puppet/modules/openstacklib/releasenotes/notes/os_workers-fact-0ce731f0536c2792.yaml create mode 100644 deployment_scripts/puppet/modules/openstacklib/releasenotes/notes/os_workers-fact-420e6ad783cba982.yaml create mode 100644 deployment_scripts/puppet/modules/openstacklib/releasenotes/notes/os_workers_for_worker_count-34eb55ddf55f4a11.yaml create mode 100644 deployment_scripts/puppet/modules/openstacklib/releasenotes/notes/policy_rcd_provider-1ef3d203b9af1110.yaml create mode 100644 deployment_scripts/puppet/modules/openstacklib/releasenotes/notes/retry_client-b8a0e1f9ff679281.yaml create mode 100644 deployment_scripts/puppet/modules/openstacklib/releasenotes/notes/support_region_name_in_providers-cde6d75f0ddbec28.yaml create mode 100644 deployment_scripts/puppet/modules/openstacklib/releasenotes/notes/use-reno-1caaec4ba5aa4285.yaml create mode 100644 deployment_scripts/puppet/modules/openstacklib/releasenotes/source/_static/.placeholder create mode 100644 deployment_scripts/puppet/modules/openstacklib/releasenotes/source/conf.py create mode 100644 deployment_scripts/puppet/modules/openstacklib/releasenotes/source/index.rst create mode 100644 deployment_scripts/puppet/modules/openstacklib/releasenotes/source/mitaka.rst create mode 100644 deployment_scripts/puppet/modules/openstacklib/releasenotes/source/newton.rst create mode 100644 deployment_scripts/puppet/modules/openstacklib/releasenotes/source/ocata.rst create mode 100644 deployment_scripts/puppet/modules/openstacklib/releasenotes/source/unreleased.rst create mode 100644 deployment_scripts/puppet/modules/openstacklib/setup.cfg create mode 100644 deployment_scripts/puppet/modules/openstacklib/setup.py create mode 100644 deployment_scripts/puppet/modules/openstacklib/spec/acceptance/defaults_spec.rb create mode 100644 deployment_scripts/puppet/modules/openstacklib/spec/acceptance/mysql_spec.rb create mode 100644 deployment_scripts/puppet/modules/openstacklib/spec/acceptance/nodesets/centos-70-x64.yml create mode 100644 deployment_scripts/puppet/modules/openstacklib/spec/acceptance/nodesets/default.yml create mode 100644 deployment_scripts/puppet/modules/openstacklib/spec/acceptance/nodesets/nodepool-centos7.yml create mode 100644 deployment_scripts/puppet/modules/openstacklib/spec/acceptance/nodesets/nodepool-trusty.yml create mode 100644 deployment_scripts/puppet/modules/openstacklib/spec/acceptance/nodesets/nodepool-xenial.yml create mode 100644 deployment_scripts/puppet/modules/openstacklib/spec/acceptance/nodesets/ubuntu-server-1404-x64.yml create mode 100644 deployment_scripts/puppet/modules/openstacklib/spec/acceptance/openstacklib_config_provider_spec.rb create mode 100644 deployment_scripts/puppet/modules/openstacklib/spec/acceptance/rabbitmq_spec.rb create mode 100644 deployment_scripts/puppet/modules/openstacklib/spec/classes/openstacklib_defaults_spec.rb create mode 100644 deployment_scripts/puppet/modules/openstacklib/spec/classes/openstacklib_policy_spec.rb create mode 100644 deployment_scripts/puppet/modules/openstacklib/spec/classes/openstacklib_policyrcd_spec.rb create mode 100644 deployment_scripts/puppet/modules/openstacklib/spec/defines/openstacklib_db_mysql_host_access_spec.rb create mode 100644 deployment_scripts/puppet/modules/openstacklib/spec/defines/openstacklib_db_mysql_spec.rb create mode 100644 deployment_scripts/puppet/modules/openstacklib/spec/defines/openstacklib_db_postgresql_spec.rb create mode 100644 deployment_scripts/puppet/modules/openstacklib/spec/defines/openstacklib_messaging_rabbitmq_spec.rb create mode 100644 deployment_scripts/puppet/modules/openstacklib/spec/defines/openstacklib_policy_spec.rb create mode 100644 deployment_scripts/puppet/modules/openstacklib/spec/defines/openstacklib_service_validation_spec.rb create mode 100644 deployment_scripts/puppet/modules/openstacklib/spec/defines/openstacklib_wsgi_apache_spec.rb create mode 100644 deployment_scripts/puppet/modules/openstacklib/spec/functions/is_service_default_spec.rb create mode 100644 deployment_scripts/puppet/modules/openstacklib/spec/functions/normalize_ip_for_uri_spec.rb create mode 100644 deployment_scripts/puppet/modules/openstacklib/spec/functions/os_database_connection_spec.rb create mode 100644 deployment_scripts/puppet/modules/openstacklib/spec/functions/os_transport_url_spec.rb create mode 100644 deployment_scripts/puppet/modules/openstacklib/spec/shared_examples.rb create mode 100644 deployment_scripts/puppet/modules/openstacklib/spec/spec_helper.rb create mode 100644 deployment_scripts/puppet/modules/openstacklib/spec/spec_helper_acceptance.rb create mode 100644 deployment_scripts/puppet/modules/openstacklib/spec/unit/provider/openstack/auth_spec.rb create mode 100644 deployment_scripts/puppet/modules/openstacklib/spec/unit/provider/openstack/credentials_spec.rb create mode 100644 deployment_scripts/puppet/modules/openstacklib/spec/unit/provider/openstack_config/ini_setting_spec.rb create mode 100644 deployment_scripts/puppet/modules/openstacklib/spec/unit/provider/openstack_spec.rb create mode 100644 deployment_scripts/puppet/modules/openstacklib/spec/unit/provider/policy_rcd/policy_rcd_spec.rb create mode 100644 deployment_scripts/puppet/modules/openstacklib/spec/unit/puppet/util/openstackconfig_spec.rb create mode 100644 deployment_scripts/puppet/modules/openstacklib/spec/unit/type/policy_rcd_spec.rb create mode 100644 deployment_scripts/puppet/modules/openstacklib/templates/policy-rc.d.erb create mode 100644 deployment_scripts/puppet/modules/openstacklib/test-requirements.txt create mode 100644 deployment_scripts/puppet/modules/openstacklib/tox.ini create mode 100644 deployment_scripts/puppet/modules/oslo/.gitignore create mode 100644 deployment_scripts/puppet/modules/oslo/.gitreview create mode 100644 deployment_scripts/puppet/modules/oslo/Gemfile create mode 100644 deployment_scripts/puppet/modules/oslo/LICENSE create mode 100644 deployment_scripts/puppet/modules/oslo/README.md create mode 100644 deployment_scripts/puppet/modules/oslo/Rakefile create mode 100644 deployment_scripts/puppet/modules/oslo/bindep.txt create mode 100644 deployment_scripts/puppet/modules/oslo/lib/puppet/provider/oslo_config/ini_setting.rb create mode 100644 deployment_scripts/puppet/modules/oslo/lib/puppet/type/oslo_config.rb create mode 100644 deployment_scripts/puppet/modules/oslo/manifests/cache.pp create mode 100644 deployment_scripts/puppet/modules/oslo/manifests/concurrency.pp create mode 100644 deployment_scripts/puppet/modules/oslo/manifests/cors.pp create mode 100644 deployment_scripts/puppet/modules/oslo/manifests/db.pp create mode 100644 deployment_scripts/puppet/modules/oslo/manifests/init.pp create mode 100644 deployment_scripts/puppet/modules/oslo/manifests/log.pp create mode 100644 deployment_scripts/puppet/modules/oslo/manifests/messaging/amqp.pp create mode 100644 deployment_scripts/puppet/modules/oslo/manifests/messaging/default.pp create mode 100644 deployment_scripts/puppet/modules/oslo/manifests/messaging/notifications.pp create mode 100644 deployment_scripts/puppet/modules/oslo/manifests/messaging/rabbit.pp create mode 100644 deployment_scripts/puppet/modules/oslo/manifests/messaging/zmq.pp create mode 100644 deployment_scripts/puppet/modules/oslo/manifests/middleware.pp create mode 100644 deployment_scripts/puppet/modules/oslo/manifests/params.pp create mode 100644 deployment_scripts/puppet/modules/oslo/manifests/policy.pp create mode 100644 deployment_scripts/puppet/modules/oslo/manifests/privsep.pp create mode 100644 deployment_scripts/puppet/modules/oslo/manifests/releasenotes/notes/rabbitmq-connection-params-1a8ace0c23e7249e.yaml create mode 100644 deployment_scripts/puppet/modules/oslo/manifests/service.pp create mode 100644 deployment_scripts/puppet/modules/oslo/manifests/versionedobjects.pp create mode 100644 deployment_scripts/puppet/modules/oslo/metadata.json create mode 100644 deployment_scripts/puppet/modules/oslo/releasenotes/notes/add_oslo_privsep-3f125445bce8b431.yaml create mode 100644 deployment_scripts/puppet/modules/oslo/releasenotes/notes/add_zmq_messaging-7ea20df747c78035.yaml create mode 100644 deployment_scripts/puppet/modules/oslo/releasenotes/notes/backend_package_ensure-54b4525895ce9acd.yaml create mode 100644 deployment_scripts/puppet/modules/oslo/releasenotes/notes/deprecate_config_sqlite_db-1a239175d42378e3.yaml create mode 100644 deployment_scripts/puppet/modules/oslo/releasenotes/notes/first_release-a7268e1c8959eca3.yaml create mode 100644 deployment_scripts/puppet/modules/oslo/releasenotes/notes/fix_log_dir_documentation-050052366584e83e.yaml create mode 100644 deployment_scripts/puppet/modules/oslo/releasenotes/notes/remove_verbose-0b599cd4810a8c51.yaml create mode 100644 deployment_scripts/puppet/modules/oslo/releasenotes/notes/secure-transport-url-d67d307cf85a16b1.yaml create mode 100644 deployment_scripts/puppet/modules/oslo/releasenotes/notes/update-amqp-opts-1f14b8d3648b2b30.yaml create mode 100644 deployment_scripts/puppet/modules/oslo/releasenotes/source/_static/.placeholder create mode 100644 deployment_scripts/puppet/modules/oslo/releasenotes/source/conf.py create mode 100644 deployment_scripts/puppet/modules/oslo/releasenotes/source/index.rst create mode 100644 deployment_scripts/puppet/modules/oslo/releasenotes/source/newton.rst create mode 100644 deployment_scripts/puppet/modules/oslo/releasenotes/source/ocata.rst create mode 100644 deployment_scripts/puppet/modules/oslo/releasenotes/source/unreleased.rst create mode 100644 deployment_scripts/puppet/modules/oslo/setup.cfg create mode 100644 deployment_scripts/puppet/modules/oslo/setup.py create mode 100644 deployment_scripts/puppet/modules/oslo/spec/acceptance/nodesets/centos-70-x64.yml create mode 100644 deployment_scripts/puppet/modules/oslo/spec/acceptance/nodesets/default.yml create mode 100644 deployment_scripts/puppet/modules/oslo/spec/acceptance/nodesets/nodepool-centos7.yml create mode 100644 deployment_scripts/puppet/modules/oslo/spec/acceptance/nodesets/nodepool-trusty.yml create mode 100644 deployment_scripts/puppet/modules/oslo/spec/acceptance/nodesets/nodepool-xenial.yml create mode 100644 deployment_scripts/puppet/modules/oslo/spec/acceptance/nodesets/ubuntu-server-1404-x64.yml create mode 100644 deployment_scripts/puppet/modules/oslo/spec/classes/oslo_init_spec.rb create mode 100644 deployment_scripts/puppet/modules/oslo/spec/defines/oslo_cache_spec.rb create mode 100644 deployment_scripts/puppet/modules/oslo/spec/defines/oslo_concurrency_spec.rb create mode 100644 deployment_scripts/puppet/modules/oslo/spec/defines/oslo_cors_spec.rb create mode 100644 deployment_scripts/puppet/modules/oslo/spec/defines/oslo_db_spec.rb create mode 100644 deployment_scripts/puppet/modules/oslo/spec/defines/oslo_log_spec.rb create mode 100644 deployment_scripts/puppet/modules/oslo/spec/defines/oslo_messaging_amqp_spec.rb create mode 100644 deployment_scripts/puppet/modules/oslo/spec/defines/oslo_messaging_default_spec.rb create mode 100644 deployment_scripts/puppet/modules/oslo/spec/defines/oslo_messaging_notifications_spec.rb create mode 100644 deployment_scripts/puppet/modules/oslo/spec/defines/oslo_messaging_rabbit_spec.rb create mode 100644 deployment_scripts/puppet/modules/oslo/spec/defines/oslo_messaging_zmq_spec.rb create mode 100644 deployment_scripts/puppet/modules/oslo/spec/defines/oslo_middleware_spec.rb create mode 100644 deployment_scripts/puppet/modules/oslo/spec/defines/oslo_policy_spec.rb create mode 100644 deployment_scripts/puppet/modules/oslo/spec/defines/oslo_privsep_spec.rb create mode 100644 deployment_scripts/puppet/modules/oslo/spec/defines/oslo_service_spec.rb create mode 100644 deployment_scripts/puppet/modules/oslo/spec/defines/oslo_versionedobjects_spec.rb create mode 100644 deployment_scripts/puppet/modules/oslo/spec/shared_examples.rb create mode 100644 deployment_scripts/puppet/modules/oslo/spec/spec_helper.rb create mode 100644 deployment_scripts/puppet/modules/oslo/spec/spec_helper_acceptance.rb create mode 100644 deployment_scripts/puppet/modules/oslo/spec/unit/provider/oslo_config/ini_setting_spec.rb create mode 100644 deployment_scripts/puppet/modules/oslo/spec/unit/type/oslo_config_spec.rb create mode 100644 deployment_scripts/puppet/modules/oslo/test-requirements.txt create mode 100644 deployment_scripts/puppet/modules/oslo/tests/init.pp create mode 100644 deployment_scripts/puppet/modules/oslo/tox.ini create mode 100644 deployment_scripts/puppet/modules/tempest/.rspec create mode 100644 deployment_scripts/puppet/modules/tempest/CHANGELOG.md create mode 100644 deployment_scripts/puppet/modules/tempest/Gemfile create mode 100644 deployment_scripts/puppet/modules/tempest/LICENSE create mode 100644 deployment_scripts/puppet/modules/tempest/README.md create mode 100644 deployment_scripts/puppet/modules/tempest/Rakefile create mode 100644 deployment_scripts/puppet/modules/tempest/bindep.txt create mode 100644 deployment_scripts/puppet/modules/tempest/lib/puppet/provider/tempest.rb create mode 100644 deployment_scripts/puppet/modules/tempest/lib/puppet/provider/tempest_config/ini_setting.rb create mode 100644 deployment_scripts/puppet/modules/tempest/lib/puppet/provider/tempest_ec2_credentials/openstack.rb create mode 100644 deployment_scripts/puppet/modules/tempest/lib/puppet/provider/tempest_glance_id_setter/openstack.rb create mode 100644 deployment_scripts/puppet/modules/tempest/lib/puppet/provider/tempest_neutron_net_id_setter/openstack.rb create mode 100644 deployment_scripts/puppet/modules/tempest/lib/puppet/type/tempest_config.rb create mode 100644 deployment_scripts/puppet/modules/tempest/lib/puppet/type/tempest_ec2_credentials.rb create mode 100644 deployment_scripts/puppet/modules/tempest/lib/puppet/type/tempest_glance_id_setter.rb create mode 100644 deployment_scripts/puppet/modules/tempest/lib/puppet/type/tempest_neutron_net_id_setter.rb create mode 100644 deployment_scripts/puppet/modules/tempest/manifests/config.pp create mode 100644 deployment_scripts/puppet/modules/tempest/manifests/init.pp create mode 100644 deployment_scripts/puppet/modules/tempest/manifests/params.pp create mode 100644 deployment_scripts/puppet/modules/tempest/metadata.json create mode 100644 deployment_scripts/puppet/modules/tempest/releasenotes/notes/add-bgpvpn-support-d08ba23ce786a46a.yaml create mode 100644 deployment_scripts/puppet/modules/tempest/releasenotes/notes/add-l2gw-driver-dea71457310f31bd.yaml create mode 100644 deployment_scripts/puppet/modules/tempest/releasenotes/notes/add-octavia-support-9fb2e93e7ce38be7.yaml create mode 100644 deployment_scripts/puppet/modules/tempest/releasenotes/notes/add_congress-879513a345de563f.yaml create mode 100644 deployment_scripts/puppet/modules/tempest/releasenotes/notes/add_gnocchi-f8b3d64466d021ce.yaml create mode 100644 deployment_scripts/puppet/modules/tempest/releasenotes/notes/add_watcher-2f24b0881c28cd82.yaml create mode 100644 deployment_scripts/puppet/modules/tempest/releasenotes/notes/deprecate_ensure_package_parameter-9a39a2831316791f.yaml create mode 100644 deployment_scripts/puppet/modules/tempest/releasenotes/notes/designate-e22d3f4ebe2e9a19.yaml create mode 100644 deployment_scripts/puppet/modules/tempest/releasenotes/notes/ec2api-package-db30bb668b138b03.yaml create mode 100644 deployment_scripts/puppet/modules/tempest/releasenotes/notes/expose-neutron-api-extensions-b5ae613fa6ea32f9.yaml create mode 100644 deployment_scripts/puppet/modules/tempest/releasenotes/notes/manifests-to-install-tempest-from-package-dbf74b77aced0ec4.yaml create mode 100644 deployment_scripts/puppet/modules/tempest/releasenotes/notes/mitaka_features-985958b8632659c0.yaml create mode 100644 deployment_scripts/puppet/modules/tempest/releasenotes/notes/osclient-fccb30722f2d46a0.yaml create mode 100644 deployment_scripts/puppet/modules/tempest/releasenotes/notes/panko-80f401254e26f83c.yaml create mode 100644 deployment_scripts/puppet/modules/tempest/releasenotes/notes/remove_verbose-712eaabc11a60423.yaml create mode 100644 deployment_scripts/puppet/modules/tempest/releasenotes/notes/rename-deprecated-options-fdc3761398ee88ed.yaml create mode 100644 deployment_scripts/puppet/modules/tempest/releasenotes/notes/switch_to_oslo-524aee1c79d121a4.yaml create mode 100644 deployment_scripts/puppet/modules/tempest/releasenotes/notes/use-reno-1caaec4ba5aa4285.yaml create mode 100644 deployment_scripts/puppet/modules/tempest/releasenotes/notes/verbose_deprecated-199b555f384fb0fc.yaml create mode 100644 deployment_scripts/puppet/modules/tempest/releasenotes/source/_static/.placeholder create mode 100644 deployment_scripts/puppet/modules/tempest/releasenotes/source/conf.py create mode 100644 deployment_scripts/puppet/modules/tempest/releasenotes/source/index.rst create mode 100644 deployment_scripts/puppet/modules/tempest/releasenotes/source/mitaka.rst create mode 100644 deployment_scripts/puppet/modules/tempest/releasenotes/source/newton.rst create mode 100644 deployment_scripts/puppet/modules/tempest/releasenotes/source/ocata.rst create mode 100644 deployment_scripts/puppet/modules/tempest/releasenotes/source/unreleased.rst create mode 100644 deployment_scripts/puppet/modules/tempest/setup.cfg create mode 100644 deployment_scripts/puppet/modules/tempest/setup.py create mode 100644 deployment_scripts/puppet/modules/tempest/spec/acceptance/basic_tempest_spec.rb create mode 100644 deployment_scripts/puppet/modules/tempest/spec/acceptance/nodesets/centos-70-x64.yml create mode 100644 deployment_scripts/puppet/modules/tempest/spec/acceptance/nodesets/default.yml create mode 100644 deployment_scripts/puppet/modules/tempest/spec/acceptance/nodesets/nodepool-centos7.yml create mode 100644 deployment_scripts/puppet/modules/tempest/spec/acceptance/nodesets/nodepool-trusty.yml create mode 100644 deployment_scripts/puppet/modules/tempest/spec/acceptance/nodesets/nodepool-xenial.yml create mode 100644 deployment_scripts/puppet/modules/tempest/spec/acceptance/nodesets/ubuntu-server-1404-x64.yml create mode 100644 deployment_scripts/puppet/modules/tempest/spec/classes/tempest_config_spec.rb create mode 100644 deployment_scripts/puppet/modules/tempest/spec/classes/tempest_init_spec.rb create mode 100644 deployment_scripts/puppet/modules/tempest/spec/shared_examples.rb create mode 100644 deployment_scripts/puppet/modules/tempest/spec/spec_helper.rb create mode 100644 deployment_scripts/puppet/modules/tempest/spec/spec_helper_acceptance.rb create mode 100644 deployment_scripts/puppet/modules/tempest/spec/unit/provider/tempest_config/ini_setting_spec.rb create mode 100644 deployment_scripts/puppet/modules/tempest/spec/unit/puppet/provider/ruby_spec.rb create mode 100644 deployment_scripts/puppet/modules/tempest/spec/unit/type/tempest_config_spec.rb create mode 100644 deployment_scripts/puppet/modules/tempest/spec/unit/type/tempest_glance_id_setter_spec.rb create mode 100644 deployment_scripts/puppet/modules/tempest/spec/unit/type/tempest_neutron_net_id_setter_spec.rb create mode 100644 deployment_scripts/puppet/modules/tempest/test-requirements.txt create mode 100644 deployment_scripts/puppet/modules/tempest/tests/init.pp create mode 100644 deployment_scripts/puppet/modules/tempest/tox.ini create mode 100644 deployment_tasks.yaml create mode 100644 environment_config.yaml create mode 100644 metadata.yaml create mode 100644 node_roles.yaml create mode 100755 pre_build_hook diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..b09cd78 --- /dev/null +++ b/LICENSE @@ -0,0 +1,201 @@ +Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/deployment_scripts/puppet/manifests/tempest_install.pp b/deployment_scripts/puppet/manifests/tempest_install.pp new file mode 100644 index 0000000..71a299d --- /dev/null +++ b/deployment_scripts/puppet/manifests/tempest_install.pp @@ -0,0 +1,52 @@ +# Copyright 2017 Sberbank +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +notice('fuel-plugin-tempest: tempest_install.pp') + +$plugin_hash = hiera_hash('tempest', {}) + +if has_key($plugin_hash, 'image_name') { + $image_name = $plugin_hash['image_name'] +} else { + $image_name = 'TestVM' +} + +$service_endpoint = hiera('service_endpoint') +$auth_url_v2 = "http://${service_endpoint}:35357/v2.0" +$auth_url_v3 = "http://${service_endpoint}:35357/v3" + +class { 'tempest': + package_ensure => 'latest', + tempest_workspace => '/var/lib/tempest/default', + tempest_config_file => '/var/lib/tempest/default/etc/tempest.conf', + lock_path => '/var/lib/tempest/default/tempest_lock', + install_from_source => false, + git_clone => false, + image_name => $image_name, + image_name_alt => $image_name, + configure_networks => false, + identity_uri => $auth_url_v2, + identity_uri_v3 => $auth_url_v3, + auth_version => 'v3', + region_name => hiera('region', 'RegionOne'), + manage_tests_packages => false, + admin_username => 'admin', + admin_password => 'admin', + admin_project_name => 'admin', + admin_role => 'admin', + admin_domain_name => 'Default', + img_dir => undef, + img_file => undef, + min_compute_nodes => 3, +} diff --git a/deployment_scripts/puppet/manifests/tempest_run.pp b/deployment_scripts/puppet/manifests/tempest_run.pp new file mode 100644 index 0000000..9fecf4f --- /dev/null +++ b/deployment_scripts/puppet/manifests/tempest_run.pp @@ -0,0 +1,35 @@ +# Copyright 2017 Sberbank +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +notice('fuel-plugin-tempest: tempest_run.pp') + +$plugin_hash = hiera_hash('tempest', {}) +$run_tests = $plugin_hash['run_tests'] + +if $run_tests { + $run_script = $plugin_hash['run_script'] + + file { '/tmp/tempest-run.sh': + ensure => file, + owner => 'root', + mode => '0744', + content => inline_template("#!/bin/bash -eux\n$run_script"), + }-> + exec { 'run_tempest_tests': + command => 'bash /tmp/tempest-run.sh', + path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', + user => 'root', + logoutput => 'on_failure', + } +} diff --git a/deployment_scripts/puppet/modules/openstacklib/.gitignore b/deployment_scripts/puppet/modules/openstacklib/.gitignore new file mode 100644 index 0000000..3c50902 --- /dev/null +++ b/deployment_scripts/puppet/modules/openstacklib/.gitignore @@ -0,0 +1,15 @@ +pkg/ +Gemfile.lock +vendor/ +spec/fixtures/ +.vagrant/ +.bundle/ +coverage/ +.idea/ +*.swp +*.iml +/openstack/ + +# Files created by releasenotes build +releasenotes/build +.tox diff --git a/deployment_scripts/puppet/modules/openstacklib/.gitreview b/deployment_scripts/puppet/modules/openstacklib/.gitreview new file mode 100644 index 0000000..aa396d0 --- /dev/null +++ b/deployment_scripts/puppet/modules/openstacklib/.gitreview @@ -0,0 +1,4 @@ +[gerrit] +host=review.openstack.org +port=29418 +project=openstack/puppet-openstacklib.git diff --git a/deployment_scripts/puppet/modules/openstacklib/CHANGELOG.md b/deployment_scripts/puppet/modules/openstacklib/CHANGELOG.md new file mode 100644 index 0000000..7937993 --- /dev/null +++ b/deployment_scripts/puppet/modules/openstacklib/CHANGELOG.md @@ -0,0 +1,78 @@ +## 8.0.0 and beyond + +From 8.0.0 release and beyond, release notes are published on +[docs.openstack.org](http://docs.openstack.org/releasenotes/puppet-openstacklib/). + +##2015-11-24 - 7.0.0 +###Summary + +This is a backwards-compatible major release for OpenStack Liberty. + +####Features +- fallback to default rcfile +- prepare $::os_package_type +- add a proxy inifile provider +- allow the use of an ensure_absent_val param +- create is_service_default function +- create os_service_default fact +- allow to path custom fragment to vhost +- pass necessary options to Apache when using WSGI + +####Bugfixes +- fix fact for puppet facter 2.0.1+ + +####Maintenance +- initial msync run for all Puppet OpenStack modules +- enable acceptance tests for openstack_config +- remove class_parameter_defaults puppet-lint check + +##2015-10-10 - 6.1.0 +###Summary + +This is a maintenance release in the Kilo series. + +####Maintenance +- acceptance: checkout stable/kilo puppet modules + +##2015-07-08 - 6.0.0 +###Summary + +This is a backwards-incompatible major release for OpenStack Kilo. + +####Backwards-incompatible changes +- MySQL: change default MySQL collate to utf8_general_ci + +####Features +- Puppet 4.x support +- Add db::postgresql to openstacklib +- Implement openstacklib::wsgi::apache +- Move openstackclient parent provider to openstacklib +- Keystone V3 API support +- Restructures authentication for resource providers + +####Bugfixes +- Properly handle policy values containing spaces + +####Maintenance +- Bump mysql version to 3.x +- Acceptance tests with Beaker + +##2015-06-17 - 5.1.0 +###Summary + +This is a feature and bugfix release in the Juno series. + +####Features +- Adding augeas insertion check + +####Bugfixes +- MySQL: change default MySQL collate to utf8_general_ci + +####Maintenance +- Update .gitreview file for project rename +- spec: pin rspec-puppet to 1.0.1 + +##2014-11-25 - 5.0.0 +###Summary + +Initial release for Juno. diff --git a/deployment_scripts/puppet/modules/openstacklib/Gemfile b/deployment_scripts/puppet/modules/openstacklib/Gemfile new file mode 100644 index 0000000..1fab608 --- /dev/null +++ b/deployment_scripts/puppet/modules/openstacklib/Gemfile @@ -0,0 +1,21 @@ +source ENV['GEM_SOURCE'] || "https://rubygems.org" + +group :development, :test, :system_tests do + gem 'puppet-openstack_spec_helper', + :git => 'https://git.openstack.org/openstack/puppet-openstack_spec_helper', + :require => false +end + +if facterversion = ENV['FACTER_GEM_VERSION'] + gem 'facter', facterversion, :require => false +else + gem 'facter', :require => false +end + +if puppetversion = ENV['PUPPET_GEM_VERSION'] + gem 'puppet', puppetversion, :require => false +else + gem 'puppet', :require => false +end + +# vim:ft=ruby diff --git a/deployment_scripts/puppet/modules/openstacklib/LICENSE b/deployment_scripts/puppet/modules/openstacklib/LICENSE new file mode 100644 index 0000000..88a11a0 --- /dev/null +++ b/deployment_scripts/puppet/modules/openstacklib/LICENSE @@ -0,0 +1,13 @@ +Copyright 2012 OpenStack Foundation + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/deployment_scripts/puppet/modules/openstacklib/README.md b/deployment_scripts/puppet/modules/openstacklib/README.md new file mode 100644 index 0000000..ce734a1 --- /dev/null +++ b/deployment_scripts/puppet/modules/openstacklib/README.md @@ -0,0 +1,333 @@ +Team and repository tags +======================== + +[![Team and repository tags](http://governance.openstack.org/badges/puppet-openstacklib.svg)](http://governance.openstack.org/reference/tags/index.html) + + + +openstacklib +============ + +#### Table of Contents + +1. [Overview - What is the openstacklib module?](#overview) +2. [Module Description - What does the module do?](#module-description) +3. [Setup - The basics of getting started with openstacklib](#setup) +4. [Implementation - An under-the-hood peek at what the module is doing](#implementation) +5. [Limitations - OS compatibility, etc.](#limitations) +6. [Development - Guide for contributing to the module](#development) +7. [Contributors - Those with commits](#contributors) + +Overview +-------- + +The openstacklib module is a part of [OpenStack](https://github.com/openstack), +an effort by the Openstack infrastructure team to provide continuous integration +testing and code review for Openstack and Openstack community projects not part +of the core software. The module itself is used to expose common functionality +between Openstack modules as a library that can be utilized to avoid code +duplication. + +Module Description +------------------ + +The openstacklib module is a library module for other Openstack modules to +utilize. A thorough description will be added later. + +This module is tested in combination with other modules needed to build and +leverage an entire Openstack software stack. + +Setup +----- + +### Installing openstacklib + + puppet module install openstack/openstacklib + +Usage +----- + +### Classes and Defined Types + +#### Defined type: openstacklib::db::mysql + +The db::mysql resource is a library resource that can be used by nova, cinder, +ceilometer, etc., to create a mysql database with configurable privileges for +a user connecting from defined hosts. + +Typically this resource will be declared with a notify parameter to configure +the sync command to execute when the database resource is changed. + +For example, in heat::db::mysql you might declare: + +``` +::openstacklib::db::mysql { 'heat': + password_hash => mysql_password($password), + dbname => $dbname, + user => $user, + host => $host, + charset => $charset, + collate => $collate, + allowed_hosts => $allowed_hosts, + notify => Exec['heat-dbsync'], + } +``` + +Some modules should ensure that the database is created before the service is +set up. For example, in keystone::db::mysql you would have: + +``` +::openstacklib::db::mysql { 'keystone': + password_hash => mysql_password($password), + dbname => $dbname, + user => $user, + host => $host, + charset => $charset, + collate => $collate, + allowed_hosts => $allowed_hosts, + notify => Exec['keystone-manage db_sync'], + before => Service['keystone'], + } +``` + +** Parameters for openstacklib::db::mysql: ** + +#####`password_hash` +Password hash to use for the database user for this service; +string; required + +#####`dbname` +The name of the database +string; optional; default to the $title of the resource, i.e. 'nova' + +#####`user` +The database user to create; +string; optional; default to the $title of the resource, i.e. 'nova' + +#####`host` +The IP address or hostname of the user in mysql_grant; +string; optional; default to '127.0.0.1' + +#####`charset` +The charset to use for the database; +string; optional; default to 'utf8' + +#####`collate` +The collate to use for the database; +string; optional; default to 'utf8_general_ci' + +#####`allowed_hosts` +Additional hosts that are allowed to access this database; +array or string; optional; default to undef + +#####`privileges` +Privileges given to the database user; +string or array of strings; optional; default to 'ALL' + +#### Defined type: openstacklib::db::postgresql + +The db::postgresql resource is a library resource that can be used by nova, +cinder, ceilometer, etc., to create a postgresql database and a user with +configurable privileges. + +Typically this resource will be declared with a notify parameter to configure +the sync command to execute when the database resource is changed. + +For example, in heat::db::postgresql you might declare: + +``` +::openstacklib::db::postgresql { $dbname: + password_hash => postgresql_password($user, $password), + dbname => $dbname, + user => $user, + notify => Exec['heat-dbsync'], +} +``` + +Some modules should ensure that the database is created before the service is +set up. For example, in keystone::db::postgresql you would have: + +``` +::openstacklib::db::postgresql { $dbname: + password_hash => postgresql_password($user, $password), + dbname => $dbname, + user => $user, + notify => Exec['keystone-manage db_sync'], + before => Service['keystone'], +} +``` + +** Parameters for openstacklib::db::postgresql: ** + +#####`password_hash` +Password hash to use for the database user for this service; +string; required + +#####`dbname` +The name of the database +string; optional; default to the $title of the resource, i.e. 'nova' + +#####`user` +The database user to create; +string; optional; default to the $title of the resource, i.e. 'nova' + +#####`encoding` +The encoding use for the database; +string; optional; default to undef + +#####`privileges` +Privileges given to the database user; +string or array of strings; optional; default to 'ALL' + +#### Defined type: openstacklib::service_validation + +The service_validation resource is a library resource that can be used by nova, cinder, +ceilometer, etc., to validate that a resource is actually up and running. + +For example, in nova::api you might declare: + +``` +::openstacklib::service_validation { 'nova-api': + command => 'nova list', + } +``` +This defined resource creates an exec-anchor pair where the anchor depends upon +the successful exec run. + +** Parameters for openstacklib::service_validation: ** + +#####`command` +Command to run for validating the service; +string; required + +#####`service_name` +The name of the service to validate; +string; optional; default to the $title of the resource, i.e. 'nova-api' + +#####`path` +The path of the command to validate the service; +string; optional; default to '/usr/bin:/bin:/usr/sbin:/sbin' + +#####`provider` +The provider to use for the exec command; +string; optional; default to 'shell' + +#####`tries` +Number of times to retry validation; +string; optional; default to '10' + +#####`try_sleep` +Number of seconds between validation attempts; +string; optional; default to '2' + +#### Defined provider for openstack_config: ini_setting + +It provides an interface to any INI configuration file as they are +used in Openstack modules. + +You use it like this: + +``` +Puppet::Type.type(:_config).provide( + :openstackconfig, + :parent => Puppet::Type.type(:openstack_config).provider(:ini_setting) +) do +``` + +It has the standard features of the upstream puppetlabs' `inifile` +module as it's a direct children of it. Furthermore it can transform +a value with some function of you're choice, enabling you to get value +that get filled at run-time like an `uuid`. + +For an example of how that's working you can have a look at this +[review](https://review.openstack.org/#/c/347468/) + +#### Defined provider for openstack_config: ruby + +This one has the same basic features as the ini_setting one but the +ability to transformation the value. It offers another feature, +though. It can parse array. What it enables one to do is to parse +this correctly: + +``` +[DEFAULT] +conf1 = value1 +conf1 = value2 +``` + +On the opposite side if you put that: + +``` +module_config { 'DEFAULT/conf1' : value => ['value1', 'value2'] } +``` + +in your manifest, it will properly be written as the example above. + +To use this provider you use this: + +``` +Puppet::Type.type(:_config).provide( + :openstackconfig, + :parent => Puppet::Type.type(:openstack_config).provider(:ruby) +) do +``` + +and define you type with ```:array_matching => :all```. An example of +such provider is ```nova_config```. Have a look for inspiration. + +Implementation +-------------- + +### openstacklib + +openstacklib is a combination of Puppet manifest and ruby code to delivery +configuration and extra functionality through types and providers. + +Limitations +----------- + +The python-migrate system package for RHEL 6 and below is out of date and may +fail to correctly migrate postgresql databases. While this module does not +handle database migrations, it is common to set up refresh relationships +between openstacklib::db::postgresql resource and the database sync exec +resource. Relying on this behavior may cause errors. + +Beaker-Rspec +------------ + +This module has beaker-rspec tests + +To run: + +```shell +bundle install +bundle exec rspec spec/acceptance +``` + +Development +----------- + +Developer documentation for the entire puppet-openstack project. + +* http://docs.openstack.org/developer/puppet-openstack-guide/ + +Contributors +------------ + +* https://github.com/stackforge/puppet-openstacklib/graphs/contributors + +Versioning +---------- + +This module has been given version 5 to track the puppet-openstack modules. The +versioning for the puppet-openstack modules are as follows: + +``` +Puppet Module :: OpenStack Version :: OpenStack Codename +2.0.0 -> 2013.1.0 -> Grizzly +3.0.0 -> 2013.2.0 -> Havana +4.0.0 -> 2014.1.0 -> Icehouse +5.0.0 -> 2014.2.0 -> Juno +6.0.0 -> 2015.1.0 -> Kilo +7.0.0 -> 2015.2.0 -> Liberty +``` diff --git a/deployment_scripts/puppet/modules/openstacklib/Rakefile b/deployment_scripts/puppet/modules/openstacklib/Rakefile new file mode 100644 index 0000000..168d108 --- /dev/null +++ b/deployment_scripts/puppet/modules/openstacklib/Rakefile @@ -0,0 +1 @@ +require 'puppet-openstack_spec_helper/rake_tasks' diff --git a/deployment_scripts/puppet/modules/openstacklib/bindep.txt b/deployment_scripts/puppet/modules/openstacklib/bindep.txt new file mode 100644 index 0000000..e69de29 diff --git a/deployment_scripts/puppet/modules/openstacklib/examples/virtual_packages.pp b/deployment_scripts/puppet/modules/openstacklib/examples/virtual_packages.pp new file mode 100644 index 0000000..2686a56 --- /dev/null +++ b/deployment_scripts/puppet/modules/openstacklib/examples/virtual_packages.pp @@ -0,0 +1,11 @@ +Exec { logoutput => 'on_failure' } + +include ::openstacklib::defaults + +if $::osfamily == 'RedHat' { + # Virtual package name, present in @base. + package { 'perl(Net::HTTP)': + ensure => present, + tag => 'openstack', + } +} diff --git a/deployment_scripts/puppet/modules/openstacklib/facts.d/os_service_default.txt b/deployment_scripts/puppet/modules/openstacklib/facts.d/os_service_default.txt new file mode 100644 index 0000000..3b9568f --- /dev/null +++ b/deployment_scripts/puppet/modules/openstacklib/facts.d/os_service_default.txt @@ -0,0 +1 @@ +os_service_default= diff --git a/deployment_scripts/puppet/modules/openstacklib/lib/facter/os_package_type.rb b/deployment_scripts/puppet/modules/openstacklib/lib/facter/os_package_type.rb new file mode 100644 index 0000000..134509e --- /dev/null +++ b/deployment_scripts/puppet/modules/openstacklib/lib/facter/os_package_type.rb @@ -0,0 +1,38 @@ +# +# We need this to be able to make decision of what style of package we are +# working with: Debian style package (for example, it uses a nova-consoleproxy +# package and not nova-novncproxy, or it has a openstack-dashboard-apache, +# etc.), or just the Ubuntu style package. +# +# This is needed, because in some cases, we are using the Debian style packages +# but running under Ubuntu. For example, that's the case when running with MOS +# over Ubuntu. For this case, a manual override is provided, in the form of a +# /etc/facter/facts.d/os_package_type.txt containing: +# os_package_type=debian +# +# In all other cases, we can consider that we're using vanilia (ie: unmodified) +# distribution packages, and we can set $::os_package_type depending on the +# value of $::operatingsystem. +# +# Having the below snipets helps simplifying checks within individual project +# manifests, so that we can just reuse $::os_package_type directly without +# having to also check if it contains a value, then check for the content of +# $::operatingsystem (ie: what's below factors the check once and for all). +Facter.add('os_package_type') do + setcode do + case Facter.value(:osfamily) + when 'Debian' + if Facter.value(:operatingsystem) == 'Debian' then + 'debian' + else + 'ubuntu' + end + when 'RedHat' + 'rpm' + when 'Solaris' + 'solaris' + else + 'unknown' + end + end +end diff --git a/deployment_scripts/puppet/modules/openstacklib/lib/facter/os_service_default.rb b/deployment_scripts/puppet/modules/openstacklib/lib/facter/os_service_default.rb new file mode 100644 index 0000000..c9169da --- /dev/null +++ b/deployment_scripts/puppet/modules/openstacklib/lib/facter/os_service_default.rb @@ -0,0 +1,14 @@ +# +# This adds the os_service_default fact for people with facter < 2.0.1 +# For people with facter >= 2.0.1, the facts.d/os_service_default.txt should +# provide this information +# +require 'puppet/util/package' + +if Puppet::Util::Package.versioncmp(Facter.value(:facterversion), '2.0.1') < 0 + Facter.add('os_service_default') do + setcode do + '' + end + end +end diff --git a/deployment_scripts/puppet/modules/openstacklib/lib/facter/os_workers.rb b/deployment_scripts/puppet/modules/openstacklib/lib/facter/os_workers.rb new file mode 100644 index 0000000..f6c9c64 --- /dev/null +++ b/deployment_scripts/puppet/modules/openstacklib/lib/facter/os_workers.rb @@ -0,0 +1,50 @@ +# +# We've found that using $::processorcount for workers/threads can lead to +# unexpected memory or process counts for people deploying on baremetal or +# if they have large number of cpus. This fact allows us to tweak the formula +# used to determine number of workers in a single place but use it across all +# modules. +# +# The value for os_workers is max between '(<# processors> / 4)' and '2' with +# a cap of 8. +# +# This fact can be overloaded by an external fact from /etc/factor/facts.d if +# a user would like to provide their own default value. +# +Facter.add(:os_workers_small) do + has_weight 100 + setcode do + processors = Facter.value('processorcount') + [ [ (processors.to_i / 4), 2 ].max, 8 ].min + end +end + +# +# The value above for os_workers performs 3x worse in many cases compared to +# the prevuous default of $::processorcount. +# +# Based on performance data [1], the following calculation is within 1-2%. +# +# The value for os_workers is max between '(<# processors> / 2)' and '2' with +# a cap of 12. +# +# [1] http://elk.browbeatproject.org:80/goto/a23307fd511e314b975dedca6f65425d +# +Facter.add(:os_workers) do + has_weight 100 + setcode do + processors = Facter.value('processorcount') + [ [ (processors.to_i / 2), 2 ].max, 12 ].min + end +end + +# +# For cases where services are not co-located together (ie monolithic). +# +Facter.add(:os_workers_large) do + has_weight 100 + setcode do + processors = Facter.value('processorcount') + [ (processors.to_i / 2) ] + end +end diff --git a/deployment_scripts/puppet/modules/openstacklib/lib/puppet/parser/functions/is_service_default.rb b/deployment_scripts/puppet/modules/openstacklib/lib/puppet/parser/functions/is_service_default.rb new file mode 100644 index 0000000..9af9148 --- /dev/null +++ b/deployment_scripts/puppet/modules/openstacklib/lib/puppet/parser/functions/is_service_default.rb @@ -0,0 +1,27 @@ +# +# is_service_default.rb +# +# This function can be used to check if a variable is set to the default value +# of '' +# +# For reference: +# http://lists.openstack.org/pipermail/openstack-dev/2015-July/069823.html +# https://github.com/openstack/puppet-openstacklib/commit/3b85306d042292713d0fd89fa508e0a0fbf99671 +# +module Puppet::Parser::Functions + newfunction(:is_service_default, :type => :rvalue, :doc => <<-EOS +Returns true if the variable passed to this function is '' + EOS + ) do |arguments| + raise(Puppet::ParseError, "is_service_default(): Wrong number of arguments" + + "given (#{arguments.size} for 1)") if arguments.size != 1 + + value = arguments[0] + + unless value.is_a?(String) + return false + end + + return (value == '') + end +end diff --git a/deployment_scripts/puppet/modules/openstacklib/lib/puppet/parser/functions/normalize_ip_for_uri.rb b/deployment_scripts/puppet/modules/openstacklib/lib/puppet/parser/functions/normalize_ip_for_uri.rb new file mode 100644 index 0000000..92dead9 --- /dev/null +++ b/deployment_scripts/puppet/modules/openstacklib/lib/puppet/parser/functions/normalize_ip_for_uri.rb @@ -0,0 +1,37 @@ +require 'ipaddr' + +module Puppet::Parser::Functions + newfunction(:normalize_ip_for_uri, + :type => :rvalue, + :doc => <<-EOD + Add brackets if the argument is an IPv6 address. + Returns the argument untouched otherwise. + CAUTION: this code "fails" when the user is passing + an IPv6 address with the port in it without the + brackets: 2001::1:8080, to specify address 2001::1 + and port 8080. This code will change it to + [2001::1:8080] as it's a valid ip address. This + shouldn't be an issue in most cases. + If an array is given, each member will be normalized to + a valid IPv6 address with brackets when needed. + EOD + ) do |args| + result = [] + args = args[0] if args[0].kind_of?(Array) + args.each do |ip| + begin + if IPAddr.new(ip).ipv6? + unless ip.match(/\[.+\]/) + Puppet.debug("IP #{ip} is changed to [#{ip}]") + ip = "[#{ip}]" + end + end + rescue ArgumentError + # ignore it + end + result << ip + end + return result[0] if args.size == 1 + result + end +end diff --git a/deployment_scripts/puppet/modules/openstacklib/lib/puppet/parser/functions/os_database_connection.rb b/deployment_scripts/puppet/modules/openstacklib/lib/puppet/parser/functions/os_database_connection.rb new file mode 100644 index 0000000..4cc428d --- /dev/null +++ b/deployment_scripts/puppet/modules/openstacklib/lib/puppet/parser/functions/os_database_connection.rb @@ -0,0 +1,81 @@ +require 'puppet/parser/functions' + +Puppet::Parser::Functions.newfunction(:os_database_connection, + :type => :rvalue, + :doc => <<-EOS +This function builds a os_database_connection string from various parameters. +EOS +) do |arguments| + + require 'uri' + + if (arguments.size != 1) then + raise(Puppet::ParseError, "os_database_connection(): Wrong number of arguments " + + "given (#{arguments.size} for 1)") + end + + v = arguments[0] + klass = v.class + + unless klass == Hash + raise(Puppet::ParseError, "os_database_connection(): Requires an hash, got #{klass}") + end + + v.keys.each do |key| + klass = (key == 'extra') ? Hash : String + unless (v[key].class == klass) or (v[key] == :undef) + raise(Puppet::ParseError, "os_database_connection(): #{key} should be a #{klass}") + end + end + + parts = {} + + unless v.include?('dialect') + raise(Puppet::ParseError, 'os_database_connection(): dialect is required') + end + + if v.include?('host') + parts[:host] = v['host'] + end + + unless v.include?('database') + raise(Puppet::ParseError, 'os_database_connection(): database is required') + end + + if v.include?('port') + if v.include?('host') + parts[:port] = v['port'].to_i + else + raise(Puppet::ParseError, 'os_database_connection(): host is required with port') + end + end + + if v.include?('username') and (v['username'] != :undef) and (v['username'].to_s != '') + parts[:userinfo] = URI.escape(v['username']) + if v.include?('password') and (v['password'] != :undef) and (v['password'].to_s != '') + parts[:userinfo] += ":#{URI.escape(v['password'])}" + end + end + + # support previous charset option on the function. Setting charset will + # override charset if passed in via the extra parameters + if v.include?('charset') + if v.include?('extra') + v['extra'].merge!({ 'charset' => v['charset'] }) + else + v['extra'] = { 'charset' => v['charset'] } + end + end + + parts[:query] = v['extra'].map{ |k,v| "#{k}=#{v}" }.join('&') if v.include?('extra') + + parts[:scheme] = v['dialect'] + + if v.include?('host') + parts[:path] = "/#{v['database']}" + else + parts[:path] = "///#{v['database']}" + end + + URI::Generic.build(parts).to_s +end diff --git a/deployment_scripts/puppet/modules/openstacklib/lib/puppet/parser/functions/os_transport_url.rb b/deployment_scripts/puppet/modules/openstacklib/lib/puppet/parser/functions/os_transport_url.rb new file mode 100644 index 0000000..7c611a9 --- /dev/null +++ b/deployment_scripts/puppet/modules/openstacklib/lib/puppet/parser/functions/os_transport_url.rb @@ -0,0 +1,157 @@ +require 'puppet/parser/functions' + +Puppet::Parser::Functions.newfunction(:os_transport_url, + :type => :rvalue, + :arity => 1, + :doc => <<-EOS +This function builds a os_transport_url string from a hash of parameters. + +Valid hash parameteres: + * transport - (string) type of transport, 'rabbit' or 'amqp' + * host - (string) single host + * hosts - (array) array of hosts to use + * port - (string | integer) port to connect to + * username - (string) connection username + * password - (string) connection password + * virtual_host - (string) virtual host to connect to + * ssl - (string) is the connection ssl or not ('1' or '0'). overrides the ssl + key in the query parameter + * query - (hash) hash of key,value pairs used to create a query string for + the transport_url. + +Only 'transport' and either 'host' or 'hosts' are required keys for the +parameters hash. + +The url format that will be generated: +transport://user:pass@host:port[,userN:passN@hostN:portN]/virtual_host?query + +NOTE: ipv6 addresses will automatically be bracketed for the URI using the +normalize_ip_for_uri function. + +Single Host Example: +os_transport_url({ + 'transport' => 'rabbit', + 'host' => '1.1.1.1', + 'port' => '5672', + 'username' => 'username', + 'password' => 'password', + 'virtual_host' => 'virtual_host', + 'ssl' => '1', + 'query' => { 'key' => 'value' }, +}) +Generates: +rabbit://username:password@1.1.1.1:5672/virtual_host?key=value&ssl=1 + +Multiple Hosts Example: +os_transport_url({ + 'transport' => 'rabbit', + 'hosts' => [ '1.1.1.1', '2.2.2.2' ], + 'port' => '5672', + 'username' => 'username', + 'password' => 'password', + 'virtual_host' => 'virtual_host', + 'query' => { 'key' => 'value' }, +}) +Generates: +rabbit://username:password@1.1.1.1:5672,username:password@2.2.2.2:5672/virtual_host?key=value +EOS +) do |arguments| + + require 'uri' + + v = arguments[0] + klass = v.class + + unless klass == Hash + raise(Puppet::ParseError, "os_transport_url(): Requires an hash, got #{klass}") + end + + # type checking for the parameter hash + v.keys.each do |key| + v[key] = v[key].to_s if key == 'port' + klass = (key == 'hosts') ? Array : String + klass = (key == 'query') ? Hash : klass + unless (v[key].class == klass) or (v[key] == :undef) + raise(Puppet::ParseError, "os_transport_url(): #{key} should be a #{klass}") + end + end + + # defaults + parts = { + :transport => 'rabbit', + :hostinfo => 'localhost', + :path => '/', + } + + unless v.include?('transport') + raise(Puppet::ParseError, 'os_transport_url(): transport is required') + end + + unless v.include?('host') or v.include?('hosts') + raise(Puppet::ParseError, 'os_transport_url(): host or hosts is required') + end + + if v.include?('host') and v.include?('hosts') + raise(Puppet::ParseError, 'os_transport_url(): cannot use both host and hosts.') + end + + parts[:transport] = v['transport'] + + if v.include?('username') and (v['username'] != :undef) and (v['username'].to_s != '') + parts[:userinfo] = URI.escape(v['username']) + if v.include?('password') and (v['password'] != :undef) and (v['password'].to_s != '') + parts[:userinfo] += ":#{URI.escape(v['password'])}" + end + end + + if v.include?('host') + host = function_normalize_ip_for_uri([v['host']]) + host += ":#{v['port'].to_s}" if v.include?('port') + if parts.include?(:userinfo) + parts[:hostinfo] = "#{parts[:userinfo]}@#{host}" + else + parts[:hostinfo] = "#{host}" + end + end + + if v.include?('hosts') + hosts = function_normalize_ip_for_uri([v['hosts']]) + # normalize_ip_for_uri may return a string, so check that we still have an + # array + hosts = [hosts] if hosts.kind_of?(String) + hosts = hosts.map{ |h| "#{h}:#{v['port'].to_s}" } if v.include?('port') + if parts.include?(:userinfo) + parts[:hostinfo] = hosts.map { |h| "#{parts[:userinfo]}@#{h}" }.join(',') + else + parts[:hostinfo] = hosts.join(',') + end + end + + parts[:path] = "/#{v['virtual_host']}" if v.include?('virtual_host') + + # support previous ssl option on the function. Setting ssl will + # override ssl if passed in via the query parameters + if v.include?('ssl') + # ssl can be passed in as a query paramter but should be 0/1. See + # http://docs.celeryproject.org/projects/kombu/en/latest/userguide/connections.html#urls + # so we rely on the stdlib str2bool and bool2num to ensure it's in the + # format + ssl_val = function_bool2num([function_str2bool([v['ssl']])]) + if v.include?('query') + v['query'].merge!({ 'ssl' => ssl_val }) + else + v['query'] = { 'ssl' => ssl_val } + end + end + + parts[:query] = v['query'].map{ |k,val| "#{k}=#{val}" }.join('&') if v.include?('query') + + + url_parts = [] + url_parts << parts[:transport] + url_parts << '://' + url_parts << parts[:hostinfo] + url_parts << parts[:path] + url_parts << '?' << parts[:query] if parts.include?(:query) + url_parts.join() +end diff --git a/deployment_scripts/puppet/modules/openstacklib/lib/puppet/provider/openstack.rb b/deployment_scripts/puppet/modules/openstacklib/lib/puppet/provider/openstack.rb new file mode 100644 index 0000000..0240ce4 --- /dev/null +++ b/deployment_scripts/puppet/modules/openstacklib/lib/puppet/provider/openstack.rb @@ -0,0 +1,153 @@ +require 'csv' +require 'puppet' +require 'timeout' + +class Puppet::Error::OpenstackAuthInputError < Puppet::Error +end + +class Puppet::Error::OpenstackUnauthorizedError < Puppet::Error +end + +class Puppet::Provider::Openstack < Puppet::Provider + + initvars # so commands will work + commands :openstack_command => 'openstack' + + @@no_retry_actions = %w(create remove delete) + @@command_timeout = 40 + # Fails on the 5th retry for a max of 212s (~3.5min) before total + # failure. + @@request_timeout = 170 + @@retry_sleep = 3 + class << self + [:no_retry_actions, :request_timeout, :retry_sleep].each do |m| + define_method m do + self.class_variable_get("@@#{m}") + end + define_method :"#{m}=" do |value| + self.class_variable_set("@@#{m}", value) + end + end + end + + # timeout the openstack command + # after this number of seconds + # retry the command until the request_timeout, + # unless it's a no_retry_actions call + def self.command_timeout(action=nil) + # give no_retry actions the full time limit to finish + return self.request_timeout() if no_retry_actions.include? action + self.class_variable_get("@@command_timeout") + end + + # with command_timeout + def self.openstack(*args) + begin + action = args[1] + Timeout.timeout(command_timeout(action)) do + openstack_command *args + end + rescue Timeout::Error + raise Puppet::ExecutionFailure, "Command: 'openstack #{args.inspect}' has been running for more than #{command_timeout(action)} seconds" + end + end + + # get the current timestamp + def self.current_time + Time.now.to_i + end + + def self.request_without_retry(&block) + previous_timeout = self.request_timeout + rc = nil + if block_given? + self.request_timeout = 0 + rc = yield + end + ensure + self.request_timeout = previous_timeout + rc + end + + # Returns an array of hashes, where the keys are the downcased CSV headers + # with underscores instead of spaces + # + # @param options [Hash] Other options + # @options :no_retry_exception_msgs [Array,Regexp] exception without retries + def self.request(service, action, properties, credentials=nil, options={}) + env = credentials ? credentials.to_env : {} + no_retry = options[:no_retry_exception_msgs] + + Puppet::Util.withenv(env) do + rv = nil + end_time = current_time + request_timeout + start_time = current_time + retry_count = 0 + loop do + begin + if action == 'list' + # shell output is: + # ID,Name,Description,Enabled + response = openstack(service, action, '--quiet', '--format', 'csv', properties) + response = parse_csv(response) + keys = response.delete_at(0) + rv = response.collect do |line| + hash = {} + keys.each_index do |index| + key = keys[index].downcase.gsub(/ /, '_').to_sym + hash[key] = line[index] + end + hash + end + elsif action == 'show' or action == 'create' + rv = {} + # shell output is: + # name="value1" + # id="value2" + # description="value3" + openstack(service, action, '--format', 'shell', properties).split("\n").each do |line| + # key is everything before the first "=" + key, val = line.split('=', 2) + next unless val # Ignore warnings + # value is everything after the first "=", with leading and trailing double quotes stripped + val = val.gsub(/\A"|"\Z/, '') + rv[key.downcase.to_sym] = val + end + else + rv = openstack(service, action, properties) + end + break + rescue Puppet::ExecutionFailure => exception + raise Puppet::Error::OpenstackUnauthorizedError, 'Could not authenticate' if exception.message =~ /HTTP 40[13]/ + if current_time > end_time + error_message = exception.message + error_message += " (tried #{retry_count}, for a total of #{end_time - start_time } seconds)" + raise(Puppet::ExecutionFailure, error_message) + end + + raise exception if no_retry_actions.include? action + if no_retry + no_retry = [no_retry] unless no_retry.is_a?(Array) + no_retry.each do |nr| + raise exception if exception.message.match(nr) + end + end + debug "Non-fatal error: '#{exception.message}'. Retrying for #{end_time - current_time} more seconds" + sleep retry_sleep + retry_count += 1 + retry + end + end + return rv + end + end + + private + + def self.parse_csv(text) + # Ignore warnings - assume legitimate output starts with a double quoted + # string. Errors will be caught and raised prior to this + text = text.split("\n").drop_while { |line| line !~ /^\".*\"/ }.join("\n") + return CSV.parse(text + "\n") + end +end diff --git a/deployment_scripts/puppet/modules/openstacklib/lib/puppet/provider/openstack/auth.rb b/deployment_scripts/puppet/modules/openstacklib/lib/puppet/provider/openstack/auth.rb new file mode 100644 index 0000000..584bfc7 --- /dev/null +++ b/deployment_scripts/puppet/modules/openstacklib/lib/puppet/provider/openstack/auth.rb @@ -0,0 +1,51 @@ +#require 'puppet/provider/openstack/credentials' +require File.join(File.dirname(__FILE__), '..','..','..', 'puppet/provider/openstack/credentials') + +module Puppet::Provider::Openstack::Auth + + RCFILENAME = "#{ENV['HOME']}/openrc" + + def get_os_vars_from_env + env = {} + ENV.each { |k,v| env.merge!(k => v) if k =~ /^OS_/ } + return env + end + + def get_os_vars_from_rcfile(filename) + env = {} + rcfile = [filename, '/root/openrc'].detect { |f| File.exists? f } + unless rcfile.nil? + File.open(rcfile).readlines.delete_if{|l| l=~ /^#|^$/ }.each do |line| + key, value = line.split('=') + key = key.split(' ').last + value = value.chomp.gsub(/'/, '') + env.merge!(key => value) if key =~ /OS_/ + end + end + return env + end + + def rc_filename + RCFILENAME + end + + def request(service, action, properties=nil, options={}) + properties ||= [] + set_credentials(@credentials, get_os_vars_from_env) + unless @credentials.set? + @credentials.unset + set_credentials(@credentials, get_os_vars_from_rcfile(rc_filename)) + end + unless @credentials.set? + raise(Puppet::Error::OpenstackAuthInputError, 'Insufficient credentials to authenticate') + end + super(service, action, properties, @credentials, options) + end + + def set_credentials(creds, env) + env.each do |key, val| + var = key.sub(/^OS_/,'').downcase + creds.set(var, val) + end + end +end diff --git a/deployment_scripts/puppet/modules/openstacklib/lib/puppet/provider/openstack/credentials.rb b/deployment_scripts/puppet/modules/openstacklib/lib/puppet/provider/openstack/credentials.rb new file mode 100644 index 0000000..2765b2b --- /dev/null +++ b/deployment_scripts/puppet/modules/openstacklib/lib/puppet/provider/openstack/credentials.rb @@ -0,0 +1,95 @@ +require 'puppet' +require 'puppet/provider/openstack' + +class Puppet::Provider::Openstack::Credentials + + KEYS = [ + :auth_url, :password, :project_name, :username, + :token, :url, + :identity_api_version, + :region_name, + :interface + ] + + KEYS.each { |var| attr_accessor var } + + def self.defined?(name) + KEYS.include?(name.to_sym) + end + + def set(key, val) + if self.class.defined?(key.to_sym) + self.instance_variable_set("@#{key}".to_sym, val) + end + end + + def set? + return true if user_password_set? || service_token_set? + end + + def service_token_set? + return true if @token && @url + end + + def to_env + env = {} + self.instance_variables.each do |var| + name = var.to_s.sub(/^@/,'OS_').upcase + env.merge!(name => self.instance_variable_get(var)) + end + env + end + + def user_password_set? + return true if @username && @password && @project_name && @auth_url + end + + def unset + KEYS.each do |key| + if key != :identity_api_version && + self.instance_variable_defined?("@#{key}") + set(key, '') + end + end + end + + def version + self.class.to_s.sub(/.*V/,'').sub('_','.') + end +end + +class Puppet::Provider::Openstack::CredentialsV2_0 < Puppet::Provider::Openstack::Credentials +end + +class Puppet::Provider::Openstack::CredentialsV3 < Puppet::Provider::Openstack::Credentials + + KEYS = [ + :cacert, + :cert, + :default_domain, + :domain_id, + :domain_name, + :key, + :project_domain_id, + :project_domain_name, + :project_id, + :trust_id, + :user_domain_id, + :user_domain_name, + :user_id + ] + + KEYS.each { |var| attr_accessor var } + + def self.defined?(name) + KEYS.include?(name.to_sym) || super + end + + def user_password_set? + return true if (@username || @user_id) && @password && (@project_name || @project_id) && @auth_url + end + + def initialize + set(:identity_api_version, version) + end +end diff --git a/deployment_scripts/puppet/modules/openstacklib/lib/puppet/provider/openstack_config/ini_setting.rb b/deployment_scripts/puppet/modules/openstacklib/lib/puppet/provider/openstack_config/ini_setting.rb new file mode 100644 index 0000000..c96546d --- /dev/null +++ b/deployment_scripts/puppet/modules/openstacklib/lib/puppet/provider/openstack_config/ini_setting.rb @@ -0,0 +1,73 @@ +Puppet::Type.type(:openstack_config).provide( + :ini_setting, + :parent => Puppet::Type.type(:ini_setting).provider(:ruby) +) do + + def exists? + if resource[:value] == ensure_absent_val + resource[:ensure] = :absent + end + super + end + + def create + resource[:value] = transform(:to, resource[:value]) + super + end + + def section + resource[:name].split('/', 2).first + end + + def setting + resource[:name].split('/', 2).last + end + + def value=(value) + new_value = transform(:to, value) + + ini_file.set_value(section, setting, new_value) + ini_file.save + end + + def value + value = ini_file.get_value(section, setting) + new_value = transform(:from, value) + @property_hash[:value] = new_value + new_value + end + + def ensure_absent_val + resource[:ensure_absent_val] + end + + def transform_to + return nil unless resource.to_hash.has_key? :transform_to + resource[:transform_to] + end + + def transform_to=(value) + @property_hash[:transform_to] = value + end + + def separator + '=' + end + + def file_path + self.class.file_path + end + + def transform(direction, value) + new_value = value + if !transform_to.nil? && !transform_to.empty? + transformation_function = "#{direction}_#{transform_to}".to_sym + if self.respond_to?(transformation_function) + new_value = send(transformation_function, value) + else + error("Cannot find transformation #{transformation_function} for #{value}") + end + end + new_value + end +end diff --git a/deployment_scripts/puppet/modules/openstacklib/lib/puppet/provider/openstack_config/ruby.rb b/deployment_scripts/puppet/modules/openstacklib/lib/puppet/provider/openstack_config/ruby.rb new file mode 100644 index 0000000..6decd00 --- /dev/null +++ b/deployment_scripts/puppet/modules/openstacklib/lib/puppet/provider/openstack_config/ruby.rb @@ -0,0 +1,94 @@ + +require File.expand_path('../../../util/openstackconfig', __FILE__) + + +Puppet::Type.type(:openstack_config).provide(:ruby) do + + def self.instances + if self.respond_to?(:file_path) + config = Puppet::Util::OpenStackConfig.new(file_path) + resources = [] + config.section_names.each do |section_name| + config.get_settings(section_name).each do |setting, value| + resources.push( + new( + :name => namevar(section_name, setting), + :value => value, + :ensure => :present + ) + ) + end + end + resources + else + raise(Puppet::Error, + 'OpenStackConfig only support collecting instances when a file path ' + + 'is hard coded' + ) + end + end + + def self.namevar(section_name, setting) + "#{section_name}/#{setting}" + end + + def exists? + if resource[:value] == ensure_absent_val + resource[:ensure] = :absent + end + !config.get_value(section, setting).nil? + end + + def create + config.set_value(section, setting, resource[:value]) + config.save + @config = nil + end + + def destroy + config.remove_setting(section, setting) + config.save + @config = nil + end + + def value=(value) + config.set_value(section, setting, resource[:value]) + config.save + end + + def value + val = config.get_value(section, setting) + if !val.kind_of?(Array) + [val] + else + val + end + end + + def section + resource[:name].split('/', 2).first + end + + def setting + resource[:name].split('/', 2).last + end + + def ensure_absent_val + # :array_matching => :all values comes in form of array even when they + # are passed as single string + if resource[:value].kind_of?(Array) and not resource[:ensure_absent_val].kind_of?(Array) + [resource[:ensure_absent_val]] + else + resource[:ensure_absent_val] + end + end + + def file_path + self.class.file_path + end + + private + def config + @config ||= Puppet::Util::OpenStackConfig.new(file_path) + end +end diff --git a/deployment_scripts/puppet/modules/openstacklib/lib/puppet/provider/policy_rcd/policy_rcd.rb b/deployment_scripts/puppet/modules/openstacklib/lib/puppet/provider/policy_rcd/policy_rcd.rb new file mode 100644 index 0000000..c753be6 --- /dev/null +++ b/deployment_scripts/puppet/modules/openstacklib/lib/puppet/provider/policy_rcd/policy_rcd.rb @@ -0,0 +1,91 @@ +Puppet::Type.type(:policy_rcd).provide(:policy_rcd) do + + desc 'Provider for managing policy-rc.d for Ubuntu' + + mk_resource_methods + + def check_os + Facter.value(:osfamily) == 'Debian' + end + + def check_policy_rcd + return File.exist? policy_rcd + end + + def file_lines + @file_lines ||= File.open(policy_rcd).readlines + end + + def policy_rcd + '/usr/sbin/policy-rc.d' + end + + def service + @resource[:service] + end + + def set_code + @resource[:set_code] + end + + def self.write_to_file(file, content, truncate=false) + File.truncate(file, 0) if truncate + policy = File.open(file, 'a+') + policy.puts(content) + policy.close + File.chmod(0744, file) + end + + def exists? + # we won't do anything if os family is not debian + return true unless check_os + if check_policy_rcd + file_lines.each do |line| + unless line =~ /"#{@resource[:service]}"/ + next + end + return true + end + end + false + end + + def create + unless check_policy_rcd + header = "#!/bin/bash\n# THIS FILE MANAGED BY PUPPET\n" + else + header = "" + end + content = "#{header}[[ \"$1\" == \"#{@resource[:service]}\" ]] && exit #{@resource[:set_code]}\n" + self.class.write_to_file(policy_rcd, content) + end + + def destroy + if check_policy_rcd + file_lines.delete_if { |l| l =~ /"#{@resource[:service]}"/ } + self.class.write_to_file(policy_rcd, file_lines, true) + end + end + + def flush + if @resource[:ensure] == :present and ! file_lines.nil? + new_line = nil + outdated_line = nil + file_lines.each do |line| + unless line =~ /"#{@resource[:service]}"/ + next + end + code = line.match(/exit\s(\d+)/)[1] + if code != @resource[:set_code] + new_line = "[[ \"$1\" == \"#{@resource[:service]}\" ]] && exit #{@resource[:set_code]}\n" + outdated_line = line + end + end + unless new_line.nil? + file_lines.delete(outdated_line) + file_lines.push(new_line) + self.class.write_to_file(policy_rcd, file_lines, true) + end + end + end +end diff --git a/deployment_scripts/puppet/modules/openstacklib/lib/puppet/type/openstack_config.rb b/deployment_scripts/puppet/modules/openstacklib/lib/puppet/type/openstack_config.rb new file mode 100644 index 0000000..8addb2b --- /dev/null +++ b/deployment_scripts/puppet/modules/openstacklib/lib/puppet/type/openstack_config.rb @@ -0,0 +1,3 @@ +Puppet::Type.newtype(:openstack_config) do + +end diff --git a/deployment_scripts/puppet/modules/openstacklib/lib/puppet/type/policy_rcd.rb b/deployment_scripts/puppet/modules/openstacklib/lib/puppet/type/policy_rcd.rb new file mode 100644 index 0000000..a26ebe7 --- /dev/null +++ b/deployment_scripts/puppet/modules/openstacklib/lib/puppet/type/policy_rcd.rb @@ -0,0 +1,21 @@ +Puppet::Type.newtype(:policy_rcd) do + ensurable + + newparam(:name, :namevar => true) do + newvalues(/\S+/) + end + + newproperty(:service) do + defaultto { @resource[:name] } + newvalues(/\S+/) + end + + newproperty(:set_code) do + defaultto('101') + validate do |value| + # validate codes according to https://people.debian.org/~hmh/invokerc.d-policyrc.d-specification.txt + allowed_codes = [ '0', '1', '100', '101', '102', '103', '104', '105', '106' ] + raise ArgumentError, 'Unknown exit status code is set' unless allowed_codes.include?(value) + end + end +end diff --git a/deployment_scripts/puppet/modules/openstacklib/lib/puppet/util/openstackconfig.rb b/deployment_scripts/puppet/modules/openstacklib/lib/puppet/util/openstackconfig.rb new file mode 100644 index 0000000..4ba0ce2 --- /dev/null +++ b/deployment_scripts/puppet/modules/openstacklib/lib/puppet/util/openstackconfig.rb @@ -0,0 +1,117 @@ +# +# Author: Martin Magr +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +# Forked from https://github.com/puppetlabs/puppetlabs-inifile . + +require File.expand_path('../openstackconfig/section', __FILE__) + + +module Puppet +module Util + class OpenStackConfig + + @@SECTION_REGEX = /^\s*\[(.*)\]\s*$/ + + def initialize(path) + @path = path + @order = [] + @sections = {} + parse_file + end + + attr_reader :path + + def section_names + @sections.keys + end + + def get_settings(section_name) + @sections[section_name].settings + end + + def get_value(section_name, setting_name) + if @sections.has_key?(section_name) + @sections[section_name].settings[setting_name] + end + end + + def set_value(section_name, setting_name, value) + unless @sections.has_key?(section_name) + add_section(section_name) + end + if @sections[section_name].settings.has_key?(setting_name) + @sections[section_name].update_setting(setting_name, value) + else + @sections[section_name].add_setting(setting_name, value) + end + end + + def remove_setting(section_name, setting_name, value=nil) + @sections[section_name].remove_setting(setting_name, value) + end + + def save + File.open(@path, 'w') do |fh| + @order.each do |section_name| + if section_name.length > 0 + fh.puts("[#{section_name}]") + end + unless @sections[section_name].lines.empty? + @sections[section_name].lines.each do |line| + fh.puts(line) + end + end + end + end + end + + private + # This is mostly here because it makes testing easier + # --we don't have to try to stub any methods on File. + def self.readlines(path) + # If this type is ever used with very large files, we should + # write this in a different way, using a temp + # file; for now assuming that this type is only used on + # small-ish config files that can fit into memory without + # too much trouble. + File.file?(path) ? File.readlines(path) : [] + end + + def parse_file + # We always create a "global" section at the beginning of the file, + # for anything that appears before the first named section. + lines = [] + current_section = '' + OpenStackConfig.readlines(@path).each do |line| + if match = @@SECTION_REGEX.match(line) + add_section(current_section, lines) + # start new section parsing + lines = [] + current_section = match[1] + else + lines.push(line) + end + end + add_section(current_section, lines) + end + + def add_section(section_name, lines=nil) + @order.push(section_name) + @sections[section_name] = Section.new(section_name, lines) + end + + end +end +end diff --git a/deployment_scripts/puppet/modules/openstacklib/lib/puppet/util/openstackconfig/section.rb b/deployment_scripts/puppet/modules/openstacklib/lib/puppet/util/openstackconfig/section.rb new file mode 100644 index 0000000..b11279a --- /dev/null +++ b/deployment_scripts/puppet/modules/openstacklib/lib/puppet/util/openstackconfig/section.rb @@ -0,0 +1,178 @@ +# +# Author: Martin Magr +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +# Forked from https://github.com/puppetlabs/puppetlabs-inifile . + + +module Puppet +module Util +class OpenStackConfig + class Section + + @@SETTING_REGEX = /^(\s*)([^#;\s]|[^#;\s].*?[^\s=])(\s*=[ \t]*)(.*)\s*$/ + @@COMMENTED_SETTING_REGEX = /^(\s*)[#;]+(\s*)(.*?[^\s=])(\s*=[ \t]*)(.*)\s*$/ + + def initialize(name, lines=nil) + @name = name + @lines = lines.nil? ? [] : lines + # parse lines + @indentation = nil + @settings = {} + @lines.each do |line| + if match = @@SETTING_REGEX.match(line) + indent = match[1].length + @indentation = [indent, @indentation || indent].min + if @settings.include?(match[2]) + if not @settings[match[2]].kind_of?(Array) + @settings[match[2]] = [@settings[match[2]]] + end + @settings[match[2]].push(match[4]) + else + @settings[match[2]] = match[4] + end + end + end + end + + attr_reader :name, :indentation + + def settings + Marshal.load(Marshal.dump(@settings)) + end + + def lines + @lines.clone + end + + def is_global? + @name == '' + end + + def is_new_section? + @lines.empty? + end + + def setting_names + @settings.keys + end + + def add_setting(setting_name, value) + @settings[setting_name] = value + add_lines(setting_name, value) + end + + def update_setting(setting_name, value) + old_value = @settings[setting_name] + @settings[setting_name] = value + if value.kind_of?(Array) or old_value.kind_of?(Array) + # ---- update lines for multi setting ---- + old_value = old_value.kind_of?(Array) ? old_value : [old_value] + new_value = value.kind_of?(Array) ? value : [value] + if useless = old_value - new_value + remove_lines(setting_name, useless) + end + if missing = new_value - old_value + add_lines(setting_name, missing) + end + else + # ---- update lines for single setting ---- + @lines.each_with_index do |line, index| + if match = @@SETTING_REGEX.match(line) + if (match[2] == setting_name) + @lines[index] = "#{match[1]}#{match[2]}#{match[3]}#{value}\n" + end + end + end + end + end + + def remove_setting(setting_name, value=nil) + if value.nil? or @settings[setting_name] == value + @settings.delete(setting_name) + else + value.each do |val| + @settings[setting_name].delete(val) + end + end + remove_lines(setting_name, value) + end + + private + def find_commented_setting(setting_name) + @lines.each_with_index do |line, index| + if match = @@COMMENTED_SETTING_REGEX.match(line) + if match[3] == setting_name + return index + end + end + end + nil + end + + def find_last_setting(setting_name) + result = nil + @lines.each_with_index do |line, index| + if match = @@SETTING_REGEX.match(line) + if match[2] == setting_name + result = index + end + end + end + result + end + + def remove_lines(setting_name, value=nil) + if value.kind_of?(Array) + val_arr = value + else + val_arr = [value] + end + val_arr.each do |val| + @lines.each_with_index do |line, index| + if (match = @@SETTING_REGEX.match(line)) + if match[2] == setting_name + if val.nil? or val_arr.include?(match[4]) + @lines.delete_at(index) + break + end + end + end + end + end + end + + def add_lines(setting_name, value) + indent_str = ' ' * (indentation || 0) + if current = find_last_setting(setting_name) + offset = current + elsif comment = find_commented_setting(setting_name) + offset = comment + 1 + else + offset = @lines.length + end + if value.kind_of?(Array) + value.each do |val| + @lines.insert(offset, "#{indent_str}#{setting_name}=#{val}\n") + offset += 1 + end + else + @lines.insert(offset, "#{indent_str}#{setting_name}=#{value}\n") + end + end + + end +end +end +end diff --git a/deployment_scripts/puppet/modules/openstacklib/manifests/db/mysql.pp b/deployment_scripts/puppet/modules/openstacklib/manifests/db/mysql.pp new file mode 100644 index 0000000..c0514b4 --- /dev/null +++ b/deployment_scripts/puppet/modules/openstacklib/manifests/db/mysql.pp @@ -0,0 +1,91 @@ +# == Definition: openstacklib::db::mysql +# +# This resource configures a mysql database for an OpenStack service +# +# == Parameters: +# +# [*password_hash*] +# Password hash to use for the database user for this service; +# string; required +# +# [*dbname*] +# The name of the database +# string; optional; default to the $title of the resource, i.e. 'nova' +# +# [*user*] +# The database user to create; +# string; optional; default to the $title of the resource, i.e. 'nova' +# +# [*host*] +# The IP address or hostname of the user in mysql_grant; +# string; optional; default to '127.0.0.1' +# +# [*charset*] +# The charset to use for the database; +# string; optional; default to 'utf8' +# +# [*collate*] +# The collate to use for the database; +# string; optional; default to 'utf8_general_ci' +# +# [*allowed_hosts*] +# Additional hosts that are allowed to access this database; +# array or string; optional; default to undef +# +# [*privileges*] +# Privileges given to the database user; +# string or array of strings; optional; default to 'ALL' +# +# [*create_user*] +# Flag to allow for the skipping of the user as part of the database setup. +# Set to false to skip the user creation. +# Defaults to true. +# +# [*create_grant*] +# Flag to allow for the skipping of the user grants as part of the database +# setup. Set to false to skip the user creation. +# Defaults to true. +# +# [*tls_options*] +# The TLS options that the user will have +# Defaults to ['NONE'] +# +define openstacklib::db::mysql ( + $password_hash, + $dbname = $title, + $user = $title, + $host = '127.0.0.1', + $charset = 'utf8', + $collate = 'utf8_general_ci', + $allowed_hosts = [], + $privileges = 'ALL', + $create_user = true, + $create_grant = true, + $tls_options = ['NONE'], +) { + + include ::mysql::server + include ::mysql::client + + mysql_database { $dbname: + ensure => present, + charset => $charset, + collate => $collate, + require => [ Class['mysql::server'], Class['mysql::client'] ], + } + + if $create_user or $create_grant { + $allowed_hosts_list = unique(concat(any2array($allowed_hosts), [$host])) + $real_allowed_hosts = prefix($allowed_hosts_list, "${dbname}_") + + openstacklib::db::mysql::host_access { $real_allowed_hosts: + user => $user, + password_hash => $password_hash, + database => $dbname, + privileges => $privileges, + create_user => $create_user, + create_grant => $create_grant, + tls_options => $tls_options, + } + } +} diff --git a/deployment_scripts/puppet/modules/openstacklib/manifests/db/mysql/host_access.pp b/deployment_scripts/puppet/modules/openstacklib/manifests/db/mysql/host_access.pp new file mode 100644 index 0000000..bd1ee99 --- /dev/null +++ b/deployment_scripts/puppet/modules/openstacklib/manifests/db/mysql/host_access.pp @@ -0,0 +1,63 @@ +# Allow a user to access the database for the service +# +# == Namevar +# String with the form dbname_host. The host part of the string is the host +# to allow +# +# == Parameters +# [*user*] +# username to allow +# +# [*password_hash*] +# user password hash +# +# [*database*] +# the database name +# +# [*privileges*] +# the privileges to grant to this user +# +# [*create_user*] +# Flag to allow for the skipping of the user as part of the database setup. +# Set to false to skip the user creation. +# Defaults to true. +# +# [*create_grant*] +# Flag to allow for the skipping of the user grants as part of the database +# setup. Set to false to skip the user creation. +# Defaults to true. +# +# [*tls_options*] +# The TLS options that the user will have +# Defaults to ['NONE'] +# +define openstacklib::db::mysql::host_access ( + $user, + $password_hash, + $database, + $privileges, + $create_user = true, + $create_grant = true, + $tls_options = ['NONE'], +) { + validate_re($title, '_', 'Title must be $dbname_$host') + + $host = inline_template('<%= @title.split("_").last.downcase %>') + + if $create_user { + mysql_user { "${user}@${host}": + password_hash => $password_hash, + tls_options => $tls_options, + require => Mysql_database[$database], + } + } + + if $create_grant { + mysql_grant { "${user}@${host}/${database}.*": + privileges => $privileges, + table => "${database}.*", + require => Mysql_user["${user}@${host}"], + user => "${user}@${host}", + } + } +} diff --git a/deployment_scripts/puppet/modules/openstacklib/manifests/db/postgresql.pp b/deployment_scripts/puppet/modules/openstacklib/manifests/db/postgresql.pp new file mode 100644 index 0000000..0135804 --- /dev/null +++ b/deployment_scripts/puppet/modules/openstacklib/manifests/db/postgresql.pp @@ -0,0 +1,47 @@ +# == Definition: openstacklib::db::postgresql +# +# This resource configures a postgresql database for an OpenStack service +# +# == Parameters: +# +# [*password_hash*] +# Password hash to use for the database user for this service; +# string; required +# +# [*dbname*] +# The name of the database +# string; optional; default to the $title of the resource, i.e. 'nova' +# +# [*user*] +# The database user to create; +# string; optional; default to the $title of the resource, i.e. 'nova' +# +# [*encoding*] +# The charset to use for the database; +# string; optional; default to undef +# +# [*privileges*] +# Privileges given to the database user; +# string or array of strings; optional; default to 'ALL' + +define openstacklib::db::postgresql ( + $password_hash, + $dbname = $title, + $user = $title, + $encoding = undef, + $privileges = 'ALL', +){ + + if ((($::operatingsystem == 'RedHat' or $::operatingsystem == 'CentOS') and (versioncmp($::operatingsystemmajrelease, '6') <= 0)) + or ($::operatingsystem == 'Fedora' and (versioncmp($::operatingsystemmajrelease, '14') <= 0))) { + warning("The system packages handling the postgresql infrastructure for OpenStack \ +are out of date and should not be relied on for database migrations.") + } + + postgresql::server::db { $dbname: + user => $user, + password => $password_hash, + encoding => $encoding, + grant => $privileges, + } +} diff --git a/deployment_scripts/puppet/modules/openstacklib/manifests/defaults.pp b/deployment_scripts/puppet/modules/openstacklib/manifests/defaults.pp new file mode 100644 index 0000000..23925cb --- /dev/null +++ b/deployment_scripts/puppet/modules/openstacklib/manifests/defaults.pp @@ -0,0 +1,14 @@ +# == Class: openstacklib::defaults +# +# Default configuration for all openstack-puppet module. +# +# This file is loaded in the params.pp of each class. +# +class openstacklib::defaults { + # Ensure all package resources have virtual package enable. + if versioncmp($::puppetversion, '4.0.0') < 0 and versioncmp($::puppetversion, '3.6.1') >= 0 { + Package<| tag == 'openstack' |> { + allow_virtual => true, + } + } +} diff --git a/deployment_scripts/puppet/modules/openstacklib/manifests/messaging/rabbitmq.pp b/deployment_scripts/puppet/modules/openstacklib/manifests/messaging/rabbitmq.pp new file mode 100644 index 0000000..16f6c62 --- /dev/null +++ b/deployment_scripts/puppet/modules/openstacklib/manifests/messaging/rabbitmq.pp @@ -0,0 +1,105 @@ +# +# Copyright (C) 2014 eNovance SAS +# +# Author: Emilien Macchi +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +# == Definition: openstacklib::messaging::rabbitmq +# +# This resource creates RabbitMQ resources for an OpenStack service. +# +# == Parameters: +# +# [*userid*] +# (optional) The username to use when connecting to Rabbit +# Defaults to 'guest' +# +# [*password*] +# (optional) The password to use when connecting to Rabbit +# Defaults to 'guest' +# +# [*virtual_host*] +# (optional) The virtual host to use when connecting to Rabbit +# Defaults to '/' +# +# [*is_admin*] +# (optional) If the user should be admin or not +# Defaults to false +# +# [*configure_permission*] +# (optional) Define configure permission +# Defaults to '.*' +# +# [*write_permission*] +# (optional) Define write permission +# Defaults to '.*' +# +# [*read_permission*] +# (optional) Define read permission +# Defaults to '.*' +# +# [*manage_user*] +# (optional) Manage or not the user +# Defaults to true +# +# [*manage_user_permissions*] +# (optional) Manage or not user permissions +# Defaults to true +# +# [*manage_vhost*] +# (optional) Manage or not the vhost +# Defaults to true +# +define openstacklib::messaging::rabbitmq( + $userid = 'guest', + $password = 'guest', + $virtual_host = '/', + $is_admin = false, + $configure_permission = '.*', + $write_permission = '.*', + $read_permission = '.*', + $manage_user = true, + $manage_user_permissions = true, + $manage_vhost = true, +) { + + if $manage_user { + if $userid == 'guest' { + $is_admin_real = false + } else { + $is_admin_real = $is_admin + } + ensure_resource('rabbitmq_user', $userid, { + 'admin' => $is_admin_real, + 'password' => $password, + 'provider' => 'rabbitmqctl', + }) + } + + if $manage_user_permissions { + ensure_resource('rabbitmq_user_permissions', "${userid}@${virtual_host}", { + 'configure_permission' => $configure_permission, + 'write_permission' => $write_permission, + 'read_permission' => $read_permission, + 'provider' => 'rabbitmqctl', + }) + } + + if $manage_vhost { + ensure_resource('rabbitmq_vhost', $virtual_host, { + 'provider' => 'rabbitmqctl', + }) + } + +} diff --git a/deployment_scripts/puppet/modules/openstacklib/manifests/openstackclient.pp b/deployment_scripts/puppet/modules/openstacklib/manifests/openstackclient.pp new file mode 100644 index 0000000..25e23ad --- /dev/null +++ b/deployment_scripts/puppet/modules/openstacklib/manifests/openstackclient.pp @@ -0,0 +1,15 @@ +# == Class: openstacklib::openstackclient +# +# Installs the openstackclient +# +# == Parameters +# +# [*package_ensure*] +# Ensure state of the openstackclient package. +# Optional. Defaults to 'present'. +# +class openstacklib::openstackclient( + $package_ensure = 'present', +){ + ensure_packages('python-openstackclient', {'ensure' => $package_ensure, tag => 'openstack'}) +} diff --git a/deployment_scripts/puppet/modules/openstacklib/manifests/policy.pp b/deployment_scripts/puppet/modules/openstacklib/manifests/policy.pp new file mode 100644 index 0000000..b111427 --- /dev/null +++ b/deployment_scripts/puppet/modules/openstacklib/manifests/policy.pp @@ -0,0 +1,19 @@ +# == Class: openstacklib::policies +# +# This resource is an helper to call the policy definition +# +# == Parameters: +# +# [*policies*] +# Hash of policies one would like to set to specific values +# hash; optional +# +class openstacklib::policy ( + $policies = {}, +) { + + validate_hash($policies) + + create_resources('openstacklib::policy::base', $policies) + +} diff --git a/deployment_scripts/puppet/modules/openstacklib/manifests/policy/base.pp b/deployment_scripts/puppet/modules/openstacklib/manifests/policy/base.pp new file mode 100644 index 0000000..d5c457a --- /dev/null +++ b/deployment_scripts/puppet/modules/openstacklib/manifests/policy/base.pp @@ -0,0 +1,45 @@ +# == Definition: openstacklib::policy::base +# +# This resource configures the policy.json file for an OpenStack service +# +# == Parameters: +# +# [*file_path*] +# Path to the policy.json file +# string; required +# +# [*key*] +# The key to replace the value for +# string; required; the key to replace the value for +# +# [*value*] +# The value to set +# string; optional; the value to set +# +define openstacklib::policy::base ( + $file_path, + $key, + $value = '', +) { + + # Add entry if it doesn't exists + augeas { "${file_path}-${key}-${value}-add": + lens => 'Json.lns', + incl => $file_path, + changes => [ + "set dict/entry[last()+1] \"${key}\"", + "set dict/entry[last()]/string \"${value}\"", + ], + onlyif => "match dict/entry[*][.=\"${key}\"] size == 0", + } + + # Requires that the entry is added before this call or it will fail. + augeas { "${file_path}-${key}-${value}" : + lens => 'Json.lns', + incl => $file_path, + changes => "set dict/entry[*][.=\"${key}\"]/string \"${value}\"", + require => Augeas["${file_path}-${key}-${value}-add"], + } + +} + diff --git a/deployment_scripts/puppet/modules/openstacklib/manifests/policyrcd.pp b/deployment_scripts/puppet/modules/openstacklib/manifests/policyrcd.pp new file mode 100644 index 0000000..5832992 --- /dev/null +++ b/deployment_scripts/puppet/modules/openstacklib/manifests/policyrcd.pp @@ -0,0 +1,43 @@ +# +# Copyright (C) 2016 Matthew J. Black +# +# Author: Matthew J. Black +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +# == Class: openstacklib::policyrcd +# +# [*services*] +# (required) The services that should be in the policy-rc.d shell script +# that should not autostart on install. +# +class openstacklib::policyrcd( + $services +) { + + validate_array($services) + + if $::osfamily == 'Debian' { + # We put this out there so openstack services wont auto start + # when installed. + file { '/usr/sbin/policy-rc.d': + ensure => present, + content => template('openstacklib/policy-rc.d.erb'), + mode => '0755', + owner => root, + group => root, + } + + File['/usr/sbin/policy-rc.d'] -> Package<| tag == 'openstack' |> + } +} diff --git a/deployment_scripts/puppet/modules/openstacklib/manifests/service_validation.pp b/deployment_scripts/puppet/modules/openstacklib/manifests/service_validation.pp new file mode 100644 index 0000000..4528a45 --- /dev/null +++ b/deployment_scripts/puppet/modules/openstacklib/manifests/service_validation.pp @@ -0,0 +1,99 @@ +# +# Copyright (C) 2014 eNovance SAS +# +# Author: Emilien Macchi +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +# == Definition: openstacklib::service_validation +# +# This resource does service validation for an OpenStack service. +# +# == Parameters: +# +# [*command*] +# Command to run for validating the service; +# string; required +# +# [*service_name*] +# The name of the service to validate; +# string; optional; default to the $title of the resource, i.e. 'nova-api' +# +# [*path*] +# The path of the command to validate the service; +# string; optional; default to '/usr/bin:/bin:/usr/sbin:/sbin' +# +# [*provider*] +# The provider to use for the exec command; +# string; optional; default to 'shell' +# +# [*refreshonly*] +# If the service validation should only occur on a refresh/notification; +# boolean; optional; default to false +# +# [*timeout*] +# The maximum time the command should take; +# string; optional; default to '60' +# +# [*tries*] +# Number of times to retry validation; +# string; optional; default to '10' +# +# [*try_sleep*] +# Number of seconds between validation attempts; +# string; optional; default to '2' +# +# [*onlyif*] +# Run the exec if all conditions in the array return true. +# string or array; optional; default to 'undef' +# +# [*unless*] +# Run the exec if all conditions in the array return false. +# string or array; optional; default to 'undef' +# +define openstacklib::service_validation( + $command, + $service_name = $name, + $path = '/usr/bin:/bin:/usr/sbin:/sbin', + $provider = shell, + $refreshonly = false, + $timeout = '60', + $tries = '10', + $try_sleep = '2', + $onlyif = undef, + $unless = undef, +) { + + if $onlyif and $unless { + fail ('Only one parameter should be declared: onlyif or unless') + } + + exec { "execute ${service_name} validation": + command => $command, + path => $path, + provider => $provider, + refreshonly => $refreshonly, + timeout => $timeout, + tries => $tries, + try_sleep => $try_sleep, + onlyif => $onlyif, + unless => $unless, + logoutput => 'on_failure', + } + + anchor { "create ${service_name} anchor": + require => Exec["execute ${service_name} validation"], + } + +} + diff --git a/deployment_scripts/puppet/modules/openstacklib/manifests/wsgi/apache.pp b/deployment_scripts/puppet/modules/openstacklib/manifests/wsgi/apache.pp new file mode 100644 index 0000000..bceb0a9 --- /dev/null +++ b/deployment_scripts/puppet/modules/openstacklib/manifests/wsgi/apache.pp @@ -0,0 +1,248 @@ +# +# Copyright (C) 2014 eNovance SAS +# +# Author: Emilien Macchi +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +# == Class: openstacklib::wsgi::apache +# +# Serve a service with apache mod_wsgi +# When using this class you should disable your service. +# +# == Parameters +# +# [*service_name*] +# (optional) Name of the service to run. +# Example: nova-api +# Defaults to $name +# +# [*servername*] +# (optional) The servername for the virtualhost. +# Defaults to $::fqdn +# +# [*bind_host*] +# (optional) The host/ip address Apache will listen on. +# Defaults to undef (listen on all ip addresses). +# +# [*bind_port*] +# (optional) The port to listen. +# Defaults to undef +# +# [*group*] +# (optional) Group with permissions on the script +# Defaults to undef +# +# [*path*] +# (optional) The prefix for the endpoint. +# Defaults to '/' +# +# [*priority*] +# (optional) The priority for the vhost. +# Defaults to '10' +# +# [*ssl*] +# (optional) Use ssl ? (boolean) +# Defaults to false +# +# [*ssl_cert*] +# (optional) Path to SSL certificate +# Default to apache::vhost 'ssl_*' defaults. +# +# [*ssl_key*] +# (optional) Path to SSL key +# Default to apache::vhost 'ssl_*' defaults. +# +# [*ssl_chain*] +# (optional) SSL chain +# Default to apache::vhost 'ssl_*' defaults. +# +# [*ssl_ca*] +# (optional) Path to SSL certificate authority +# Default to apache::vhost 'ssl_*' defaults. +# +# [*ssl_crl_path*] +# (optional) Path to SSL certificate revocation list +# Default to apache::vhost 'ssl_*' defaults. +# +# [*ssl_crl*] +# (optional) SSL certificate revocation list name +# Default to apache::vhost 'ssl_*' defaults. +# +# [*ssl_certs_dir*] +# (optional) Path to SSL certificate directory +# Default to apache::vhost 'ssl_*' defaults. +# +# [*threads*] +# (optional) The number of threads for the vhost. +# Defaults to $::os_workers +# +# [*user*] +# (optional) User with permissions on the script +# Defaults to undef +# +# [*workers*] +# (optional) The number of workers for the vhost. +# Defaults to '1' +# +# [*wsgi_daemon_process*] +# (optional) Name of the WSGI daemon process. +# Defaults to $name +# +# [*wsgi_process_display_name*] +# (optional) Name of the WSGI process display-name. +# Defaults to $name +# +# [*wsgi_process_group*] +# (optional) Name of the WSGI process group. +# Defaults to $name +# +# [*wsgi_script_dir*] +# (optional) The directory path of the WSGI script. +# Defaults to undef +# +# [*wsgi_script_file*] +# (optional) The file path of the WSGI script. +# Defaults to undef +# +# [*wsgi_script_source*] +# (optional) The source of the WSGI script. +# Defaults to undef +# +# [*wsgi_application_group*] +# (optional) The application group of the WSGI script. +# Defaults to '%{GLOBAL}' +# +# [*wsgi_pass_authorization*] +# (optional) Whether HTTP authorisation headers are passed through to a WSGI +# script when the equivalent HTTP request headers are present. +# Defaults to undef +# +# [*wsgi_chunked_request*] +# (optional) Makes the vhost allow chunked requests which is useful for +# handling TE (Transfer-Encoding), chunked or gzip. This sets the +# WSGIChunkedRequest option in the vhost. +# Defaults to undef +# +# [*vhost_custom_fragment*] +# (optional) Passes a string of custom configuration +# directives to be placed at the end of the vhost configuration. +# Defaults to undef. +# +# [*allow_encoded_slashes*] +# (optional) If set, uses apache's AllowEncodedSlashes option in the vhost. +# This option is passed to puppetlabs-apache, which accepts only 4 +# options: undef, "on", "off" or "nodecode". This is thus validated in the +# underlying vhost resource. +# Defaults to undef. +# +define openstacklib::wsgi::apache ( + $service_name = $name, + $bind_host = undef, + $bind_port = undef, + $group = undef, + $path = '/', + $priority = '10', + $servername = $::fqdn, + $ssl = false, + $ssl_ca = undef, + $ssl_cert = undef, + $ssl_certs_dir = undef, + $ssl_chain = undef, + $ssl_crl = undef, + $ssl_crl_path = undef, + $ssl_key = undef, + $threads = $::os_workers, + $user = undef, + $workers = 1, + $wsgi_daemon_process = $name, + $wsgi_process_display_name = $name, + $wsgi_process_group = $name, + $wsgi_script_dir = undef, + $wsgi_script_file = undef, + $wsgi_script_source = undef, + $wsgi_application_group = '%{GLOBAL}', + $wsgi_pass_authorization = undef, + $wsgi_chunked_request = undef, + $vhost_custom_fragment = undef, + $allow_encoded_slashes = undef, +) { + + include ::apache + include ::apache::mod::wsgi + if $ssl { + include ::apache::mod::ssl + } + + # Ensure there's no trailing '/' except if this is also the only character + $path_real = regsubst($path, '(^/.*)/$', '\1') + + if !defined(File[$wsgi_script_dir]) { + file { $wsgi_script_dir: + ensure => directory, + owner => $user, + group => $group, + require => Package['httpd'], + } + } + + file { $service_name: + ensure => file, + path => "${wsgi_script_dir}/${wsgi_script_file}", + source => $wsgi_script_source, + owner => $user, + group => $group, + mode => '0644', + require => File[$wsgi_script_dir], + } + + $wsgi_daemon_process_options = { + user => $user, + group => $group, + processes => $workers, + threads => $threads, + display-name => $wsgi_process_display_name, + } + $wsgi_script_aliases = hash([$path_real,"${wsgi_script_dir}/${wsgi_script_file}"]) + + ::apache::vhost { $service_name: + ensure => 'present', + servername => $servername, + ip => $bind_host, + port => $bind_port, + docroot => $wsgi_script_dir, + docroot_owner => $user, + docroot_group => $group, + priority => $priority, + setenvif => ['X-Forwarded-Proto https HTTPS=1'], + ssl => $ssl, + ssl_cert => $ssl_cert, + ssl_key => $ssl_key, + ssl_chain => $ssl_chain, + ssl_ca => $ssl_ca, + ssl_crl_path => $ssl_crl_path, + ssl_crl => $ssl_crl, + ssl_certs_dir => $ssl_certs_dir, + wsgi_daemon_process => $wsgi_daemon_process, + wsgi_daemon_process_options => $wsgi_daemon_process_options, + wsgi_process_group => $wsgi_process_group, + wsgi_script_aliases => $wsgi_script_aliases, + wsgi_application_group => $wsgi_application_group, + wsgi_pass_authorization => $wsgi_pass_authorization, + wsgi_chunked_request => $wsgi_chunked_request, + custom_fragment => $vhost_custom_fragment, + allow_encoded_slashes => $allow_encoded_slashes, + require => File[$service_name], + } + +} diff --git a/deployment_scripts/puppet/modules/openstacklib/metadata.json b/deployment_scripts/puppet/modules/openstacklib/metadata.json new file mode 100644 index 0000000..d574fce --- /dev/null +++ b/deployment_scripts/puppet/modules/openstacklib/metadata.json @@ -0,0 +1,73 @@ +{ + "author": "Puppet Labs and OpenStack Contributors", + "dependencies": [ + { + "name": "puppetlabs/apache", + "version_requirement": ">=1.0.0 <2.0.0" + }, + { + "name": "puppetlabs/inifile", + "version_requirement": ">=1.0.0 <2.0.0" + }, + { + "name": "puppetlabs/mysql", + "version_requirement": ">=3.10.0 <4.0.0" + }, + { + "name": "puppetlabs/stdlib", + "version_requirement": ">=4.0.0 <5.0.0" + }, + { + "name": "puppetlabs/rabbitmq", + "version_requirement": ">=2.0.2 <6.0.0" + }, + { + "name": "puppetlabs/postgresql", + "version_requirement": ">=3.3.0 <5.0.0" + } + ], + "description": "Puppet module library to expose common functionality between OpenStack modules.", + "issues_url": "https://bugs.launchpad.net/puppet-openstacklib", + "license": "Apache-2.0", + "name": "openstack-openstacklib", + "operatingsystem_support": [ + { + "operatingsystem": "Debian", + "operatingsystemrelease": [ + "8" + ] + }, + { + "operatingsystem": "Fedora", + "operatingsystemrelease": [ + "24" + ] + }, + { + "operatingsystem": "RedHat", + "operatingsystemrelease": [ + "7" + ] + }, + { + "operatingsystem": "Ubuntu", + "operatingsystemrelease": [ + "16.04" + ] + } + ], + "project_page": "https://launchpad.net/puppet-openstacklib", + "requirements": [ + { + "name": "pe", + "version_requirement": "4.x" + }, + { + "name": "puppet", + "version_requirement": "4.x" + } + ], + "source": "git://github.com/openstack/puppet-openstacklib.git", + "summary": "Puppet OpenStack Libraries", + "version": "11.0.0" +} \ No newline at end of file diff --git a/deployment_scripts/puppet/modules/openstacklib/releasenotes/notes/Add-TLS-options-for-mysql-user-creation-172536d7f3963ce2.yaml b/deployment_scripts/puppet/modules/openstacklib/releasenotes/notes/Add-TLS-options-for-mysql-user-creation-172536d7f3963ce2.yaml new file mode 100644 index 0000000..dd11777 --- /dev/null +++ b/deployment_scripts/puppet/modules/openstacklib/releasenotes/notes/Add-TLS-options-for-mysql-user-creation-172536d7f3963ce2.yaml @@ -0,0 +1,6 @@ +--- +features: + - For the users that result from the usage of the mysql resource, it is now + possible to specify the TLS options. This is useful if one wants to force + the user to only connect using TLS, or if one wants to force the usage of + client certificates for this specific user. diff --git a/deployment_scripts/puppet/modules/openstacklib/releasenotes/notes/bugfix-1664561-f5964a3777b9ed93.yaml b/deployment_scripts/puppet/modules/openstacklib/releasenotes/notes/bugfix-1664561-f5964a3777b9ed93.yaml new file mode 100644 index 0000000..018015a --- /dev/null +++ b/deployment_scripts/puppet/modules/openstacklib/releasenotes/notes/bugfix-1664561-f5964a3777b9ed93.yaml @@ -0,0 +1,4 @@ +--- +fixes: + - Bugfix 1664561. Allow to use Integers and Strings + for the port parameter. diff --git a/deployment_scripts/puppet/modules/openstacklib/releasenotes/notes/catch_403-237b79f33ab3364f.yaml b/deployment_scripts/puppet/modules/openstacklib/releasenotes/notes/catch_403-237b79f33ab3364f.yaml new file mode 100644 index 0000000..decb18b --- /dev/null +++ b/deployment_scripts/puppet/modules/openstacklib/releasenotes/notes/catch_403-237b79f33ab3364f.yaml @@ -0,0 +1,3 @@ +--- +fixes: + - Catch HTTP 403 responses (not authorized requests) in openstack provider. diff --git a/deployment_scripts/puppet/modules/openstacklib/releasenotes/notes/feature_add_default_config_placeholder-280f69c0edbf76c6.yaml b/deployment_scripts/puppet/modules/openstacklib/releasenotes/notes/feature_add_default_config_placeholder-280f69c0edbf76c6.yaml new file mode 100644 index 0000000..ce4e2aa --- /dev/null +++ b/deployment_scripts/puppet/modules/openstacklib/releasenotes/notes/feature_add_default_config_placeholder-280f69c0edbf76c6.yaml @@ -0,0 +1,12 @@ +--- +features: + - Add a manifest which is loaded by all puppet modules in + manifests/param.pp. This is described in + `bug 1599113 + `__ + +fixes: + - The first feature would help fixing RDO package using virtual + package which is a recurring problem. Example of such problem is + `bug 1599113 + `__ diff --git a/deployment_scripts/puppet/modules/openstacklib/releasenotes/notes/feature_add_exclusion_to_retry_mechanism-2acb52fa25bd315c.yaml b/deployment_scripts/puppet/modules/openstacklib/releasenotes/notes/feature_add_exclusion_to_retry_mechanism-2acb52fa25bd315c.yaml new file mode 100644 index 0000000..81b1d1b --- /dev/null +++ b/deployment_scripts/puppet/modules/openstacklib/releasenotes/notes/feature_add_exclusion_to_retry_mechanism-2acb52fa25bd315c.yaml @@ -0,0 +1,5 @@ +--- +features: + - Add the possibility to exclude some exception from retry + mechanism. It helps to fix `bug 1597357 + `__ diff --git a/deployment_scripts/puppet/modules/openstacklib/releasenotes/notes/feature_add_transform_for_config.yaml b/deployment_scripts/puppet/modules/openstacklib/releasenotes/notes/feature_add_transform_for_config.yaml new file mode 100644 index 0000000..844023a --- /dev/null +++ b/deployment_scripts/puppet/modules/openstacklib/releasenotes/notes/feature_add_transform_for_config.yaml @@ -0,0 +1,5 @@ +--- +features: + - Add the ability to transform values in config files. This allows + operators to configure input directly at assignment by specifying + a 'transform_to' attribute. diff --git a/deployment_scripts/puppet/modules/openstacklib/releasenotes/notes/ipv6_array_support-ea28cf0939e820f6.yaml b/deployment_scripts/puppet/modules/openstacklib/releasenotes/notes/ipv6_array_support-ea28cf0939e820f6.yaml new file mode 100644 index 0000000..f3e663c --- /dev/null +++ b/deployment_scripts/puppet/modules/openstacklib/releasenotes/notes/ipv6_array_support-ea28cf0939e820f6.yaml @@ -0,0 +1,4 @@ +--- +features: + - Allow to give an array of IP addresses to normalize_ip_for_uri and normalize + each IP in the list. diff --git a/deployment_scripts/puppet/modules/openstacklib/releasenotes/notes/ipv6_brackets-7a453aea5e091855.yaml b/deployment_scripts/puppet/modules/openstacklib/releasenotes/notes/ipv6_brackets-7a453aea5e091855.yaml new file mode 100644 index 0000000..6e315ce --- /dev/null +++ b/deployment_scripts/puppet/modules/openstacklib/releasenotes/notes/ipv6_brackets-7a453aea5e091855.yaml @@ -0,0 +1,6 @@ +--- +features: + - Utility to handle IPv6 address brackets with normalize_ip_for_uri + is a function that help us to add brackets to IPv6 addresses + when missing. The function moved to puppetlabs-stdlib but is not in latest release + yet. Once it's done, we'll probably drop this function so our modules will use stdlib. diff --git a/deployment_scripts/puppet/modules/openstacklib/releasenotes/notes/manage_policy_rc_d_file-747510db06792d52.yaml b/deployment_scripts/puppet/modules/openstacklib/releasenotes/notes/manage_policy_rc_d_file-747510db06792d52.yaml new file mode 100644 index 0000000..9db31c7 --- /dev/null +++ b/deployment_scripts/puppet/modules/openstacklib/releasenotes/notes/manage_policy_rc_d_file-747510db06792d52.yaml @@ -0,0 +1,11 @@ +--- +features: + - Add a class that takes an array of services that can be + configured to not autostart on package install. The most + notable example is keystone. The policy-rc.d file is + generated to return the correct exit code to prevent the + services from autostarting on package install. This change + is only meant for debian based systems. +issues: + - ubuntu cloud archive keystone package is auto-starting the + eventlet process on package install. diff --git a/deployment_scripts/puppet/modules/openstacklib/releasenotes/notes/more_db_options-d96316ae4eb5a78c.yaml b/deployment_scripts/puppet/modules/openstacklib/releasenotes/notes/more_db_options-d96316ae4eb5a78c.yaml new file mode 100644 index 0000000..3655c26 --- /dev/null +++ b/deployment_scripts/puppet/modules/openstacklib/releasenotes/notes/more_db_options-d96316ae4eb5a78c.yaml @@ -0,0 +1,4 @@ +--- +features: + - Add an "extra" hash parameter to os_database_connection that allows to extend + the database uri configuration. diff --git a/deployment_scripts/puppet/modules/openstacklib/releasenotes/notes/mysql-user-and-grants-optional-fd34f4686d44aec3.yaml b/deployment_scripts/puppet/modules/openstacklib/releasenotes/notes/mysql-user-and-grants-optional-fd34f4686d44aec3.yaml new file mode 100644 index 0000000..3686f8b --- /dev/null +++ b/deployment_scripts/puppet/modules/openstacklib/releasenotes/notes/mysql-user-and-grants-optional-fd34f4686d44aec3.yaml @@ -0,0 +1,9 @@ +--- +features: + - Add the ability to skip the mysql user and/or grant creation as part of the + openstack::db::mysql resource. +fixes: + - openstack::db::mysql could not be used to create multiple databases + with the same user/password for access due to a duplicate mysql_user + resource declaration. Now the user and/or grant creation process can be + skipped if they already exist. diff --git a/deployment_scripts/puppet/modules/openstacklib/releasenotes/notes/os_transport-alt-transport-7cd300380ece2fc9.yaml b/deployment_scripts/puppet/modules/openstacklib/releasenotes/notes/os_transport-alt-transport-7cd300380ece2fc9.yaml new file mode 100644 index 0000000..94ef534 --- /dev/null +++ b/deployment_scripts/puppet/modules/openstacklib/releasenotes/notes/os_transport-alt-transport-7cd300380ece2fc9.yaml @@ -0,0 +1,4 @@ +--- +fixes: + - bug 1651215 The transport parameter was not being used so + transport was fixed value 'rabbit' diff --git a/deployment_scripts/puppet/modules/openstacklib/releasenotes/notes/os_transport_url-b6fe15a8f21d387b.yaml b/deployment_scripts/puppet/modules/openstacklib/releasenotes/notes/os_transport_url-b6fe15a8f21d387b.yaml new file mode 100644 index 0000000..5b4f7f3 --- /dev/null +++ b/deployment_scripts/puppet/modules/openstacklib/releasenotes/notes/os_transport_url-b6fe15a8f21d387b.yaml @@ -0,0 +1,4 @@ +--- +features: + - os_transport_url puppet parser function can be used to generate valid + transport_url URIs from a hash of connection parameters. diff --git a/deployment_scripts/puppet/modules/openstacklib/releasenotes/notes/os_workers-fact-0ce731f0536c2792.yaml b/deployment_scripts/puppet/modules/openstacklib/releasenotes/notes/os_workers-fact-0ce731f0536c2792.yaml new file mode 100644 index 0000000..0335c74 --- /dev/null +++ b/deployment_scripts/puppet/modules/openstacklib/releasenotes/notes/os_workers-fact-0ce731f0536c2792.yaml @@ -0,0 +1,12 @@ +--- +features: + - Moved existing $::os_workers to $::os_workers_small + - Updated $::os_workers to have a value between '2' and '12'. + The value of this fact is the larger value between '2' + and the number of processors divided by '2' but will not + exceed '12'. + - Created fact $::os_workers_large to have a value of number + of processors divided by '2' +fixes: + - bug 1650424 The current calculation for os_workers negatively + impacts api response times diff --git a/deployment_scripts/puppet/modules/openstacklib/releasenotes/notes/os_workers-fact-420e6ad783cba982.yaml b/deployment_scripts/puppet/modules/openstacklib/releasenotes/notes/os_workers-fact-420e6ad783cba982.yaml new file mode 100644 index 0000000..c920077 --- /dev/null +++ b/deployment_scripts/puppet/modules/openstacklib/releasenotes/notes/os_workers-fact-420e6ad783cba982.yaml @@ -0,0 +1,6 @@ +--- +features: + - Created a new fact called $::os_workers to be used as the defaults for any + of the openstack service worker configurations. This fact will have a value + between '2' and '8'. The value of this fact is the larger value between '2' + and the number of processors divided by '4' but will not exceed '8'. diff --git a/deployment_scripts/puppet/modules/openstacklib/releasenotes/notes/os_workers_for_worker_count-34eb55ddf55f4a11.yaml b/deployment_scripts/puppet/modules/openstacklib/releasenotes/notes/os_workers_for_worker_count-34eb55ddf55f4a11.yaml new file mode 100644 index 0000000..5616f0d --- /dev/null +++ b/deployment_scripts/puppet/modules/openstacklib/releasenotes/notes/os_workers_for_worker_count-34eb55ddf55f4a11.yaml @@ -0,0 +1,5 @@ +--- +other: + - Parameters that control the number of spawned child processes for + distributing processing have had their default value changed from + ::processorcount to ::os_workers. diff --git a/deployment_scripts/puppet/modules/openstacklib/releasenotes/notes/policy_rcd_provider-1ef3d203b9af1110.yaml b/deployment_scripts/puppet/modules/openstacklib/releasenotes/notes/policy_rcd_provider-1ef3d203b9af1110.yaml new file mode 100644 index 0000000..2f1fc52 --- /dev/null +++ b/deployment_scripts/puppet/modules/openstacklib/releasenotes/notes/policy_rcd_provider-1ef3d203b9af1110.yaml @@ -0,0 +1,3 @@ +--- +features: + - Added policy_rcd provider for managing policy-rc.d for Debian family. diff --git a/deployment_scripts/puppet/modules/openstacklib/releasenotes/notes/retry_client-b8a0e1f9ff679281.yaml b/deployment_scripts/puppet/modules/openstacklib/releasenotes/notes/retry_client-b8a0e1f9ff679281.yaml new file mode 100644 index 0000000..df9b85e --- /dev/null +++ b/deployment_scripts/puppet/modules/openstacklib/releasenotes/notes/retry_client-b8a0e1f9ff679281.yaml @@ -0,0 +1,7 @@ +--- +fixes: + - Add retries to the openstack command. + Increase command timeout to 20s and request timeout to 60s + and sleep 3s between retries. Do not retry non-idempotent actions. + This is a more robust implementation that will prevent failures in case + of Keystone API failures during a deployment. diff --git a/deployment_scripts/puppet/modules/openstacklib/releasenotes/notes/support_region_name_in_providers-cde6d75f0ddbec28.yaml b/deployment_scripts/puppet/modules/openstacklib/releasenotes/notes/support_region_name_in_providers-cde6d75f0ddbec28.yaml new file mode 100644 index 0000000..7370d3b --- /dev/null +++ b/deployment_scripts/puppet/modules/openstacklib/releasenotes/notes/support_region_name_in_providers-cde6d75f0ddbec28.yaml @@ -0,0 +1,4 @@ +--- +fixes: + - Add support for multiple regions in base provider code used by other puppet + modules. diff --git a/deployment_scripts/puppet/modules/openstacklib/releasenotes/notes/use-reno-1caaec4ba5aa4285.yaml b/deployment_scripts/puppet/modules/openstacklib/releasenotes/notes/use-reno-1caaec4ba5aa4285.yaml new file mode 100644 index 0000000..41cef2f --- /dev/null +++ b/deployment_scripts/puppet/modules/openstacklib/releasenotes/notes/use-reno-1caaec4ba5aa4285.yaml @@ -0,0 +1,4 @@ +--- +features: + - Release notes are no longer maintained by hand, we now use the reno tool to + manage them. diff --git a/deployment_scripts/puppet/modules/openstacklib/releasenotes/source/_static/.placeholder b/deployment_scripts/puppet/modules/openstacklib/releasenotes/source/_static/.placeholder new file mode 100644 index 0000000..e69de29 diff --git a/deployment_scripts/puppet/modules/openstacklib/releasenotes/source/conf.py b/deployment_scripts/puppet/modules/openstacklib/releasenotes/source/conf.py new file mode 100644 index 0000000..33fadb2 --- /dev/null +++ b/deployment_scripts/puppet/modules/openstacklib/releasenotes/source/conf.py @@ -0,0 +1,262 @@ +# -*- coding: utf-8 -*- +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# If extensions (or modules to document with autodoc) are in another directory, +# add these directories to sys.path here. If the directory is relative to the +# documentation root, use os.path.abspath to make it absolute, like shown here. +#sys.path.insert(0, os.path.abspath('.')) + +# -- General configuration ------------------------------------------------ + +# If your documentation needs a minimal Sphinx version, state it here. +#needs_sphinx = '1.0' + +# Add any Sphinx extension module names here, as strings. They can be +# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom +# ones. +extensions = [ + 'oslosphinx', + 'reno.sphinxext', +] + +# Add any paths that contain templates here, relative to this directory. +templates_path = ['_templates'] + +# The suffix of source filenames. +source_suffix = '.rst' + +# The encoding of source files. +#source_encoding = 'utf-8-sig' + +# The master toctree document. +master_doc = 'index' + +# General information about the project. +project = u'puppet-openstacklib Release Notes' +copyright = u'2017, Puppet OpenStack Developers' + +# The version info for the project you're documenting, acts as replacement for +# |version| and |release|, also used in various other places throughout the +# built documents. +# +# The short X.Y version. +version = '11.0.0' +# The full version, including alpha/beta/rc tags. +release = '11.0.0' + +# The language for content autogenerated by Sphinx. Refer to documentation +# for a list of supported languages. +#language = None + +# There are two options for replacing |today|: either, you set today to some +# non-false value, then it is used: +#today = '' +# Else, today_fmt is used as the format for a strftime call. +#today_fmt = '%B %d, %Y' + +# List of patterns, relative to source directory, that match files and +# directories to ignore when looking for source files. +exclude_patterns = [] + +# The reST default role (used for this markup: `text`) to use for all +# documents. +#default_role = None + +# If true, '()' will be appended to :func: etc. cross-reference text. +#add_function_parentheses = True + +# If true, the current module name will be prepended to all description +# unit titles (such as .. function::). +#add_module_names = True + +# If true, sectionauthor and moduleauthor directives will be shown in the +# output. They are ignored by default. +#show_authors = False + +# The name of the Pygments (syntax highlighting) style to use. +pygments_style = 'sphinx' + +# A list of ignored prefixes for module index sorting. +#modindex_common_prefix = [] + +# If true, keep warnings as "system message" paragraphs in the built documents. +#keep_warnings = False + + +# -- Options for HTML output ---------------------------------------------- + +# The theme to use for HTML and HTML Help pages. See the documentation for +# a list of builtin themes. +html_theme = 'default' + +# Theme options are theme-specific and customize the look and feel of a theme +# further. For a list of options available for each theme, see the +# documentation. +#html_theme_options = {} + +# Add any paths that contain custom themes here, relative to this directory. +#html_theme_path = [] + +# The name for this set of Sphinx documents. If None, it defaults to +# " v documentation". +#html_title = None + +# A shorter title for the navigation bar. Default is the same as html_title. +#html_short_title = None + +# The name of an image file (relative to this directory) to place at the top +# of the sidebar. +#html_logo = None + +# The name of an image file (within the static path) to use as favicon of the +# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 +# pixels large. +#html_favicon = None + +# Add any paths that contain custom static files (such as style sheets) here, +# relative to this directory. They are copied after the builtin static files, +# so a file named "default.css" will overwrite the builtin "default.css". +html_static_path = ['_static'] + +# Add any extra paths that contain custom files (such as robots.txt or +# .htaccess) here, relative to this directory. These files are copied +# directly to the root of the documentation. +#html_extra_path = [] + +# If not '', a 'Last updated on:' timestamp is inserted at every page bottom, +# using the given strftime format. +#html_last_updated_fmt = '%b %d, %Y' + +# If true, SmartyPants will be used to convert quotes and dashes to +# typographically correct entities. +#html_use_smartypants = True + +# Custom sidebar templates, maps document names to template names. +#html_sidebars = {} + +# Additional templates that should be rendered to pages, maps page names to +# template names. +#html_additional_pages = {} + +# If false, no module index is generated. +#html_domain_indices = True + +# If false, no index is generated. +#html_use_index = True + +# If true, the index is split into individual pages for each letter. +#html_split_index = False + +# If true, links to the reST sources are added to the pages. +#html_show_sourcelink = True + +# If true, "Created using Sphinx" is shown in the HTML footer. Default is True. +#html_show_sphinx = True + +# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. +#html_show_copyright = True + +# If true, an OpenSearch description file will be output, and all pages will +# contain a tag referring to it. The value of this option must be the +# base URL from which the finished HTML is served. +#html_use_opensearch = '' + +# This is the file name suffix for HTML files (e.g. ".xhtml"). +#html_file_suffix = None + +# Output file base name for HTML help builder. +htmlhelp_basename = 'puppet-openstacklibReleaseNotesdoc' + + +# -- Options for LaTeX output --------------------------------------------- + +latex_elements = { +# The paper size ('letterpaper' or 'a4paper'). +#'papersize': 'letterpaper', + +# The font size ('10pt', '11pt' or '12pt'). +#'pointsize': '10pt', + +# Additional stuff for the LaTeX preamble. +#'preamble': '', +} + +# Grouping the document tree into LaTeX files. List of tuples +# (source start file, target name, title, +# author, documentclass [howto, manual, or own class]). +latex_documents = [ + ('index', 'puppet-openstacklibReleaseNotes.tex', u'puppet-openstacklib Release Notes Documentation', + u'2017, Puppet OpenStack Developers', 'manual'), +] + +# The name of an image file (relative to this directory) to place at the top of +# the title page. +#latex_logo = None + +# For "manual" documents, if this is true, then toplevel headings are parts, +# not chapters. +#latex_use_parts = False + +# If true, show page references after internal links. +#latex_show_pagerefs = False + +# If true, show URL addresses after external links. +#latex_show_urls = False + +# Documents to append as an appendix to all manuals. +#latex_appendices = [] + +# If false, no module index is generated. +#latex_domain_indices = True + + +# -- Options for manual page output --------------------------------------- + +# One entry per manual page. List of tuples +# (source start file, name, description, authors, manual section). +man_pages = [ + ('index', 'puppet-openstacklibreleasenotes', u'puppet-openstacklib Release Notes Documentation', + [u'2017, Puppet OpenStack Developers'], 1) +] + +# If true, show URL addresses after external links. +#man_show_urls = False + + +# -- Options for Texinfo output ------------------------------------------- + +# Grouping the document tree into Texinfo files. List of tuples +# (source start file, target name, title, author, +# dir menu entry, description, category) +texinfo_documents = [ + ('index', 'puppet-openstacklibReleaseNotes', u'puppet-openstacklib Release Notes Documentation', + u'2017, Puppet OpenStack Developers', 'puppet-openstacklibReleaseNotes', 'One line description of project.', + 'Miscellaneous'), +] + +# Documents to append as an appendix to all manuals. +#texinfo_appendices = [] + +# If false, no module index is generated. +#texinfo_domain_indices = True + +# How to display URL addresses: 'footnote', 'no', or 'inline'. +#texinfo_show_urls = 'footnote' + +# If true, do not generate a @detailmenu in the "Top" node's menu. +#texinfo_no_detailmenu = False + +# -- Options for Internationalization output ------------------------------ +locale_dirs = ['locale/'] diff --git a/deployment_scripts/puppet/modules/openstacklib/releasenotes/source/index.rst b/deployment_scripts/puppet/modules/openstacklib/releasenotes/source/index.rst new file mode 100644 index 0000000..d99dceb --- /dev/null +++ b/deployment_scripts/puppet/modules/openstacklib/releasenotes/source/index.rst @@ -0,0 +1,21 @@ +============================================= +Welcome to puppet-openstacklib Release Notes! +============================================= + +Contents +======== + +.. toctree:: + :maxdepth: 2 + + unreleased + ocata + newton + mitaka + + +Indices and tables +================== + +* :ref:`genindex` +* :ref:`search` diff --git a/deployment_scripts/puppet/modules/openstacklib/releasenotes/source/mitaka.rst b/deployment_scripts/puppet/modules/openstacklib/releasenotes/source/mitaka.rst new file mode 100644 index 0000000..97ab8d1 --- /dev/null +++ b/deployment_scripts/puppet/modules/openstacklib/releasenotes/source/mitaka.rst @@ -0,0 +1,6 @@ +============================ + Mitaka Series Release Notes +============================ + +.. release-notes:: + :branch: origin/stable/mitaka diff --git a/deployment_scripts/puppet/modules/openstacklib/releasenotes/source/newton.rst b/deployment_scripts/puppet/modules/openstacklib/releasenotes/source/newton.rst new file mode 100644 index 0000000..97036ed --- /dev/null +++ b/deployment_scripts/puppet/modules/openstacklib/releasenotes/source/newton.rst @@ -0,0 +1,6 @@ +=================================== + Newton Series Release Notes +=================================== + +.. release-notes:: + :branch: origin/stable/newton diff --git a/deployment_scripts/puppet/modules/openstacklib/releasenotes/source/ocata.rst b/deployment_scripts/puppet/modules/openstacklib/releasenotes/source/ocata.rst new file mode 100644 index 0000000..ebe62f4 --- /dev/null +++ b/deployment_scripts/puppet/modules/openstacklib/releasenotes/source/ocata.rst @@ -0,0 +1,6 @@ +=================================== + Ocata Series Release Notes +=================================== + +.. release-notes:: + :branch: origin/stable/ocata diff --git a/deployment_scripts/puppet/modules/openstacklib/releasenotes/source/unreleased.rst b/deployment_scripts/puppet/modules/openstacklib/releasenotes/source/unreleased.rst new file mode 100644 index 0000000..2334dd5 --- /dev/null +++ b/deployment_scripts/puppet/modules/openstacklib/releasenotes/source/unreleased.rst @@ -0,0 +1,5 @@ +============================== + Current Series Release Notes +============================== + + .. release-notes:: diff --git a/deployment_scripts/puppet/modules/openstacklib/setup.cfg b/deployment_scripts/puppet/modules/openstacklib/setup.cfg new file mode 100644 index 0000000..59bdb4b --- /dev/null +++ b/deployment_scripts/puppet/modules/openstacklib/setup.cfg @@ -0,0 +1,13 @@ +[metadata] +name = puppet-openstacklib +summary = Puppet module for OpenStack Openstacklib +description-file = + README.md +author = Puppet Labs and OpenStack Contributors +author-email = openstack-dev@lists.openstack.org +home-page = http://docs.openstack.org/developer/puppet-openstack-guide +classifier = + Intended Audience :: Developers + Intended Audience :: System Administrators + License :: OSI Approved :: Apache Software License + Operating System :: POSIX :: Linux diff --git a/deployment_scripts/puppet/modules/openstacklib/setup.py b/deployment_scripts/puppet/modules/openstacklib/setup.py new file mode 100644 index 0000000..70c2b3f --- /dev/null +++ b/deployment_scripts/puppet/modules/openstacklib/setup.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python +# Copyright (c) 2013 Hewlett-Packard Development Company, L.P. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# THIS FILE IS MANAGED BY THE GLOBAL REQUIREMENTS REPO - DO NOT EDIT +import setuptools + +setuptools.setup( + setup_requires=['pbr'], + pbr=True) diff --git a/deployment_scripts/puppet/modules/openstacklib/spec/acceptance/defaults_spec.rb b/deployment_scripts/puppet/modules/openstacklib/spec/acceptance/defaults_spec.rb new file mode 100644 index 0000000..5e08383 --- /dev/null +++ b/deployment_scripts/puppet/modules/openstacklib/spec/acceptance/defaults_spec.rb @@ -0,0 +1,7 @@ +require 'spec_helper_acceptance' + +describe 'Defaults manifest' do + context 'virtual_package' do + it_behaves_like 'puppet_apply_success_from_example', 'virtual_packages' + end +end diff --git a/deployment_scripts/puppet/modules/openstacklib/spec/acceptance/mysql_spec.rb b/deployment_scripts/puppet/modules/openstacklib/spec/acceptance/mysql_spec.rb new file mode 100644 index 0000000..0088971 --- /dev/null +++ b/deployment_scripts/puppet/modules/openstacklib/spec/acceptance/mysql_spec.rb @@ -0,0 +1,35 @@ +require 'spec_helper_acceptance' + +describe 'openstacklib mysql' do + + context 'default parameters' do + + it 'should work with no errors' do + pp= <<-EOS + Exec { logoutput => 'on_failure' } + + class { '::mysql::server': } + + ::openstacklib::db::mysql { 'beaker': + password_hash => mysql_password('keystone'), + allowed_hosts => '127.0.0.1', + } + EOS + + # Run it twice and test for idempotency + apply_manifest(pp, :catch_failures => true) + apply_manifest(pp, :catch_changes => true) + end + + describe port(3306) do + it { is_expected.to be_listening.with('tcp') } + end + + describe 'test database listing' do + it 'should list beaker database' do + expect(shell("mysql -e 'show databases;'|grep -q beaker").exit_code).to be_zero + end + end + + end +end diff --git a/deployment_scripts/puppet/modules/openstacklib/spec/acceptance/nodesets/centos-70-x64.yml b/deployment_scripts/puppet/modules/openstacklib/spec/acceptance/nodesets/centos-70-x64.yml new file mode 100644 index 0000000..5f097e9 --- /dev/null +++ b/deployment_scripts/puppet/modules/openstacklib/spec/acceptance/nodesets/centos-70-x64.yml @@ -0,0 +1,11 @@ +HOSTS: + centos-server-70-x64: + roles: + - master + platform: el-7-x86_64 + box: puppetlabs/centos-7.0-64-nocm + box_url: https://vagrantcloud.com/puppetlabs/centos-7.0-64-nocm + hypervisor: vagrant +CONFIG: + log_level: debug + type: foss diff --git a/deployment_scripts/puppet/modules/openstacklib/spec/acceptance/nodesets/default.yml b/deployment_scripts/puppet/modules/openstacklib/spec/acceptance/nodesets/default.yml new file mode 100644 index 0000000..486b6a3 --- /dev/null +++ b/deployment_scripts/puppet/modules/openstacklib/spec/acceptance/nodesets/default.yml @@ -0,0 +1,10 @@ +HOSTS: + ubuntu-server-14.04-amd64: + roles: + - master + platform: ubuntu-14.04-amd64 + box: puppetlabs/ubuntu-14.04-64-nocm + box_url: https://vagrantcloud.com/puppetlabs/ubuntu-14.04-64-nocm + hypervisor: vagrant +CONFIG: + type: foss diff --git a/deployment_scripts/puppet/modules/openstacklib/spec/acceptance/nodesets/nodepool-centos7.yml b/deployment_scripts/puppet/modules/openstacklib/spec/acceptance/nodesets/nodepool-centos7.yml new file mode 100644 index 0000000..c552874 --- /dev/null +++ b/deployment_scripts/puppet/modules/openstacklib/spec/acceptance/nodesets/nodepool-centos7.yml @@ -0,0 +1,10 @@ +HOSTS: + centos-70-x64: + roles: + - master + platform: el-7-x86_64 + hypervisor: none + ip: 127.0.0.1 +CONFIG: + type: foss + set_env: false diff --git a/deployment_scripts/puppet/modules/openstacklib/spec/acceptance/nodesets/nodepool-trusty.yml b/deployment_scripts/puppet/modules/openstacklib/spec/acceptance/nodesets/nodepool-trusty.yml new file mode 100644 index 0000000..9fc624e --- /dev/null +++ b/deployment_scripts/puppet/modules/openstacklib/spec/acceptance/nodesets/nodepool-trusty.yml @@ -0,0 +1,10 @@ +HOSTS: + ubuntu-14.04-amd64: + roles: + - master + platform: ubuntu-14.04-amd64 + hypervisor: none + ip: 127.0.0.1 +CONFIG: + type: foss + set_env: false diff --git a/deployment_scripts/puppet/modules/openstacklib/spec/acceptance/nodesets/nodepool-xenial.yml b/deployment_scripts/puppet/modules/openstacklib/spec/acceptance/nodesets/nodepool-xenial.yml new file mode 100644 index 0000000..99dd318 --- /dev/null +++ b/deployment_scripts/puppet/modules/openstacklib/spec/acceptance/nodesets/nodepool-xenial.yml @@ -0,0 +1,10 @@ +HOSTS: + ubuntu-16.04-amd64: + roles: + - master + platform: ubuntu-16.04-amd64 + hypervisor: none + ip: 127.0.0.1 +CONFIG: + type: foss + set_env: false diff --git a/deployment_scripts/puppet/modules/openstacklib/spec/acceptance/nodesets/ubuntu-server-1404-x64.yml b/deployment_scripts/puppet/modules/openstacklib/spec/acceptance/nodesets/ubuntu-server-1404-x64.yml new file mode 100644 index 0000000..8001929 --- /dev/null +++ b/deployment_scripts/puppet/modules/openstacklib/spec/acceptance/nodesets/ubuntu-server-1404-x64.yml @@ -0,0 +1,11 @@ +HOSTS: + ubuntu-server-14.04-amd64: + roles: + - master + platform: ubuntu-14.04-amd64 + box: puppetlabs/ubuntu-14.04-64-nocm + box_url: https://vagrantcloud.com/puppetlabs/ubuntu-14.04-64-nocm + hypervisor: vagrant +CONFIG: + log_level: debug + type: foss diff --git a/deployment_scripts/puppet/modules/openstacklib/spec/acceptance/openstacklib_config_provider_spec.rb b/deployment_scripts/puppet/modules/openstacklib/spec/acceptance/openstacklib_config_provider_spec.rb new file mode 100644 index 0000000..fe15eb2 --- /dev/null +++ b/deployment_scripts/puppet/modules/openstacklib/spec/acceptance/openstacklib_config_provider_spec.rb @@ -0,0 +1,57 @@ +require 'spec_helper_acceptance' + +describe 'basic config provider resource' do + + context 'default parameters' do + + it 'should work with no errors' do + pp= <<-EOS + Exec { logoutput => 'on_failure' } + + # We create the file manually here because we only want to test + # the logic of the provider hence installing the whole stack would + # result in some overhead that is already tested in puppet-keystone + File <||> -> Keystone_config <||> + file { '/etc/keystone' : + ensure => directory, + } + file { '/etc/keystone/keystone.conf' : + ensure => file, + } + + keystone_config { 'DEFAULT/thisshouldexist' : + value => 'foo', + } + + keystone_config { 'DEFAULT/thisshouldnotexist' : + value => '', + } + + keystone_config { 'DEFAULT/thisshouldexist2' : + value => '', + ensure_absent_val => 'toto', + } + + keystone_config { 'DEFAULT/thisshouldnotexist2' : + value => 'toto', + ensure_absent_val => 'toto', + } + EOS + + + # Run it twice and test for idempotency + apply_manifest(pp, :catch_failures => true) + apply_manifest(pp, :catch_changes => true) + end + + describe file('/etc/keystone/keystone.conf') do + it { should exist } + it { should contain('thisshouldexist=foo') } + it { should contain('thisshouldexist2=') } + + its(:content) { should_not match /thisshouldnotexist/ } + end + + + end +end diff --git a/deployment_scripts/puppet/modules/openstacklib/spec/acceptance/rabbitmq_spec.rb b/deployment_scripts/puppet/modules/openstacklib/spec/acceptance/rabbitmq_spec.rb new file mode 100644 index 0000000..50755e6 --- /dev/null +++ b/deployment_scripts/puppet/modules/openstacklib/spec/acceptance/rabbitmq_spec.rb @@ -0,0 +1,55 @@ +require 'spec_helper_acceptance' + +describe 'openstacklib class' do + + context 'default parameters' do + + it 'should work with no errors' do + pp= <<-EOS + Exec { logoutput => 'on_failure' } + + if $::osfamily == 'RedHat' { + class { '::openstack_extras::repo::redhat::redhat': + release => 'kilo', + manage_epel => false, + } + } else { + include ::apt + } + + class { '::rabbitmq': + delete_guest_user => true, + package_provider => $::package_provider + } + + # openstacklib resources + include ::openstacklib::openstackclient + + ::openstacklib::messaging::rabbitmq { 'beaker': + userid => 'beaker', + is_admin => true, + } + EOS + + # Run it twice and test for idempotency + apply_manifest(pp, :catch_failures => true) + apply_manifest(pp, :catch_changes => true) + end + + describe 'test rabbitmq resources' do + it 'should list rabbitmq beaker resources' do + shell('rabbitmqctl list_users') do |r| + expect(r.stdout).to match(/^beaker/) + expect(r.stdout).not_to match(/^guest/) + expect(r.exit_code).to eq(0) + end + + shell('rabbitmqctl list_permissions') do |r| + expect(r.stdout).to match(/^beaker\t\.\*\t\.\*\t\.\*$/) + expect(r.exit_code).to eq(0) + end + end + end + + end +end diff --git a/deployment_scripts/puppet/modules/openstacklib/spec/classes/openstacklib_defaults_spec.rb b/deployment_scripts/puppet/modules/openstacklib/spec/classes/openstacklib_defaults_spec.rb new file mode 100644 index 0000000..9cb105d --- /dev/null +++ b/deployment_scripts/puppet/modules/openstacklib/spec/classes/openstacklib_defaults_spec.rb @@ -0,0 +1,33 @@ +require 'spec_helper' + +describe 'openstacklib::defaults', type: :class do + on_supported_os.each do |os, facts| + let(:pre_condition) do + <<-eof +package { 'my_virt_package' : + ensure => present, + tag => 'openstack' +} + eof + end + + context "Puppet < 4.0.0" do + context "on #{os}" do + let(:facts) { facts.merge(:puppetversion => '3.8.0') } + it { is_expected.to compile.with_all_deps } + it { is_expected.to contain_class('openstacklib::defaults') } + it { is_expected.to contain_package('my_virt_package') + .with(:allow_virtual => true)} + end + end + context "Puppet >= 4.0.0" do + context "on #{os}" do + let(:facts) { facts.merge(:puppetversion => '4.0.0') } + it { is_expected.to compile.with_all_deps } + it { is_expected.to contain_class('openstacklib::defaults') } + it { is_expected.to contain_package('my_virt_package') + .without(:allow_virtual)} + end + end + end +end diff --git a/deployment_scripts/puppet/modules/openstacklib/spec/classes/openstacklib_policy_spec.rb b/deployment_scripts/puppet/modules/openstacklib/spec/classes/openstacklib_policy_spec.rb new file mode 100644 index 0000000..a7667f9 --- /dev/null +++ b/deployment_scripts/puppet/modules/openstacklib/spec/classes/openstacklib_policy_spec.rb @@ -0,0 +1,41 @@ +require 'spec_helper' + +describe 'openstacklib::policy' do + + shared_examples_for 'openstacklib::policy' do + context 'with basic configuration' do + let :params do + { + :policies => { + 'foo' => { + 'file_path' => '/etc/nova/policy.json', + 'key' => 'context_is_admin', + 'value' => 'foo:bar' + } + } + } + end + + it 'configures the proper policy' do + is_expected.to contain_openstacklib__policy__base('foo').with( + :file_path => '/etc/nova/policy.json', + :key => 'context_is_admin', + :value => 'foo:bar' + ) + end + end + end + + on_supported_os({ + :supported_os => OSDefaults.get_supported_os + }).each do |os,facts| + context "on #{os}" do + let (:facts) do + facts.merge!(OSDefaults.get_facts()) + end + + it_configures 'openstacklib::policy' + end + end + +end diff --git a/deployment_scripts/puppet/modules/openstacklib/spec/classes/openstacklib_policyrcd_spec.rb b/deployment_scripts/puppet/modules/openstacklib/spec/classes/openstacklib_policyrcd_spec.rb new file mode 100644 index 0000000..8f01fc5 --- /dev/null +++ b/deployment_scripts/puppet/modules/openstacklib/spec/classes/openstacklib_policyrcd_spec.rb @@ -0,0 +1,102 @@ +# +# Copyright (C) 2016 Matthew J. Black +# +# Author: Matthew J. Black +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +# Unit tests for openstacklib::policyrcd +# +require 'spec_helper' + +describe 'openstacklib::policyrcd' do + + shared_examples_for 'openstacklib::policyrcd on Debian platforms' do + context "with single service" do + let :params do + { :services => ['keystone'] } + end + + let(:contents) { + <<-eof +#!/bin/bash + +if [ "$1" == "keystone" ] +then + exit 101 +fi + + +eof + } + + it 'creates policy-rc.d file' do + is_expected.to contain_file('/usr/sbin/policy-rc.d').with_content(contents) + end + end + + context "with multiple services" do + let :params do + { :services => ['keystone', 'nova'] } + end + + let(:contents) { + <<-eof +#!/bin/bash + +if [ "$1" == "keystone" ] +then + exit 101 +fi + +if [ "$1" == "nova" ] +then + exit 101 +fi + + +eof + } + + it 'creates policy-rc.d file' do + is_expected.to contain_file('/usr/sbin/policy-rc.d').with_content(contents) + end + end + + end + + shared_examples_for 'openstacklib::policyrcd on RedHat platforms' do + describe "with single service" do + let :params do + { :services => ['keystone'] } + end + + it 'does not create policy-rc.d file' do + is_expected.to_not contain_file('/usr/sbin/policy-rc.d') + end + end + end + + on_supported_os({ + :supported_os => OSDefaults.get_supported_os + }).each do |os,facts| + context "on #{os}" do + let (:facts) do + facts.merge!(OSDefaults.get_facts()) + end + + it_configures "openstacklib::policyrcd on #{facts[:osfamily]} platforms" + end + end + +end diff --git a/deployment_scripts/puppet/modules/openstacklib/spec/defines/openstacklib_db_mysql_host_access_spec.rb b/deployment_scripts/puppet/modules/openstacklib/spec/defines/openstacklib_db_mysql_host_access_spec.rb new file mode 100644 index 0000000..71e3925 --- /dev/null +++ b/deployment_scripts/puppet/modules/openstacklib/spec/defines/openstacklib_db_mysql_host_access_spec.rb @@ -0,0 +1,102 @@ +require 'spec_helper' + +describe 'openstacklib::db::mysql::host_access' do + + let :pre_condition do + "include mysql::server\n" + + "openstacklib::db::mysql { 'nova':\n" + + " password_hash => 'AA1420F182E88B9E5F874F6FBE7459291E8F4601'}" + end + + shared_examples 'openstacklib::db::mysql::host_access examples' do + + context 'with required parameters' do + let (:title) { 'nova_10.0.0.1' } + let :params do + { :user => 'foobar', + :password_hash => 'AA1420F182E88B9E5F874F6FBE7459291E8F4601', + :database => 'nova', + :privileges => 'ALL' } + end + + it { is_expected.to contain_mysql_user("#{params[:user]}@10.0.0.1").with( + :password_hash => params[:password_hash], + :tls_options => ['NONE'] + )} + + it { is_expected.to contain_mysql_grant("#{params[:user]}@10.0.0.1/#{params[:database]}.*").with( + :user => "#{params[:user]}@10.0.0.1", + :privileges => 'ALL', + :table => "#{params[:database]}.*" + )} + end + + context 'with skipping user creation' do + let (:title) { 'nova_10.0.0.1' } + let :params do + { :user => 'foobar', + :password_hash => 'AA1420F182E88B9E5F874F6FBE7459291E8F4601', + :database => 'nova', + :privileges => 'ALL', + :create_user => false, + } + end + + it { is_expected.to_not contain_mysql_user("#{params[:user]}@10.0.0.1") } + + it { is_expected.to contain_mysql_grant("#{params[:user]}@10.0.0.1/#{params[:database]}.*").with( + :user => "#{params[:user]}@10.0.0.1", + :privileges => 'ALL', + :table => "#{params[:database]}.*" + )} + end + + context 'with skipping grant creation' do + let (:title) { 'nova_10.0.0.1' } + let :params do + { :user => 'foobar', + :password_hash => 'AA1420F182E88B9E5F874F6FBE7459291E8F4601', + :database => 'nova', + :privileges => 'ALL', + :create_grant => false, + } + end + + it { is_expected.to contain_mysql_user("#{params[:user]}@10.0.0.1").with( + :password_hash => params[:password_hash] + )} + + it { is_expected.to_not contain_mysql_grant("#{params[:user]}@10.0.0.1/#{params[:database]}.*") } + end + + context 'with skipping user and grant creation' do + let (:title) { 'nova_10.0.0.1' } + let :params do + { :user => 'foobar', + :password_hash => 'AA1420F182E88B9E5F874F6FBE7459291E8F4601', + :database => 'nova', + :privileges => 'ALL', + :create_user => false, + :create_grant => false, + } + end + + it { is_expected.to_not contain_mysql_user("#{params[:user]}@10.0.0.1") } + + it { is_expected.to_not contain_mysql_grant("#{params[:user]}@10.0.0.1/#{params[:database]}.*") } + end + end + + on_supported_os({ + :supported_os => OSDefaults.get_supported_os + }).each do |os,facts| + context "on #{os}" do + let (:facts) do + facts.merge!(OSDefaults.get_facts()) + end + + it_configures 'openstacklib::db::mysql::host_access examples' + end + end + +end diff --git a/deployment_scripts/puppet/modules/openstacklib/spec/defines/openstacklib_db_mysql_spec.rb b/deployment_scripts/puppet/modules/openstacklib/spec/defines/openstacklib_db_mysql_spec.rb new file mode 100644 index 0000000..29819f8 --- /dev/null +++ b/deployment_scripts/puppet/modules/openstacklib/spec/defines/openstacklib_db_mysql_spec.rb @@ -0,0 +1,229 @@ +require 'spec_helper' + +describe 'openstacklib::db::mysql' do + + let :pre_condition do + 'include mysql::server' + end + + let (:title) { 'nova' } + + let :required_params do + { :password_hash => 'AA1420F182E88B9E5F874F6FBE7459291E8F4601' } + end + + shared_examples 'openstacklib::db::mysql examples' do + + context 'with only required parameters' do + let :params do + required_params + end + + it { is_expected.to contain_mysql_database(title).with( + :charset => 'utf8', + :collate => 'utf8_general_ci' + )} + it { is_expected.to contain_openstacklib__db__mysql__host_access("#{title}_127.0.0.1").with( + :user => title, + :database => title, + :privileges => 'ALL', + :tls_options => ['NONE'], + )} + end + + context 'with overriding dbname parameter' do + let :params do + { :dbname => 'foobar' }.merge(required_params) + end + + it { is_expected.to contain_mysql_database(params[:dbname]).with( + :charset => 'utf8', + :collate => 'utf8_general_ci' + )} + it { is_expected.to contain_openstacklib__db__mysql__host_access("#{params[:dbname]}_127.0.0.1").with( + :user => title, + :database => params[:dbname], + :privileges => 'ALL', + :create_user => true, + :create_grant => true, + :tls_options => ['NONE'], + )} + end + + context 'with overriding user parameter' do + let :params do + { :user => 'foobar' }.merge(required_params) + end + + it { is_expected.to contain_mysql_database(title).with( + :charset => 'utf8', + :collate => 'utf8_general_ci' + )} + it { is_expected.to contain_openstacklib__db__mysql__host_access("#{title}_127.0.0.1").with( + :user => params[:user], + :database => title, + :privileges => 'ALL', + :create_user => true, + :create_grant => true, + :tls_options => ['NONE'], + )} + end + + context 'when overriding charset parameter' do + let :params do + { :charset => 'latin1' }.merge(required_params) + end + + it { is_expected.to contain_mysql_database(title).with_charset(params[:charset]) } + end + + context 'when omitting the required parameter password_hash' do + let :params do + required_params.delete(:password_hash) + end + it { expect { is_expected.to raise_error(Puppet::Error) } } + end + + context 'when notifying other resources' do + let :pre_condition do + 'exec {"nova-db-sync":}' + end + let :params do + { :notify => 'Exec[nova-db-sync]'}.merge(required_params) + end + + it { is_expected.to contain_exec('nova-db-sync').that_subscribes_to("Openstacklib::Db::Mysql[#{title}]") } + end + + context 'when required for other openstack services' do + let :pre_condition do + 'service {"keystone":}' + end + let :title do + 'keystone' + end + let :params do + { :before => 'Service[keystone]'}.merge(required_params) + end + + it { is_expected.to contain_service('keystone').that_requires("Openstacklib::Db::Mysql[keystone]") } + end + + context "overriding allowed_hosts parameter with array value" do + let :params do + { :allowed_hosts => ['127.0.0.1','%'] }.merge(required_params) + end + + it {is_expected.to contain_openstacklib__db__mysql__host_access("#{title}_127.0.0.1").with( + :user => title, + :password_hash => params[:password_hash], + :database => title + )} + it {is_expected.to contain_openstacklib__db__mysql__host_access("#{title}_%").with( + :user => title, + :password_hash => params[:password_hash], + :database => title + )} + end + + context "overriding allowed_hosts parameter with string value" do + let :params do + { :allowed_hosts => '192.168.1.1' }.merge(required_params) + end + + it {is_expected.to contain_openstacklib__db__mysql__host_access("#{title}_192.168.1.1").with( + :user => title, + :password_hash => params[:password_hash], + :database => title + )} + end + + context "overriding allowed_hosts parameter equals to host param " do + let :params do + { :allowed_hosts => '127.0.0.1' }.merge(required_params) + end + + it {is_expected.to contain_openstacklib__db__mysql__host_access("#{title}_127.0.0.1").with( + :user => title, + :password_hash => params[:password_hash], + :database => title + )} + end + + context 'with skipping user creation' do + let :params do + { :create_user => false }.merge(required_params) + end + + it { is_expected.to contain_mysql_database(title).with( + :charset => 'utf8', + :collate => 'utf8_general_ci' + )} + it { is_expected.to contain_openstacklib__db__mysql__host_access("#{title}_127.0.0.1").with( + :user => title, + :database => title, + :privileges => 'ALL', + :create_user => false, + :create_grant => true, + )} + end + + context 'with skipping grant creation' do + let :params do + { :create_grant => false }.merge(required_params) + end + + it { is_expected.to contain_mysql_database(title).with( + :charset => 'utf8', + :collate => 'utf8_general_ci' + )} + it { is_expected.to contain_openstacklib__db__mysql__host_access("#{title}_127.0.0.1").with( + :user => title, + :database => title, + :privileges => 'ALL', + :create_user => true, + :create_grant => false, + )} + end + + context 'with skipping user and grant creation' do + let :params do + { :create_user => false, + :create_grant => false }.merge(required_params) + end + + it { is_expected.to contain_mysql_database(title).with( + :charset => 'utf8', + :collate => 'utf8_general_ci' + )} + it { is_expected.to_not contain_openstacklib__db__mysql__host_access("#{title}_127.0.0.1") } + end + + context "overriding tls_options" do + let :params do + { :tls_options => ['SSL'] }.merge(required_params) + end + + it {is_expected.to contain_openstacklib__db__mysql__host_access("#{title}_127.0.0.1").with( + :user => title, + :password_hash => params[:password_hash], + :database => title, + :tls_options => ['SSL'], + )} + end + + end + + on_supported_os({ + :supported_os => OSDefaults.get_supported_os + }).each do |os,facts| + context "on #{os}" do + let (:facts) do + facts.merge!(OSDefaults.get_facts()) + end + + it_configures 'openstacklib::db::mysql examples' + end + end + +end diff --git a/deployment_scripts/puppet/modules/openstacklib/spec/defines/openstacklib_db_postgresql_spec.rb b/deployment_scripts/puppet/modules/openstacklib/spec/defines/openstacklib_db_postgresql_spec.rb new file mode 100644 index 0000000..b241044 --- /dev/null +++ b/deployment_scripts/puppet/modules/openstacklib/spec/defines/openstacklib_db_postgresql_spec.rb @@ -0,0 +1,81 @@ +require 'spec_helper' + +describe 'openstacklib::db::postgresql' do + let (:title) { 'nova' } + + let :required_params do + { :password_hash => 'AA1420F182E88B9E5F874F6FBE7459291E8F4601' } + end + + let (:pre_condition) do + "include ::postgresql::server" + end + + shared_examples 'openstacklib::db::postgresql examples' do + context 'with only required parameters' do + let :params do + required_params + end + + it { is_expected.to contain_postgresql__server__db(title).with( + :user => title, + :password => params[:password_hash] + )} + end + + context 'when overriding encoding' do + let :params do + { :encoding => 'latin1' }.merge(required_params) + end + it { is_expected.to contain_postgresql__server__db(title).with_encoding(params[:encoding]) } + end + + context 'when omitting the required parameter password_hash' do + let :params do + required_params.delete(:password_hash) + end + + it { expect { is_expected.to raise_error(Puppet::Error) } } + end + + context 'when notifying other resources' do + let :pre_condition do + "include ::postgresql::server + exec { 'nova-db-sync': }" + end + let :params do + { :notify => 'Exec[nova-db-sync]'}.merge(required_params) + end + + it {is_expected.to contain_exec('nova-db-sync').that_subscribes_to("Openstacklib::Db::Postgresql[#{title}]") } + end + + context 'when required for other openstack services' do + let :pre_condition do + "include ::postgresql::server + service {'keystone':}" + end + let :title do + 'keystone' + end + let :params do + { :before => 'Service[keystone]'}.merge(required_params) + end + + it { is_expected.to contain_service('keystone').that_requires("Openstacklib::Db::Postgresql[keystone]") } + end + end + + on_supported_os({ + :supported_os => OSDefaults.get_supported_os + }).each do |os,facts| + context "on #{os}" do + let (:facts) do + facts.merge!(OSDefaults.get_facts()) + end + + it_configures 'openstacklib::db::postgresql examples' + end + end + +end diff --git a/deployment_scripts/puppet/modules/openstacklib/spec/defines/openstacklib_messaging_rabbitmq_spec.rb b/deployment_scripts/puppet/modules/openstacklib/spec/defines/openstacklib_messaging_rabbitmq_spec.rb new file mode 100644 index 0000000..b32b1d2 --- /dev/null +++ b/deployment_scripts/puppet/modules/openstacklib/spec/defines/openstacklib_messaging_rabbitmq_spec.rb @@ -0,0 +1,98 @@ +# +# Copyright (C) 2014 eNovance SAS +# +# Author: Emilien Macchi +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +require 'spec_helper' + +describe 'openstacklib::messaging::rabbitmq' do + + let (:title) { 'nova' } + + shared_examples 'openstacklib::messaging::rabbitmq examples' do + + let :params do + {} + end + + context 'with default parameters' do + it { is_expected.to contain_rabbitmq_user('guest').with( + :admin => false, + :password => 'guest', + :provider => 'rabbitmqctl', + )} + it { is_expected.to contain_rabbitmq_user_permissions('guest@/').with( + :configure_permission => '.*', + :write_permission => '.*', + :read_permission => '.*', + :provider => 'rabbitmqctl', + )} + it { is_expected.to contain_rabbitmq_vhost('/').with( + :provider => 'rabbitmqctl', + )} + end + + context 'with custom parameters' do + before :each do + params.merge!( + :userid => 'nova', + :password => 'secrete', + :virtual_host => '/nova', + :is_admin => true, + :configure_permission => '.nova', + :write_permission => '.nova', + :read_permission => '.nova' + ) + end + + it { is_expected.to contain_rabbitmq_user('nova').with( + :admin => true, + :password => 'secrete', + :provider => 'rabbitmqctl', + )} + it { is_expected.to contain_rabbitmq_user_permissions('nova@/nova').with( + :configure_permission => '.nova', + :write_permission => '.nova', + :read_permission => '.nova', + :provider => 'rabbitmqctl', + )} + it { is_expected.to contain_rabbitmq_vhost('/nova').with( + :provider => 'rabbitmqctl', + )} + end + + context 'when disabling vhost management' do + before :each do + params.merge!( :manage_vhost => false ) + end + + it { is_expected.not_to contain_rabbitmq_vhost('/') } + end + + end + + on_supported_os({ + :supported_os => OSDefaults.get_supported_os + }).each do |os,facts| + context "on #{os}" do + let (:facts) do + facts.merge!(OSDefaults.get_facts()) + end + + it_configures 'openstacklib::messaging::rabbitmq examples' + end + end + +end diff --git a/deployment_scripts/puppet/modules/openstacklib/spec/defines/openstacklib_policy_spec.rb b/deployment_scripts/puppet/modules/openstacklib/spec/defines/openstacklib_policy_spec.rb new file mode 100644 index 0000000..ed5cf7e --- /dev/null +++ b/deployment_scripts/puppet/modules/openstacklib/spec/defines/openstacklib_policy_spec.rb @@ -0,0 +1,54 @@ +require 'spec_helper' + +describe 'openstacklib::policy::base' do + + + shared_examples_for 'openstacklib::policy' do + context 'with some basic parameters' do + let :title do + 'nova-contest_is_admin' + end + + let :params do + {:file_path => '/etc/nova/policy.json', + :key => 'context_is_admin or owner', + :value => 'foo:bar'} + end + + it 'configures (modifies) the proper policy' do + is_expected.to contain_augeas('/etc/nova/policy.json-context_is_admin or owner-foo:bar').with( + 'lens' => 'Json.lns', + 'incl' => '/etc/nova/policy.json', + 'changes' => 'set dict/entry[*][.="context_is_admin or owner"]/string "foo:bar"', + 'require' => 'Augeas[/etc/nova/policy.json-context_is_admin or owner-foo:bar-add]' + ) + end + + it 'configures (adds) the proper policy' do + is_expected.to contain_augeas('/etc/nova/policy.json-context_is_admin or owner-foo:bar-add').with( + 'lens' => 'Json.lns', + 'incl' => '/etc/nova/policy.json', + 'changes' => [ + 'set dict/entry[last()+1] "context_is_admin or owner"', + 'set dict/entry[last()]/string "foo:bar"' + ], + 'onlyif' => 'match dict/entry[*][.="context_is_admin or owner"] size == 0' + ) + end + end + end + + on_supported_os({ + :supported_os => OSDefaults.get_supported_os + }).each do |os,facts| + context "on #{os}" do + let (:facts) do + facts.merge!(OSDefaults.get_facts()) + end + + it_configures 'openstacklib::policy' + end + end + +end + diff --git a/deployment_scripts/puppet/modules/openstacklib/spec/defines/openstacklib_service_validation_spec.rb b/deployment_scripts/puppet/modules/openstacklib/spec/defines/openstacklib_service_validation_spec.rb new file mode 100644 index 0000000..dad1175 --- /dev/null +++ b/deployment_scripts/puppet/modules/openstacklib/spec/defines/openstacklib_service_validation_spec.rb @@ -0,0 +1,117 @@ +# +# Copyright (C) 2014 eNovance SAS +# +# Author: Emilien Macchi +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +require 'spec_helper' + +describe 'openstacklib::service_validation' do + + let (:title) { 'nova-api' } + + let :required_params do + { :command => 'nova list' } + end + + shared_examples 'openstacklib::service_validation examples' do + + context 'with only required parameters' do + let :params do + required_params + end + + it { is_expected.to contain_exec("execute #{title} validation").with( + :path => '/usr/bin:/bin:/usr/sbin:/sbin', + :provider => 'shell', + :command => 'nova list', + :refreshonly => false, + :timeout => '60', + :tries => '10', + :try_sleep => '2', + :logoutput => 'on_failure', + )} + + it { is_expected.to contain_anchor("create #{title} anchor").with( + :require => "Exec[execute #{title} validation]", + )} + + end + + context 'with unless parameter' do + let :params do + required_params.merge!({ :unless => 'pwd' }) + end + + it { is_expected.to contain_exec("execute #{title} validation").with( + :path => '/usr/bin:/bin:/usr/sbin:/sbin', + :provider => 'shell', + :command => 'nova list', + :refreshonly => false, + :timeout => '60', + :tries => '10', + :try_sleep => '2', + :unless => 'pwd', + )} + + it { is_expected.to contain_anchor("create #{title} anchor").with( + :require => "Exec[execute #{title} validation]", + )} + + end + + context 'with onlyif parameter' do + let :params do + required_params.merge!({:onlyif => 'pwd' }) + end + + it { is_expected.to contain_exec("execute #{title} validation").with( + :path => '/usr/bin:/bin:/usr/sbin:/sbin', + :provider => 'shell', + :command => 'nova list', + :refreshonly => false, + :timeout => '60', + :tries => '10', + :try_sleep => '2', + :onlyif => 'pwd', + )} + + it { is_expected.to contain_anchor("create #{title} anchor").with( + :require => "Exec[execute #{title} validation]", + )} + + end + + context 'when omitting a required parameter command' do + let :params do + required_params.delete(:command) + end + it { expect { is_expected.to raise_error(Puppet::Error) } } + end + + end + + on_supported_os({ + :supported_os => OSDefaults.get_supported_os + }).each do |os,facts| + context "on #{os}" do + let (:facts) do + facts.merge!(OSDefaults.get_facts()) + end + + it_configures 'openstacklib::service_validation examples' + end + end + +end diff --git a/deployment_scripts/puppet/modules/openstacklib/spec/defines/openstacklib_wsgi_apache_spec.rb b/deployment_scripts/puppet/modules/openstacklib/spec/defines/openstacklib_wsgi_apache_spec.rb new file mode 100644 index 0000000..77cef4c --- /dev/null +++ b/deployment_scripts/puppet/modules/openstacklib/spec/defines/openstacklib_wsgi_apache_spec.rb @@ -0,0 +1,161 @@ +# +# Copyright (C) 2014 eNovance SAS +# +# Author: Emilien Macchi +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +require 'spec_helper' + +describe 'openstacklib::wsgi::apache' do + + let (:title) { 'keystone_wsgi' } + + let :global_facts do + { + :os_workers => 8, + :concat_basedir => '/var/lib/puppet/concat', + :fqdn => 'some.host.tld' + } + end + + let :params do + { + :bind_port => 5000, + :group => 'keystone', + :ssl => true, + :user => 'keystone', + :wsgi_script_dir => '/var/www/cgi-bin/keystone', + :wsgi_script_file => 'main', + :wsgi_script_source => '/usr/share/keystone/keystone.wsgi' + } + end + + shared_examples_for 'apache serving a service with mod_wsgi' do + it { is_expected.to contain_service('httpd').with_name(platform_params[:httpd_service_name]) } + it { is_expected.to contain_class('apache') } + it { is_expected.to contain_class('apache::mod::wsgi') } + + describe 'with default parameters' do + + it { is_expected.to contain_file('/var/www/cgi-bin/keystone').with( + 'ensure' => 'directory', + 'owner' => 'keystone', + 'group' => 'keystone', + 'require' => 'Package[httpd]' + )} + + it { is_expected.to contain_file('keystone_wsgi').with( + 'ensure' => 'file', + 'path' => '/var/www/cgi-bin/keystone/main', + 'source' => '/usr/share/keystone/keystone.wsgi', + 'owner' => 'keystone', + 'group' => 'keystone', + 'mode' => '0644', + )} + + it { is_expected.to contain_apache__vhost('keystone_wsgi').with( + 'servername' => 'some.host.tld', + 'ip' => nil, + 'port' => '5000', + 'docroot' => '/var/www/cgi-bin/keystone', + 'docroot_owner' => 'keystone', + 'docroot_group' => 'keystone', + 'ssl' => 'true', + 'wsgi_daemon_process' => 'keystone_wsgi', + 'wsgi_process_group' => 'keystone_wsgi', + 'wsgi_script_aliases' => { '/' => "/var/www/cgi-bin/keystone/main" }, + 'wsgi_daemon_process_options' => { + 'user' => 'keystone', + 'group' => 'keystone', + 'processes' => 1, + 'threads' => global_facts[:os_workers], + 'display-name' => 'keystone_wsgi', + }, + 'wsgi_application_group' => '%{GLOBAL}', + 'require' => 'File[keystone_wsgi]', + 'setenvif' => ['X-Forwarded-Proto https HTTPS=1'] + )} + it { is_expected.to contain_concat("#{platform_params[:httpd_ports_file]}") } + end + + describe 'when overriding parameters' do + let :params do + { + :wsgi_script_dir => '/var/www/cgi-bin/keystone', + :wsgi_script_file => 'main', + :wsgi_script_source => '/usr/share/keystone/keystone.wsgi', + :wsgi_pass_authorization => 'On', + :wsgi_chunked_request => 'On', + :servername => 'dummy.host', + :bind_host => '10.42.51.1', + :bind_port => 4142, + :user => 'keystone', + :group => 'keystone', + :ssl => false, + :workers => 37, + :vhost_custom_fragment => 'LimitRequestFieldSize 81900', + :allow_encoded_slashes => 'on', + } + end + it { is_expected.to contain_apache__vhost('keystone_wsgi').with( + 'servername' => 'dummy.host', + 'ip' => '10.42.51.1', + 'port' => '4142', + 'docroot' => "/var/www/cgi-bin/keystone", + 'ssl' => 'false', + 'wsgi_daemon_process' => 'keystone_wsgi', + 'wsgi_daemon_process_options' => { + 'user' => 'keystone', + 'group' => 'keystone', + 'processes' => '37', + 'threads' => '8', + 'display-name' => 'keystone_wsgi', + }, + 'wsgi_process_group' => 'keystone_wsgi', + 'wsgi_script_aliases' => { '/' => "/var/www/cgi-bin/keystone/main" }, + 'wsgi_application_group' => '%{GLOBAL}', + 'wsgi_pass_authorization' => 'On', + 'wsgi_chunked_request' => 'On', + 'require' => 'File[keystone_wsgi]', + 'custom_fragment' => 'LimitRequestFieldSize 81900', + 'allow_encoded_slashes' => 'on', + )} + + end + + end + + on_supported_os({ + :supported_os => OSDefaults.get_supported_os + }).each do |os,facts| + context "on #{os}" do + let (:facts) do + facts.merge!(OSDefaults.get_facts(global_facts)) + end + + let(:platform_params) do + case facts[:osfamily] + when 'Debian' + { :httpd_service_name => 'apache2', + :httpd_ports_file => '/etc/apache2/ports.conf', } + when 'RedHat' + { :httpd_service_name => 'httpd', + :httpd_ports_file => '/etc/httpd/conf/ports.conf', } + end + end + it_configures 'apache serving a service with mod_wsgi' + end + end + +end diff --git a/deployment_scripts/puppet/modules/openstacklib/spec/functions/is_service_default_spec.rb b/deployment_scripts/puppet/modules/openstacklib/spec/functions/is_service_default_spec.rb new file mode 100644 index 0000000..a673056 --- /dev/null +++ b/deployment_scripts/puppet/modules/openstacklib/spec/functions/is_service_default_spec.rb @@ -0,0 +1,40 @@ +require 'spec_helper' + +describe 'is_service_default' do + + it 'refuses without at least one argument' do + is_expected.to run.with_params().\ + and_raise_error(Puppet::ParseError, /Wrong number of arguments/) + end + + it 'refuses too many arguments' do + is_expected.to run.with_params('foo', 'bar').\ + and_raise_error(Puppet::ParseError, /Wrong number of arguments/) + end + + context 'is_service_default' do + it 'with ' do + is_expected.to run.with_params('').and_return(true) + end + + it 'with string != ' do + is_expected.to run.with_params('a value').and_return(false) + end + + it 'with array' do + is_expected.to run.with_params([1,2,3]).and_return(false) + end + + it 'with hash' do + is_expected.to run.with_params({'foo' => 'bar'}).and_return(false) + end + + it 'with integer' do + is_expected.to run.with_params(1234).and_return(false) + end + + it 'with boolean' do + is_expected.to run.with_params(false).and_return(false) + end + end +end diff --git a/deployment_scripts/puppet/modules/openstacklib/spec/functions/normalize_ip_for_uri_spec.rb b/deployment_scripts/puppet/modules/openstacklib/spec/functions/normalize_ip_for_uri_spec.rb new file mode 100644 index 0000000..daecf66 --- /dev/null +++ b/deployment_scripts/puppet/modules/openstacklib/spec/functions/normalize_ip_for_uri_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +describe 'normalize_ip_for_uri' do + it { should run.with_params(false).and_return(false)} + it { should run.with_params('not_an_ip').and_return('not_an_ip')} + it { should run.with_params('127.0.0.1').and_return('127.0.0.1')} + it { should run.with_params('::1').and_return('[::1]')} + it { should run.with_params('[2001::01]').and_return('[2001::01]')} + # You're not forced to pass an array, a list of argument will do. + it { should run.with_params('::1','::2').and_return(['[::1]','[::2]'])} + it { should run.with_params(['::1','::2']).and_return(['[::1]','[::2]'])} + it { should run.with_params(['::1','[::2]','::3']).and_return(['[::1]','[::2]','[::3]'])} + it { should run.with_params(['192.168.0.1','[::2]']).and_return(['192.168.0.1','[::2]'])} + it { should run.with_params(['192.168.0.1','::2']).and_return(['192.168.0.1','[::2]'])} +end diff --git a/deployment_scripts/puppet/modules/openstacklib/spec/functions/os_database_connection_spec.rb b/deployment_scripts/puppet/modules/openstacklib/spec/functions/os_database_connection_spec.rb new file mode 100644 index 0000000..f45db92 --- /dev/null +++ b/deployment_scripts/puppet/modules/openstacklib/spec/functions/os_database_connection_spec.rb @@ -0,0 +1,157 @@ +require 'spec_helper' + +describe 'os_database_connection' do + + it 'refuses String' do + is_expected.to run.with_params('foo').\ + and_raise_error(Puppet::ParseError, /Requires an hash/) + end + + it 'refuses Array' do + is_expected.to run.with_params(['foo']).\ + and_raise_error(Puppet::ParseError, /Requires an hash/) + end + + it 'refuses without at least one argument' do + is_expected.to run.with_params().\ + and_raise_error(Puppet::ParseError, /Wrong number of arguments/) + end + + it 'refuses too many arguments' do + is_expected.to run.with_params('foo', 'bar').\ + and_raise_error(Puppet::ParseError, /Wrong number of arguments/) + end + + it 'refuses extra params passed as String' do + is_expected.to run.with_params({ + 'dialect' => 'sqlite', + 'database' => '/var/lib/keystone/keystone.db', + 'host' => '127.0.0.1', + 'port' => '3306', + 'extra' => 'charset=utf-8' + }).and_raise_error(Puppet::ParseError, /extra should be a Hash/) + end + + it 'fails if port is provided with missing host' do + is_expected.to run.with_params({ + 'dialect' => 'sqlite', + 'database' => '/var/lib/keystone/keystone.db', + 'port' => '3306', + 'extra' => { 'charset' => 'utf-8' } + }).and_raise_error(Puppet::ParseError, /host is required with port/) + end + + context 'creates the correct connection URI' do + + it 'with all parameters' do + is_expected.to run.with_params({ + 'dialect' => 'mysql', + 'host' => '127.0.0.1', + 'port' => '3306', + 'database' => 'test', + 'username' => 'guest', + 'password' => 's3cr3t', + 'extra' => { 'charset' => 'utf-8', 'read_timeout' => '60' } + }).and_return('mysql://guest:s3cr3t@127.0.0.1:3306/test?charset=utf-8&read_timeout=60') + end + + it 'with all parameters and charset set' do + is_expected.to run.with_params({ + 'dialect' => 'mysql', + 'host' => '127.0.0.1', + 'port' => '3306', + 'database' => 'test', + 'username' => 'guest', + 'password' => 's3cr3t', + 'charset' => 'utf-8', + 'extra' => { 'charset' => 'latin1', 'read_timeout' => '60' } + }).and_return('mysql://guest:s3cr3t@127.0.0.1:3306/test?charset=utf-8&read_timeout=60') + end + + it 'without port' do + is_expected.to run.with_params({ + 'dialect' => 'mysql', + 'host' => '127.0.0.1', + 'database' => 'test', + 'username' => 'guest', + 'password' => 's3cr3t', + 'extra' => { 'charset' => 'utf-8' } + }).and_return('mysql://guest:s3cr3t@127.0.0.1/test?charset=utf-8') + end + + it 'without host and port' do + is_expected.to run.with_params({ + 'dialect' => 'sqlite', + 'database' => '/var/lib/keystone/keystone.db', + 'extra' => { 'charset' => 'utf-8' } + }).and_return('sqlite:////var/lib/keystone/keystone.db?charset=utf-8') + end + + it 'without username and password' do + is_expected.to run.with_params({ + 'dialect' => 'mysql', + 'host' => '127.0.0.1', + 'port' => '3306', + 'database' => 'test', + 'extra' => { 'charset' => 'utf-8' } + }).and_return('mysql://127.0.0.1:3306/test?charset=utf-8') + end + + it 'with username set to undef' do + is_expected.to run.with_params({ + 'dialect' => 'mysql', + 'host' => '127.0.0.1', + 'port' => '3306', + 'database' => 'test', + 'username' => :undef, + 'extra' => { 'charset' => 'utf-8' } + }).and_return('mysql://127.0.0.1:3306/test?charset=utf-8') + end + + it 'with username set to an empty string' do + is_expected.to run.with_params({ + 'dialect' => 'mysql', + 'host' => '127.0.0.1', + 'port' => '3306', + 'database' => 'test', + 'username' => '', + 'extra' => { 'charset' => 'utf-8' } + }).and_return('mysql://127.0.0.1:3306/test?charset=utf-8') + end + + it 'without password' do + is_expected.to run.with_params({ + 'dialect' => 'mysql', + 'host' => '127.0.0.1', + 'port' => '3306', + 'database' => 'test', + 'username' => 'guest', + 'extra' => { 'charset' => 'utf-8' } + }).and_return('mysql://guest@127.0.0.1:3306/test?charset=utf-8') + end + + it 'with password set to undef' do + is_expected.to run.with_params({ + 'dialect' => 'mysql', + 'host' => '127.0.0.1', + 'port' => '3306', + 'database' => 'test', + 'username' => 'guest', + 'password' => :undef, + 'extra' => { 'charset' => 'utf-8' } + }).and_return('mysql://guest@127.0.0.1:3306/test?charset=utf-8') + end + + it 'with password set to an empty string' do + is_expected.to run.with_params({ + 'dialect' => 'mysql', + 'host' => '127.0.0.1', + 'port' => '3306', + 'database' => 'test', + 'username' => 'guest', + 'password' => '', + 'extra' => { 'charset' => 'utf-8' } + }).and_return('mysql://guest@127.0.0.1:3306/test?charset=utf-8') + end + end +end diff --git a/deployment_scripts/puppet/modules/openstacklib/spec/functions/os_transport_url_spec.rb b/deployment_scripts/puppet/modules/openstacklib/spec/functions/os_transport_url_spec.rb new file mode 100644 index 0000000..e23d29c --- /dev/null +++ b/deployment_scripts/puppet/modules/openstacklib/spec/functions/os_transport_url_spec.rb @@ -0,0 +1,324 @@ +require 'spec_helper' + +describe 'os_transport_url' do + + it 'refuses String' do + is_expected.to run.with_params('foo').\ + and_raise_error(Puppet::ParseError, /Requires an hash/) + end + + it 'refuses Array' do + is_expected.to run.with_params(['foo']).\ + and_raise_error(Puppet::ParseError, /Requires an hash/) + end + + it 'refuses without at least one argument' do + is_expected.to run.with_params().\ + and_raise_error(ArgumentError, /Wrong number of arguments/) + end + + it 'refuses too many arguments' do + is_expected.to run.with_params('foo', 'bar').\ + and_raise_error(ArgumentError, /Wrong number of arguments/) + end + + it 'refuses hosts params passed as String' do + is_expected.to run.with_params({ + 'transport'=> 'rabbit', + 'hosts' => '127.0.0.1', + }).and_raise_error(Puppet::ParseError, /hosts should be a Array/) + end + + it 'fails if missing host' do + is_expected.to run.with_params({ + 'transport'=> 'rabbit', + }).and_raise_error(Puppet::ParseError, /host or hosts is required/) + end + + context 'creates the correct transport URI' do + + it 'with a single host array for hosts' do + is_expected.to run.with_params({ + 'transport' => 'rabbit', + 'hosts' => [ '127.0.0.1' ], + 'port' => '5672', + 'username' => 'guest', + 'password' => 's3cr3t', + 'virtual_host' => 'virt', + 'ssl' => '1', + 'query' => { 'read_timeout' => '60' }, + }).and_return('rabbit://guest:s3cr3t@127.0.0.1:5672/virt?read_timeout=60&ssl=1') + end + + it 'with a single host array for hosts and integer port' do + is_expected.to run.with_params({ + 'transport' => 'rabbit', + 'hosts' => [ '127.0.0.1' ], + 'port' => 5672, + 'username' => 'guest', + 'password' => 's3cr3t', + 'virtual_host' => 'virt', + 'ssl' => '1', + 'query' => { 'read_timeout' => '60' }, + }).and_return('rabbit://guest:s3cr3t@127.0.0.1:5672/virt?read_timeout=60&ssl=1') + end + + it 'with all params for a single host' do + is_expected.to run.with_params({ + 'transport' => 'rabbit', + 'host' => '127.0.0.1', + 'port' => '5672', + 'username' => 'guest', + 'password' => 's3cr3t', + 'virtual_host' => 'virt', + 'ssl' => '1', + 'query' => { 'read_timeout' => '60' }, + }).and_return('rabbit://guest:s3cr3t@127.0.0.1:5672/virt?read_timeout=60&ssl=1') + end + + it 'with all params for a single host and integer port' do + is_expected.to run.with_params({ + 'transport' => 'rabbit', + 'host' => '127.0.0.1', + 'port' => 5672, + 'username' => 'guest', + 'password' => 's3cr3t', + 'virtual_host' => 'virt', + 'ssl' => '1', + 'query' => { 'read_timeout' => '60' }, + }).and_return('rabbit://guest:s3cr3t@127.0.0.1:5672/virt?read_timeout=60&ssl=1') + end + + it 'with only required params for a single host' do + is_expected.to run.with_params({ + 'transport' => 'rabbit', + 'host' => '127.0.0.1', + }).and_return('rabbit://127.0.0.1/') + end + + it 'with a single ipv6 address' do + is_expected.to run.with_params({ + 'transport' => 'rabbit', + 'host' => 'fe80::ca5b:76ff:fe4b:be3b', + 'port' => '5672', + }).and_return('rabbit://[fe80::ca5b:76ff:fe4b:be3b]:5672/') + end + + it 'with a single ipv6 address and integer port' do + is_expected.to run.with_params({ + 'transport' => 'rabbit', + 'host' => 'fe80::ca5b:76ff:fe4b:be3b', + 'port' => 5672, + }).and_return('rabbit://[fe80::ca5b:76ff:fe4b:be3b]:5672/') + end + + it 'with all params with multiple hosts' do + is_expected.to run.with_params({ + 'transport' => 'rabbit', + 'hosts' => ['1.1.1.1', '2.2.2.2'], + 'port' => '5672', + 'username' => 'guest', + 'password' => 's3cr3t', + 'virtual_host' => 'virt', + 'query' => { 'read_timeout' => '60' }, + }).and_return('rabbit://guest:s3cr3t@1.1.1.1:5672,guest:s3cr3t@2.2.2.2:5672/virt?read_timeout=60') + end + + it 'with all params with multiple hosts and integer port' do + is_expected.to run.with_params({ + 'transport' => 'rabbit', + 'hosts' => ['1.1.1.1', '2.2.2.2'], + 'port' => 5672, + 'username' => 'guest', + 'password' => 's3cr3t', + 'virtual_host' => 'virt', + 'query' => { 'read_timeout' => '60' }, + }).and_return('rabbit://guest:s3cr3t@1.1.1.1:5672,guest:s3cr3t@2.2.2.2:5672/virt?read_timeout=60') + end + + it 'with only required params for multiple hosts' do + is_expected.to run.with_params({ + 'transport' => 'rabbit', + 'hosts' => [ '1.1.1.1', '2.2.2.2' ], + 'port' => '5672', + 'username' => 'guest', + 'password' => 's3cr3t', + }).and_return('rabbit://guest:s3cr3t@1.1.1.1:5672,guest:s3cr3t@2.2.2.2:5672/') + end + + it 'with multiple ipv6 hosts' do + is_expected.to run.with_params({ + 'transport' => 'rabbit', + 'hosts' => [ 'fe80::ca5b:76ff:fe4b:be3b', 'fe80::ca5b:76ff:fe4b:be3c' ], + 'port' => '5672', + 'username' => 'guest', + 'password' => 's3cr3t', + }).and_return('rabbit://guest:s3cr3t@[fe80::ca5b:76ff:fe4b:be3b]:5672,guest:s3cr3t@[fe80::ca5b:76ff:fe4b:be3c]:5672/') + end + + it 'with a mix of ipv4 and ipv6 hosts' do + is_expected.to run.with_params({ + 'transport' => 'rabbit', + 'hosts' => [ 'fe80::ca5b:76ff:fe4b:be3b', '1.1.1.1' ], + 'port' => '5672', + 'username' => 'guest', + 'password' => 's3cr3t', + }).and_return('rabbit://guest:s3cr3t@[fe80::ca5b:76ff:fe4b:be3b]:5672,guest:s3cr3t@1.1.1.1:5672/') + end + + it 'without port' do + is_expected.to run.with_params({ + 'transport' => 'rabbit', + 'host' => '127.0.0.1', + 'username' => 'guest', + 'password' => 's3cr3t', + 'virtual_host' => 'virt', + 'query' => { 'read_timeout' => '60' }, + }).and_return('rabbit://guest:s3cr3t@127.0.0.1/virt?read_timeout=60') + end + + it 'without port and query' do + is_expected.to run.with_params({ + 'transport' => 'rabbit', + 'host' => '127.0.0.1', + 'username' => 'guest', + 'password' => 's3cr3t', + 'virtual_host' => 'virt', + }).and_return('rabbit://guest:s3cr3t@127.0.0.1/virt') + end + + it 'without username and password' do + is_expected.to run.with_params({ + 'transport' => 'rabbit', + 'host' => '127.0.0.1', + 'port' => '5672', + 'virtual_host' => 'virt', + 'query' => { 'read_timeout' => '60' }, + }).and_return('rabbit://127.0.0.1:5672/virt?read_timeout=60') + end + + it 'with username set to undef' do + is_expected.to run.with_params({ + 'transport' => 'rabbit', + 'host' => '127.0.0.1', + 'port' => '5672', + 'username' => :undef, + 'virtual_host' => 'virt', + 'query' => { 'read_timeout' => '60' }, + }).and_return('rabbit://127.0.0.1:5672/virt?read_timeout=60') + end + + it 'with username set to an empty string' do + is_expected.to run.with_params({ + 'transport' => 'rabbit', + 'host' => '127.0.0.1', + 'port' => '5672', + 'username' => '', + 'virtual_host' => 'virt', + 'query' => { 'read_timeout' => '60' }, + }).and_return('rabbit://127.0.0.1:5672/virt?read_timeout=60') + end + + it 'without password' do + is_expected.to run.with_params({ + 'transport' => 'rabbit', + 'host' => '127.0.0.1', + 'port' => '5672', + 'username' => 'guest', + 'virtual_host' => 'virt', + 'query' => { 'read_timeout' => '60' }, + }).and_return('rabbit://guest@127.0.0.1:5672/virt?read_timeout=60') + end + + it 'with password set to undef' do + is_expected.to run.with_params({ + 'transport' => 'rabbit', + 'host' => '127.0.0.1', + 'port' => '5672', + 'username' => 'guest', + 'password' => :undef, + 'virtual_host' => 'virt', + 'query' => { 'read_timeout' => '60' }, + }).and_return('rabbit://guest@127.0.0.1:5672/virt?read_timeout=60') + end + + it 'with password set to an empty string' do + is_expected.to run.with_params({ + 'transport' => 'rabbit', + 'host' => '127.0.0.1', + 'port' => '5672', + 'username' => 'guest', + 'password' => '', + 'virtual_host' => 'virt', + 'query' => { 'read_timeout' => '60' }, + }).and_return('rabbit://guest@127.0.0.1:5672/virt?read_timeout=60') + end + + it 'with ssl overrides ssl in quert hash' do + is_expected.to run.with_params({ + 'transport' => 'rabbit', + 'host' => '127.0.0.1', + 'port' => '5672', + 'username' => 'guest', + 'password' => '', + 'virtual_host' => 'virt', + 'ssl' => '1', + 'query' => { 'read_timeout' => '60' , 'ssl' => '0'}, + }).and_return('rabbit://guest@127.0.0.1:5672/virt?read_timeout=60&ssl=1') + end + + it 'with ssl as boolean string' do + is_expected.to run.with_params({ + 'transport' => 'rabbit', + 'host' => '127.0.0.1', + 'port' => '5672', + 'username' => 'guest', + 'password' => '', + 'virtual_host' => 'virt', + 'ssl' => 'true', + 'query' => { 'read_timeout' => '60' }, + }).and_return('rabbit://guest@127.0.0.1:5672/virt?read_timeout=60&ssl=1') + is_expected.to run.with_params({ + 'transport' => 'rabbit', + 'host' => '127.0.0.1', + 'port' => '5672', + 'username' => 'guest', + 'password' => '', + 'virtual_host' => 'virt', + 'ssl' => 'false', + 'query' => { 'read_timeout' => '60' }, + }).and_return('rabbit://guest@127.0.0.1:5672/virt?read_timeout=60&ssl=0') + is_expected.to run.with_params({ + 'transport' => 'rabbit', + 'host' => '127.0.0.1', + 'port' => '5672', + 'username' => 'guest', + 'password' => '', + 'virtual_host' => 'virt', + 'ssl' => 'True', + 'query' => { 'read_timeout' => '60' }, + }).and_return('rabbit://guest@127.0.0.1:5672/virt?read_timeout=60&ssl=1') + is_expected.to run.with_params({ + 'transport' => 'rabbit', + 'host' => '127.0.0.1', + 'port' => '5672', + 'username' => 'guest', + 'password' => '', + 'virtual_host' => 'virt', + 'ssl' => 'False', + 'query' => { 'read_timeout' => '60' }, + }).and_return('rabbit://guest@127.0.0.1:5672/virt?read_timeout=60&ssl=0') + end + + it 'with alternative transport and single host array for hosts' do + is_expected.to run.with_params({ + 'transport' => 'amqp', + 'hosts' => [ '127.0.0.1' ], + 'port' => '5672', + 'username' => 'guest', + 'password' => 's3cr3t', + }).and_return('amqp://guest:s3cr3t@127.0.0.1:5672/') + end + + end +end diff --git a/deployment_scripts/puppet/modules/openstacklib/spec/shared_examples.rb b/deployment_scripts/puppet/modules/openstacklib/spec/shared_examples.rb new file mode 100644 index 0000000..fec0eac --- /dev/null +++ b/deployment_scripts/puppet/modules/openstacklib/spec/shared_examples.rb @@ -0,0 +1,5 @@ +shared_examples_for "a Puppet::Error" do |description| + it "with message matching #{description.inspect}" do + expect { is_expected.to have_class_count(1) }.to raise_error(Puppet::Error, description) + end +end diff --git a/deployment_scripts/puppet/modules/openstacklib/spec/spec_helper.rb b/deployment_scripts/puppet/modules/openstacklib/spec/spec_helper.rb new file mode 100644 index 0000000..cad00b1 --- /dev/null +++ b/deployment_scripts/puppet/modules/openstacklib/spec/spec_helper.rb @@ -0,0 +1,10 @@ +require 'puppetlabs_spec_helper/module_spec_helper' +require 'shared_examples' +require 'puppet-openstack_spec_helper/facts' + +RSpec.configure do |c| + c.alias_it_should_behave_like_to :it_configures, 'configures' + c.alias_it_should_behave_like_to :it_raises, 'raises' +end + +at_exit { RSpec::Puppet::Coverage.report! } diff --git a/deployment_scripts/puppet/modules/openstacklib/spec/spec_helper_acceptance.rb b/deployment_scripts/puppet/modules/openstacklib/spec/spec_helper_acceptance.rb new file mode 100644 index 0000000..9196bc9 --- /dev/null +++ b/deployment_scripts/puppet/modules/openstacklib/spec/spec_helper_acceptance.rb @@ -0,0 +1 @@ +require 'puppet-openstack_spec_helper/beaker_spec_helper' diff --git a/deployment_scripts/puppet/modules/openstacklib/spec/unit/provider/openstack/auth_spec.rb b/deployment_scripts/puppet/modules/openstacklib/spec/unit/provider/openstack/auth_spec.rb new file mode 100644 index 0000000..413c81a --- /dev/null +++ b/deployment_scripts/puppet/modules/openstacklib/spec/unit/provider/openstack/auth_spec.rb @@ -0,0 +1,241 @@ +require 'puppet' +require 'spec_helper' +require 'puppet/provider/openstack' +require 'puppet/provider/openstack/auth' +require 'tempfile' + +class Puppet::Provider::Openstack::AuthTester < Puppet::Provider::Openstack + extend Puppet::Provider::Openstack::Auth +end + +klass = Puppet::Provider::Openstack::AuthTester + +describe Puppet::Provider::Openstack::Auth do + + let(:type) do + Puppet::Type.newtype(:test_resource) do + newparam(:name, :namevar => true) + newparam(:log_file) + end + end + + let(:resource_attrs) do + { + :name => 'stubresource' + } + end + + let(:provider) do + klass.new(type.new(resource_attrs)) + end + + before(:each) do + ENV['OS_USERNAME'] = nil + ENV['OS_PASSWORD'] = nil + ENV['OS_PROJECT_NAME'] = nil + ENV['OS_AUTH_URL'] = nil + ENV['OS_TOKEN'] = nil + ENV['OS_URL'] = nil + end + + describe '#set_credentials' do + it 'adds keys to the object' do + credentials = Puppet::Provider::Openstack::CredentialsV2_0.new + set = { 'OS_USERNAME' => 'user', + 'OS_PASSWORD' => 'secret', + 'OS_PROJECT_NAME' => 'tenant', + 'OS_AUTH_URL' => 'http://127.0.0.1:5000', + 'OS_TOKEN' => 'token', + 'OS_URL' => 'http://127.0.0.1:35357', + 'OS_IDENTITY_API_VERSION' => '2.0', + 'OS_NOT_VALID' => 'notvalid' + } + klass.set_credentials(credentials, set) + expect(credentials.to_env).to eq( + "OS_AUTH_URL" => "http://127.0.0.1:5000", + "OS_IDENTITY_API_VERSION" => '2.0', + "OS_PASSWORD" => "secret", + "OS_PROJECT_NAME" => "tenant", + "OS_TOKEN" => "token", + "OS_URL" => "http://127.0.0.1:35357", + "OS_USERNAME" => "user") + end + end + + describe '#rc_filename' do + it 'returns RCFILENAME' do + expect(klass.rc_filename).to eq("#{ENV['HOME']}/openrc") + end + end + + describe '#get_os_from_env' do + context 'with Openstack environment variables set' do + it 'provides a hash' do + ENV['OS_AUTH_URL'] = 'http://127.0.0.1:5000' + ENV['OS_PASSWORD'] = 'abc123' + ENV['OS_PROJECT_NAME'] = 'test' + ENV['OS_USERNAME'] = 'test' + response = klass.get_os_vars_from_env + expect(response).to eq({ + "OS_AUTH_URL" => "http://127.0.0.1:5000", + "OS_PASSWORD" => "abc123", + "OS_PROJECT_NAME" => "test", + "OS_USERNAME" => "test"}) + end + end + end + + describe '#get_os_vars_from_rcfile' do + context 'with a valid RC file' do + it 'provides a hash' do + mock = "export OS_USERNAME='test'\nexport OS_PASSWORD='abc123'\nexport OS_PROJECT_NAME='test'\nexport OS_AUTH_URL='http://127.0.0.1:5000'" + filename = 'file' + File.expects(:exists?).with('file').returns(true) + File.expects(:open).with('file').returns(StringIO.new(mock)) + + response = klass.get_os_vars_from_rcfile(filename) + expect(response).to eq({ + "OS_AUTH_URL" => "http://127.0.0.1:5000", + "OS_PASSWORD" => "abc123", + "OS_PROJECT_NAME" => "test", + "OS_USERNAME" => "test"}) + end + end + + context 'with an empty file' do + it 'provides an empty hash' do + filename = 'file' + File.expects(:exists?).with(filename).returns(true) + File.expects(:open).with(filename).returns(StringIO.new("")) + + response = klass.get_os_vars_from_rcfile(filename) + expect(response).to eq({}) + end + end + + context 'with a nonexistent file' do + it 'should get default rcfile when no environment or openrc file' do + ENV.clear + mock = "export OS_USERNAME='user'\nexport OS_PASSWORD='secret'\nexport OS_PROJECT_NAME='project'\nexport OS_AUTH_URL='http://127.0.0.1:5000'" + filename = '/root/openrc' + + File.expects(:exists?).with("#{ENV['HOME']}/openrc").returns(false) + File.expects(:exists?).with(filename).returns(true) + File.expects(:open).with(filename).returns(StringIO.new(mock)) + + expect(klass.get_os_vars_from_rcfile("#{ENV['HOME']}/openrc")).to eq({ + 'OS_USERNAME' => 'user', + 'OS_PASSWORD' => 'secret', + 'OS_PROJECT_NAME' => 'project', + 'OS_AUTH_URL' => 'http://127.0.0.1:5000' + }) + end + end + end + + before(:each) do + class Puppet::Provider::Openstack::AuthTester + @credentials = Puppet::Provider::Openstack::CredentialsV2_0.new + end + end + + describe '#request' do + context 'with no valid credentials' do + it 'fails to authenticate' do + expect { klass.request('project', 'list', ['--long']) }.to raise_error(Puppet::Error::OpenstackAuthInputError, "Insufficient credentials to authenticate") + expect(klass.instance_variable_get(:@credentials).to_env).to eq({}) + end + end + + context 'with user credentials in env' do + it 'is successful' do + klass.expects(:get_os_vars_from_env) + .returns({ 'OS_USERNAME' => 'test', + 'OS_PASSWORD' => 'abc123', + 'OS_PROJECT_NAME' => 'test', + 'OS_AUTH_URL' => 'http://127.0.0.1:5000', + 'OS_NOT_VALID' => 'notvalid' }) + klass.expects(:openstack) + .with('project', 'list', '--quiet', '--format', 'csv', ['--long']) + .returns('"ID","Name","Description","Enabled" +"1cb05cfed7c24279be884ba4f6520262","test","Test tenant",True +') + response = klass.request('project', 'list', ['--long']) + expect(response.first[:description]).to eq("Test tenant") + expect(klass.instance_variable_get(:@credentials).to_env).to eq({ + 'OS_USERNAME' => 'test', + 'OS_PASSWORD' => 'abc123', + 'OS_PROJECT_NAME' => 'test', + 'OS_AUTH_URL' => 'http://127.0.0.1:5000' + }) + end + end + + context 'with service token credentials in env' do + it 'is successful' do + klass.expects(:get_os_vars_from_env) + .returns({ 'OS_TOKEN' => 'test', + 'OS_URL' => 'http://127.0.0.1:5000', + 'OS_NOT_VALID' => 'notvalid' }) + klass.expects(:openstack) + .with('project', 'list', '--quiet', '--format', 'csv', ['--long']) + .returns('"ID","Name","Description","Enabled" +"1cb05cfed7c24279be884ba4f6520262","test","Test tenant",True +') + response = klass.request('project', 'list', ['--long']) + expect(response.first[:description]).to eq("Test tenant") + expect(klass.instance_variable_get(:@credentials).to_env).to eq({ + 'OS_TOKEN' => 'test', + 'OS_URL' => 'http://127.0.0.1:5000', + }) + end + end + + context 'with a RC file containing user credentials' do + it 'is successful' do + # return incomplete creds from env + klass.expects(:get_os_vars_from_env) + .returns({ 'OS_USERNAME' => 'incompleteusername', + 'OS_AUTH_URL' => 'incompleteauthurl' }) + mock = "export OS_USERNAME='test'\nexport OS_PASSWORD='abc123'\nexport OS_PROJECT_NAME='test'\nexport OS_AUTH_URL='http://127.0.0.1:5000'\nexport OS_NOT_VALID='notvalid'" + File.expects(:exists?).with("#{ENV['HOME']}/openrc").returns(true) + File.expects(:open).with("#{ENV['HOME']}/openrc").returns(StringIO.new(mock)) + klass.expects(:openstack) + .with('project', 'list', '--quiet', '--format', 'csv', ['--long']) + .returns('"ID","Name","Description","Enabled" +"1cb05cfed7c24279be884ba4f6520262","test","Test tenant",True +') + response = provider.class.request('project', 'list', ['--long']) + expect(response.first[:description]).to eq("Test tenant") + expect(klass.instance_variable_get(:@credentials).to_env).to eq({ + 'OS_USERNAME' => 'test', + 'OS_PASSWORD' => 'abc123', + 'OS_PROJECT_NAME' => 'test', + 'OS_AUTH_URL' => 'http://127.0.0.1:5000' + }) + end + end + + context 'with a RC file containing service token credentials' do + it 'is successful' do + # return incomplete creds from env + klass.expects(:get_os_vars_from_env) + .returns({ 'OS_TOKEN' => 'incomplete' }) + mock = "export OS_TOKEN='test'\nexport OS_URL='abc123'\nexport OS_NOT_VALID='notvalid'\n" + File.expects(:exists?).with("#{ENV['HOME']}/openrc").returns(true) + File.expects(:open).with("#{ENV['HOME']}/openrc").returns(StringIO.new(mock)) + klass.expects(:openstack) + .with('project', 'list', '--quiet', '--format', 'csv', ['--long']) + .returns('"ID","Name","Description","Enabled" +"1cb05cfed7c24279be884ba4f6520262","test","Test tenant",True +') + response = klass.request('project', 'list', ['--long']) + expect(response.first[:description]).to eq("Test tenant") + expect(klass.instance_variable_get(:@credentials).to_env).to eq({ + 'OS_TOKEN' => 'test', + 'OS_URL' => 'abc123', + }) + end + end + end +end diff --git a/deployment_scripts/puppet/modules/openstacklib/spec/unit/provider/openstack/credentials_spec.rb b/deployment_scripts/puppet/modules/openstacklib/spec/unit/provider/openstack/credentials_spec.rb new file mode 100644 index 0000000..2a484a2 --- /dev/null +++ b/deployment_scripts/puppet/modules/openstacklib/spec/unit/provider/openstack/credentials_spec.rb @@ -0,0 +1,160 @@ +require 'puppet' +require 'spec_helper' +require 'puppet/provider/openstack' +require 'puppet/provider/openstack/credentials' + + +describe Puppet::Provider::Openstack::Credentials do + + let(:creds) do + creds = Puppet::Provider::Openstack::CredentialsV2_0.new + end + + describe "#set with valid value" do + it 'works with valid value' do + expect(creds.class.defined?('auth_url')).to be_truthy + creds.set('auth_url', 'http://localhost:5000/v2.0') + expect(creds.auth_url).to eq('http://localhost:5000/v2.0') + end + end + + describe "#set with invalid value" do + it 'works with invalid value' do + expect(creds.class.defined?('foo')).to be_falsey + creds.set('foo', 'junk') + expect(creds.respond_to?(:foo)).to be_falsey + expect(creds.instance_variable_defined?(:@foo)).to be_falsey + expect { creds.foo }.to raise_error(NoMethodError, /undefined method/) + end + end + + describe '#service_token_set?' do + context "with service credentials" do + it 'is successful' do + creds.token = 'token' + creds.url = 'url' + expect(creds.service_token_set?).to be_truthy + expect(creds.user_password_set?).to be_falsey + end + + it 'fails' do + creds.token = 'token' + expect(creds.service_token_set?).to be_falsey + expect(creds.user_password_set?).to be_falsey + end + end + end + + describe '#password_set?' do + context "with user credentials" do + it 'is successful' do + creds.auth_url = 'auth_url' + creds.password = 'password' + creds.project_name = 'project_name' + creds.username = 'username' + expect(creds.user_password_set?).to be_truthy + expect(creds.service_token_set?).to be_falsey + end + + it 'fails' do + creds.auth_url = 'auth_url' + creds.password = 'password' + creds.project_name = 'project_name' + expect(creds.user_password_set?).to be_falsey + expect(creds.service_token_set?).to be_falsey + end + end + end + + describe '#set?' do + context "without any credential" do + it 'fails' do + expect(creds.set?).to be_falsey + end + end + end + + describe '#version' do + it 'is version 2' do + expect(creds.version).to eq('2.0') + end + end + + describe '#unset' do + context "with all instance variables set" do + it 'resets all but the identity_api_version' do + creds.auth_url = 'auth_url' + creds.password = 'password' + creds.project_name = 'project_name' + creds.username = 'username' + creds.token = 'token' + creds.url = 'url' + creds.identity_api_version = 'identity_api_version' + creds.unset + expect(creds.auth_url).to eq('') + expect(creds.password).to eq('') + expect(creds.project_name).to eq('') + expect(creds.username).to eq('') + expect(creds.token).to eq('') + expect(creds.url).to eq('') + expect(creds.identity_api_version).to eq('identity_api_version') + newcreds = Puppet::Provider::Openstack::CredentialsV3.new + expect(newcreds.identity_api_version).to eq('3') + end + end + end + + describe '#to_env' do + context "with an exhaustive data set" do + it 'successfully returns content' do + creds.auth_url = 'auth_url' + creds.password = 'password' + creds.project_name = 'project_name' + creds.username = 'username' + creds.token = 'token' + creds.url = 'url' + creds.identity_api_version = 'identity_api_version' + creds.region_name = 'Region1' + expect(creds.to_env).to eq({ + 'OS_USERNAME' => 'username', + 'OS_PASSWORD' => 'password', + 'OS_PROJECT_NAME' => 'project_name', + 'OS_AUTH_URL' => 'auth_url', + 'OS_TOKEN' => 'token', + 'OS_URL' => 'url', + 'OS_IDENTITY_API_VERSION' => 'identity_api_version', + 'OS_REGION_NAME' => 'Region1', + }) + end + end + end + + describe 'using v3' do + let(:creds) do + creds = Puppet::Provider::Openstack::CredentialsV3.new + end + describe 'with v3' do + it 'uses v3 identity api' do + creds.identity_api_version == '3' + end + end + describe '#password_set? with username and project_name' do + it 'is successful' do + creds.auth_url = 'auth_url' + creds.password = 'password' + creds.project_name = 'project_name' + creds.username = 'username' + expect(creds.user_password_set?).to be_truthy + end + end + describe '#password_set? with user_id and project_id' do + it 'is successful' do + creds.auth_url = 'auth_url' + creds.password = 'password' + creds.project_id = 'projid' + creds.user_id = 'userid' + expect(creds.user_password_set?).to be_truthy + end + end + end +end diff --git a/deployment_scripts/puppet/modules/openstacklib/spec/unit/provider/openstack_config/ini_setting_spec.rb b/deployment_scripts/puppet/modules/openstacklib/spec/unit/provider/openstack_config/ini_setting_spec.rb new file mode 100644 index 0000000..33a9645 --- /dev/null +++ b/deployment_scripts/puppet/modules/openstacklib/spec/unit/provider/openstack_config/ini_setting_spec.rb @@ -0,0 +1,113 @@ +# +# these tests are a little concerning b/c they are hacking around the +# modulepath, so these tests will not catch issues that may eventually arise +# related to loading these plugins. +# I could not, for the life of me, figure out how to programatcally set the modulepath +$LOAD_PATH.push( + File.join( + File.dirname(__FILE__), + '..', + '..', + '..', + 'fixtures', + 'modules', + 'inifile', + 'lib') +) +require 'spec_helper' +provider_class = Puppet::Type.type(:openstack_config).provider(:ini_setting) +describe provider_class do + + let(:properties) do + { + :name => 'DEFAULT/foo', + :value => 'bar', + :ensure_absent_val => 'some_value', + :ensure => :present, + } + end + + let(:transform_properties) do + { + :name => 'DEFAULT/foo', + :value => 'bar', + :transform_to => 'upper', + :ensure_absent_val => 'some_value', + :ensure => :present, + } + end + + let(:type) do + Puppet::Type.newtype(:test_config) do + newparam(:name, :namevar => true) + newparam(:ensure) + newproperty(:value) + newparam(:ensure_absent_val) + end + end + + let(:transform_type) do + Puppet::Type.newtype(:test_config) do + newparam(:name, :namevar => true) + newparam(:ensure) + newproperty(:value) + newparam(:ensure_absent_val) + newparam(:transform_to) + end + end + + let(:resource) do + resource = type.new(properties) + resource + end + + let(:transform_resource) do + resource = transform_type.new(transform_properties) + resource + end + + context '#exists?' do + it 'ensure to present' do + child_conf = Class.new(provider_class) do + def self.file_path + '/some/file/path' + end + end + provider = child_conf.new(resource) + provider.exists? + expect(resource[:ensure]).to eq :present + end + + it 'ensure to absent' do + child_conf = Class.new(provider_class) do + def self.file_path + '/some/file/path' + end + end + provider = child_conf.new(resource) + resource[:ensure_absent_val] = 'bar' + provider.exists? + expect(resource[:ensure]).to eq :absent + end + end + + context 'transform_to' do + it 'transforms a property' do + child_conf = Class.new(provider_class) do + def self.file_path + '/some/file/path' + end + + def to_upper(value) + value.upcase! + end + end + provider = child_conf.new(transform_resource) + provider.exists? + provider.transform(:to, transform_resource[:value]) + expect(transform_resource[:value]).to eq 'BAR' + end + + end + +end diff --git a/deployment_scripts/puppet/modules/openstacklib/spec/unit/provider/openstack_spec.rb b/deployment_scripts/puppet/modules/openstacklib/spec/unit/provider/openstack_spec.rb new file mode 100644 index 0000000..375df17 --- /dev/null +++ b/deployment_scripts/puppet/modules/openstacklib/spec/unit/provider/openstack_spec.rb @@ -0,0 +1,182 @@ +require 'puppet' +require 'spec_helper' +require 'puppet/provider/openstack' + +describe Puppet::Provider::Openstack do + before(:each) do + ENV['OS_USERNAME'] = nil + ENV['OS_PASSWORD'] = nil + ENV['OS_PROJECT_NAME'] = nil + ENV['OS_AUTH_URL'] = nil + end + + let(:type) do + Puppet::Type.newtype(:test_resource) do + newparam(:name, :namevar => true) + newparam(:log_file) + end + end + + let(:credentials) do + credentials = mock('credentials') + credentials.stubs(:to_env).returns({ + 'OS_USERNAME' => 'user', + 'OS_PASSWORD' => 'password', + 'OS_PROJECT_NAME' => 'project', + 'OS_AUTH_URL' => 'http://url', + }) + credentials + end + + let(:list_data) do + <<-eos +"ID","Name","Description","Enabled" +"1cb05cfed7c24279be884ba4f6520262","test","Test tenant",True + eos + end + + let(:show_data) do + <<-eos +description="Test tenant" +enabled="True" +id="1cb05cfed7c24279be884ba4f6520262" +name="test" + eos + end + + describe '#request' do + let(:resource_attrs) do + { + :name => 'stubresource', + } + end + + let(:provider) do + Puppet::Provider::Openstack.new(type.new(resource_attrs)) + end + + it 'makes a successful list request' do + provider.class.expects(:openstack) + .with('project', 'list', '--quiet', '--format', 'csv', ['--long']) + .returns list_data + response = Puppet::Provider::Openstack.request('project', 'list', ['--long']) + expect(response.first[:description]).to eq 'Test tenant' + end + + it 'makes a successful show request' do + provider.class.expects(:openstack) + .with('project', 'show', '--format', 'shell', ['1cb05cfed7c24279be884ba4f6520262']) + .returns show_data + response = Puppet::Provider::Openstack.request('project', 'show', ['1cb05cfed7c24279be884ba4f6520262']) + expect(response[:description]).to eq 'Test tenant' + end + + it 'makes a successful set request' do + provider.class.expects(:openstack) + .with('project', 'set', ['--name', 'new name', '1cb05cfed7c24279be884ba4f6520262']) + .returns '' + response = Puppet::Provider::Openstack.request('project', 'set', ['--name', 'new name', '1cb05cfed7c24279be884ba4f6520262']) + expect(response).to eq '' + end + + it 'uses provided credentials' do + Puppet::Util.expects(:withenv).with(credentials.to_env) + Puppet::Provider::Openstack.request('project', 'list', ['--long'], credentials) + end + + context 'on connection errors' do + it 'retries the failed command' do + provider.class.stubs(:openstack) + .with('project', 'list', '--quiet', '--format', 'csv', ['--long']) + .raises(Puppet::ExecutionFailure, 'Unable to establish connection') + .then + .returns list_data + provider.class.expects(:sleep).with(3).returns(nil) + response = Puppet::Provider::Openstack.request('project', 'list', ['--long']) + expect(response.first[:description]).to eq 'Test tenant' + end + + it 'fails after the timeout' do + provider.class.expects(:openstack) + .with('project', 'list', '--quiet', '--format', 'csv', ['--long']) + .raises(Puppet::ExecutionFailure, 'Unable to establish connection') + .times(3) + provider.class.stubs(:sleep) + provider.class.stubs(:current_time) + .returns(0, 10, 10, 20, 20, 200, 200) + expect do + Puppet::Provider::Openstack.request('project', 'list', ['--long']) + end.to raise_error Puppet::ExecutionFailure, /Unable to establish connection/ + end + + it 'does not retry non-idempotent commands' do + provider.class.expects(:openstack) + .with('project', 'create', '--format', 'shell', ['--quiet']) + .raises(Puppet::ExecutionFailure, 'Unable to establish connection') + .then + .returns list_data + provider.class.expects(:sleep).never + expect do + Puppet::Provider::Openstack.request('project', 'create', ['--quiet']) + end.to raise_error Puppet::ExecutionFailure, /Unable to establish connection/ + end + + end + + context 'catch unauthorized errors' do + it 'should raise an error with non-existent user' do + ENV['OS_USERNAME'] = 'test' + ENV['OS_PASSWORD'] = 'abc123' + ENV['OS_PROJECT_NAME'] = 'test' + ENV['OS_AUTH_URL'] = 'http://127.0.0.1:5000' + provider.class.stubs(:openstack) + .with('project', 'list', '--quiet', '--format', 'csv', ['--long']) + .raises(Puppet::ExecutionFailure, 'Could not find user: test (HTTP 401)') + expect do + Puppet::Provider::Openstack.request('project', 'list', ['--long']) + end.to raise_error(Puppet::Error::OpenstackUnauthorizedError, /Could not authenticate/) + end + + it 'should raise an error with not authorized to perform' do + provider.class.stubs(:openstack) + .with('role', 'list', '--quiet', '--format', 'csv', ['--long']) + .raises(Puppet::ExecutionFailure, 'You are not authorized to perform the requested action: identity:list_grants (HTTP 403)') + expect do + Puppet::Provider::Openstack.request('role', 'list', ['--long']) + end.to raise_error(Puppet::Error::OpenstackUnauthorizedError, /Could not authenticate/) + end + end + end + + describe 'parse_csv' do + context 'with mixed stderr' do + text = "ERROR: Testing\n\"field\",\"test\",1,2,3\n" + csv = Puppet::Provider::Openstack.parse_csv(text) + it 'should ignore non-CSV text at the beginning of the input' do + expect(csv).to be_kind_of(Array) + expect(csv[0]).to match_array(%w(field test 1 2 3)) + expect(csv.size).to eq(1) + end + end + + context 'with \r\n line endings' do + text = "ERROR: Testing\r\n\"field\",\"test\",1,2,3\r\n" + csv = Puppet::Provider::Openstack.parse_csv(text) + it 'ignore the carriage returns' do + expect(csv).to be_kind_of(Array) + expect(csv[0]).to match_array(%w(field test 1 2 3)) + expect(csv.size).to eq(1) + end + end + + context 'with embedded newlines' do + text = "ERROR: Testing\n\"field\",\"te\nst\",1,2,3\n" + csv = Puppet::Provider::Openstack.parse_csv(text) + it 'should parse correctly' do + expect(csv).to be_kind_of(Array) + expect(csv[0]).to match_array(['field', "te\nst", '1', '2', '3']) + expect(csv.size).to eq(1) + end + end + end +end diff --git a/deployment_scripts/puppet/modules/openstacklib/spec/unit/provider/policy_rcd/policy_rcd_spec.rb b/deployment_scripts/puppet/modules/openstacklib/spec/unit/provider/policy_rcd/policy_rcd_spec.rb new file mode 100644 index 0000000..396f96a --- /dev/null +++ b/deployment_scripts/puppet/modules/openstacklib/spec/unit/provider/policy_rcd/policy_rcd_spec.rb @@ -0,0 +1,137 @@ +require 'puppet' +require 'spec_helper' +require 'puppet/provider/policy_rcd/policy_rcd' +require 'tempfile' + +provider_class = Puppet::Type.type(:policy_rcd).provider(:policy_rcd) + +describe provider_class do + let(:attributes) do { + :name => 'service', + :set_code => '101' + } + end + + let(:resource) do + Puppet::Type::Policy_rcd.new(attributes) + end + + let(:provider) do + resource.provider + end + + let(:header) do + "#!/bin/bash\n# THIS FILE MANAGED BY PUPPET\n" + end + + describe 'managing policy' do + describe '#create' do + it 'creates a policy when policy-rc.d doesnt exist' do + file = mock('file') + provider.stubs(:policy_rcd).returns(file) + File.expects(:exist?).with(file).returns(false) + content = "#{header}[[ \"$1\" == \"service\" ]] && exit 101\n" + provider.class.expects(:write_to_file).with(file, content) + provider.create + end + + it 'creates a policy when policy-rc.d exists' do + file = mock('file') + provider.stubs(:policy_rcd).returns(file) + File.expects(:exist?).with(file).returns(true) + content = "[[ \"$1\" == \"service\" ]] && exit 101\n" + provider.class.expects(:write_to_file).with(file, content) + provider.create + end + end + + describe '#destroy' do + it 'destroy a policy' do + file = mock('file') + file_content = "#{header}[[ \"$1\" == \"service\" ]] && exit 101\n" + provider.stubs(:policy_rcd).returns(file) + File.expects(:exist?).with(file).returns(true) + provider.stubs(:file_lines).returns(file_content.split("\n")) + provider.class.expects(:write_to_file).with(file, ['#!/bin/bash', '# THIS FILE MANAGED BY PUPPET'], true) + provider.destroy + end + end + + describe '#flush' do + it 'update a policy' do + file = mock('file') + provider.stubs(:policy_rcd).returns(file) + file_content = "#{header}[[ \"$1\" == \"service\" ]] && exit 102\n" + provider.stubs(:file_lines).returns(file_content.split("\n")) + provider.class.expects(:write_to_file).with(file, ['#!/bin/bash', "# THIS FILE MANAGED BY PUPPET", "[[ \"$1\" == \"service\" ]] && exit 101\n"], true) + provider.flush + end + + it 'dont update a policy' do + file = mock('file') + file_content = "#{header}[[ \"$1\" == \"service\" ]] && exit 101\n" + provider.stubs(:policy_rcd).returns(file) + provider.stubs(:file_lines).returns(file_content.split("\n")) + provider.flush + end + end + + describe '#exists?' do + it 'should exists on Debian family' do + provider.stubs(:check_os).returns(true) + file = mock('file') + file_content = "#{header}[[ \"$1\" == \"service\" ]] && exit 101\n" + provider.stubs(:policy_rcd).returns(file) + provider.stubs(:check_policy_rcd).returns(true) + provider.stubs(:file_lines).returns(file_content.split("\n")) + expect(provider.exists?).to be_truthy + end + + it 'should not exists on Debian family when file is present' do + provider.stubs(:check_os).returns(true) + file = mock('file') + file_content = "#{header}[[ \"$1\" == \"new-service\" ]] && exit 101\n" + provider.stubs(:policy_rcd).returns(file) + provider.stubs(:check_policy_rcd).returns(true) + provider.stubs(:file_lines).returns(file_content.split("\n")) + expect(provider.exists?).to be_falsey + end + + it 'should not exists on Debian family when file is not present' do + provider.stubs(:check_os).returns(true) + provider.stubs(:check_policy_rcd).returns(false) + expect(provider.exists?).to be_falsey + end + + it 'should exists on non-Debian family' do + provider.stubs(:check_os).returns(false) + expect(provider.exists?).to be_truthy + end + end + + describe 'write_to_file' do + it 'should write to file' do + file = mock + policy = mock + content = 'some_content' + File.expects(:open).with(file, 'a+').returns(policy) + policy.expects(:puts).with(content) + policy.expects(:close) + File.expects(:chmod).with(0744, file) + provider.class.write_to_file(file, content) + end + + it 'should truncate file' do + file = mock + policy = mock + content = 'some_content' + File.expects(:truncate).with(file, 0) + File.expects(:open).with(file, 'a+').returns(policy) + policy.expects(:puts).with(content) + policy.expects(:close) + File.expects(:chmod).with(0744, file) + provider.class.write_to_file(file, content, true) + end + end + end +end diff --git a/deployment_scripts/puppet/modules/openstacklib/spec/unit/puppet/util/openstackconfig_spec.rb b/deployment_scripts/puppet/modules/openstacklib/spec/unit/puppet/util/openstackconfig_spec.rb new file mode 100644 index 0000000..7579483 --- /dev/null +++ b/deployment_scripts/puppet/modules/openstacklib/spec/unit/puppet/util/openstackconfig_spec.rb @@ -0,0 +1,322 @@ + +# +# Forked from https://github.com/puppetlabs/puppetlabs-inifile . +# + +require 'spec_helper' +require 'puppet/util/openstackconfig' + + +describe Puppet::Util::OpenStackConfig do + include PuppetlabsSpec::Files + + let(:subject) do + Puppet::Util::OpenStackConfig.new("/my/config/path") + end + + before :each do + Puppet::Util::OpenStackConfig.stubs(:readlines).returns(sample_content) + end + + context "when parsing a file" do + let(:sample_content) { + template = <<-EOS +# This is a comment +[section1] +; This is also a comment +foo=foovalue + +bar = barvalue +baz = +[section2] + +foo= foovalue2 +baz=bazvalue + ; commented = out setting + #another comment + ; yet another comment + zot = multi word value + xyzzy['thing1']['thing2']=xyzzyvalue + l=git log + + [section3] + multi_setting = value1 + multi_setting = value2 + EOS + template.split("\n") + } + + it "should parse the correct number of sections" do + # there is always a "global" section, so our count should be 3. + subject.section_names.length.should == 4 + end + + it "should parse the correct section_names" do + # there should always be a "global" section named "" at the beginning of the list + subject.section_names.should == ["", "section1", "section2", "section3"] + end + + it "should expose settings for sections" do + subject.get_settings("section1").should == { + "bar" => "barvalue", + "baz" => "", + "foo" => "foovalue" + } + + subject.get_settings("section2").should == { + "baz" => "bazvalue", + "foo" => "foovalue2", + "l" => "git log", + "xyzzy['thing1']['thing2']" => "xyzzyvalue", + "zot" => "multi word value" + } + + subject.get_settings("section3").should == { + "multi_setting" => ["value1", "value2"] + } + end + + end + + context "when parsing a file whose first line is a section" do + let(:sample_content) { + template = <<-EOS +[section1] +; This is a comment +foo=foovalue + EOS + template.split("\n") + } + + it "should parse the correct number of sections" do + # there is always a "global" section, so our count should be 2. + subject.section_names.length.should == 2 + end + + it "should parse the correct section_names" do + # there should always be a "global" section named "" at the beginning of the list + subject.section_names.should == ["", "section1"] + end + + it "should expose settings for sections" do + subject.get_value("section1", "foo").should == "foovalue" + end + + end + + context "when parsing a file with a 'global' section" do + let(:sample_content) { + template = <<-EOS +foo = bar +[section1] +; This is a comment +foo=foovalue + EOS + template.split("\n") + } + + it "should parse the correct number of sections" do + # there is always a "global" section, so our count should be 2. + subject.section_names.length.should == 2 + end + + it "should parse the correct section_names" do + # there should always be a "global" section named "" at the beginning of the list + subject.section_names.should == ["", "section1"] + end + + it "should expose settings for sections" do + subject.get_value("", "foo").should == "bar" + subject.get_value("section1", "foo").should == "foovalue" + end + end + + context "when updating a file with existing empty values" do + let(:sample_content) { + template = <<-EOS +[section1] +foo= +#bar= +#xyzzy['thing1']['thing2']='xyzzyvalue' + EOS + template.split("\n") + } + + it "should properly update uncommented values" do + subject.get_value("section1", "far").should == nil + subject.set_value("section1", "foo", "foovalue") + subject.get_value("section1", "foo").should == "foovalue" + end + + it "should properly update commented values" do + subject.get_value("section1", "bar").should == nil + subject.set_value("section1", "bar", "barvalue") + subject.get_value("section1", "bar").should == "barvalue" + subject.get_value("section1", "xyzzy['thing1']['thing2']").should == nil + subject.set_value("section1", "xyzzy['thing1']['thing2']", "xyzzyvalue") + subject.get_value("section1", "xyzzy['thing1']['thing2']").should == "xyzzyvalue" + end + + it "should properly add new empty values" do + subject.get_value("section1", "baz").should == nil + end + end + + context 'the file has quotation marks in its section names' do + let(:sample_content) do + template = <<-EOS +[branch "master"] + remote = origin + merge = refs/heads/master + +[alias] +to-deploy = log --merges --grep='pull request' --format='%s (%cN)' origin/production..origin/master +[branch "production"] + remote = origin + merge = refs/heads/production + EOS + template.split("\n") + end + + it 'should parse the sections' do + subject.section_names.should match_array ['', + 'branch "master"', + 'alias', + 'branch "production"' + ] + end + end + + context 'Samba INI file with dollars in section names' do + let(:sample_content) do + template = <<-EOS + [global] + workgroup = FELLOWSHIP + ; ... + idmap config * : backend = tdb + + [printers] + comment = All Printers + ; ... + browseable = No + + [print$] + comment = Printer Drivers + path = /var/lib/samba/printers + + [Shares] + path = /home/shares + read only = No + guest ok = Yes + EOS + template.split("\n") + end + + it "should parse the correct section_names" do + subject.section_names.should match_array [ + '', + 'global', + 'printers', + 'print$', + 'Shares' + ] + end + end + + context 'section names with forward slashes in them' do + let(:sample_content) do + template = <<-EOS +[monitor:///var/log/*.log] +disabled = test_value + EOS + template.split("\n") + end + + it "should parse the correct section_names" do + subject.section_names.should match_array [ + '', + 'monitor:///var/log/*.log' + ] + end + end + + context 'KDE Configuration with braces in setting names' do + let(:sample_content) do + template = <<-EOS + [khotkeys] +_k_friendly_name=khotkeys +{5465e8c7-d608-4493-a48f-b99d99fdb508}=Print,none,PrintScreen +{d03619b6-9b3c-48cc-9d9c-a2aadb485550}=Search,none,Search +EOS + template.split("\n") + end + + it "should expose settings for sections" do + subject.get_value("khotkeys", "{5465e8c7-d608-4493-a48f-b99d99fdb508}").should == "Print,none,PrintScreen" + subject.get_value("khotkeys", "{d03619b6-9b3c-48cc-9d9c-a2aadb485550}").should == "Search,none,Search" + end + end + + context 'Configuration with colons in setting names' do + let(:sample_content) do + template = <<-EOS + [Drive names] +A:=5.25" Floppy +B:=3.5" Floppy +C:=Winchester +EOS + template.split("\n") + end + + it "should expose settings for sections" do + subject.get_value("Drive names", "A:").should eq '5.25" Floppy' + subject.get_value("Drive names", "B:").should eq '3.5" Floppy' + subject.get_value("Drive names", "C:").should eq 'Winchester' + end + end + + context 'Configuration with spaces in setting names' do + let(:sample_content) do + template = <<-EOS + [global] + # log files split per-machine: + log file = /var/log/samba/log.%m + + kerberos method = system keytab + passdb backend = tdbsam + security = ads +EOS + template.split("\n") + end + + it "should expose settings for sections" do + subject.get_value("global", "log file").should eq '/var/log/samba/log.%m' + subject.get_value("global", "kerberos method").should eq 'system keytab' + subject.get_value("global", "passdb backend").should eq 'tdbsam' + subject.get_value("global", "security").should eq 'ads' + end + end + + + context 'Multi settings' do + let(:sample_content) do + template = <<-EOS + [test] + # multi values + test = value1 + test = value2 + test = value3 +EOS + template.split("\n") + end + + it "should expose setting with array value" do + subject.get_value("test", "test").should eq ['value1', 'value2', 'value3'] + end + + it "should create setting with array value" do + subject.set_value("test", "test2", ['valueA', 'valueB', 'valueC']) + subject.get_value("test", "test2").should eq ['valueA', 'valueB', 'valueC'] + end + end +end diff --git a/deployment_scripts/puppet/modules/openstacklib/spec/unit/type/policy_rcd_spec.rb b/deployment_scripts/puppet/modules/openstacklib/spec/unit/type/policy_rcd_spec.rb new file mode 100644 index 0000000..0c0d7d9 --- /dev/null +++ b/deployment_scripts/puppet/modules/openstacklib/spec/unit/type/policy_rcd_spec.rb @@ -0,0 +1,25 @@ +require 'puppet' +require 'puppet/type/policy_rcd' + +describe Puppet::Type.type(:policy_rcd) do + + before :each do + Puppet::Type.rmtype(:policy_rcd) + end + + it 'should fail with wrong status code' do + incorrect_input = { + :name => 'test_type', + :set_code => '356' + } + expect { Puppet::Type.type(:policy_rcd).new(incorrect_input) }.to raise_error(Puppet::ResourceError, /Unknown exit status code is set/) + end + + it 'should be compiled withour errors' do + correct_input = { + :name => 'test_type', + :set_code => '0' + } + expect { Puppet::Type.type(:policy_rcd).new(correct_input) }.to_not raise_error + end +end diff --git a/deployment_scripts/puppet/modules/openstacklib/templates/policy-rc.d.erb b/deployment_scripts/puppet/modules/openstacklib/templates/policy-rc.d.erb new file mode 100644 index 0000000..ca420a0 --- /dev/null +++ b/deployment_scripts/puppet/modules/openstacklib/templates/policy-rc.d.erb @@ -0,0 +1,8 @@ +#!/bin/bash +<% @services.each do |service| %> +if [ "$1" == "<%= service %>" ] +then + exit 101 +fi +<% end %> + diff --git a/deployment_scripts/puppet/modules/openstacklib/test-requirements.txt b/deployment_scripts/puppet/modules/openstacklib/test-requirements.txt new file mode 100644 index 0000000..1ea50a8 --- /dev/null +++ b/deployment_scripts/puppet/modules/openstacklib/test-requirements.txt @@ -0,0 +1,7 @@ +# This is required for the docs build jobs +sphinx>=1.5.1 # BSD +oslosphinx>=4.7.0 # Apache-2.0 + +# This is required for the releasenotes build jobs +# FIXME: reno is manually pinned to !=2.0.0 because of bug #1651995 +reno>=1.8.0,!=2.0.0 # Apache-2.0 diff --git a/deployment_scripts/puppet/modules/openstacklib/tox.ini b/deployment_scripts/puppet/modules/openstacklib/tox.ini new file mode 100644 index 0000000..aea06c8 --- /dev/null +++ b/deployment_scripts/puppet/modules/openstacklib/tox.ini @@ -0,0 +1,8 @@ +[tox] +minversion = 1.6 +skipsdist = True +envlist = releasenotes + +[testenv:releasenotes] +deps = -rtest-requirements.txt +commands = sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html diff --git a/deployment_scripts/puppet/modules/oslo/.gitignore b/deployment_scripts/puppet/modules/oslo/.gitignore new file mode 100644 index 0000000..15c55ef --- /dev/null +++ b/deployment_scripts/puppet/modules/oslo/.gitignore @@ -0,0 +1,11 @@ +pkg/ +Gemfile.lock +vendor/ +spec/fixtures/ +.vagrant/ +.bundle/ +coverage/ +.idea/ +*.swp +*.iml +openstack/ diff --git a/deployment_scripts/puppet/modules/oslo/.gitreview b/deployment_scripts/puppet/modules/oslo/.gitreview new file mode 100644 index 0000000..a787989 --- /dev/null +++ b/deployment_scripts/puppet/modules/oslo/.gitreview @@ -0,0 +1,4 @@ +[gerrit] +host=review.openstack.org +port=29418 +project=openstack/puppet-oslo.git diff --git a/deployment_scripts/puppet/modules/oslo/Gemfile b/deployment_scripts/puppet/modules/oslo/Gemfile new file mode 100644 index 0000000..1fab608 --- /dev/null +++ b/deployment_scripts/puppet/modules/oslo/Gemfile @@ -0,0 +1,21 @@ +source ENV['GEM_SOURCE'] || "https://rubygems.org" + +group :development, :test, :system_tests do + gem 'puppet-openstack_spec_helper', + :git => 'https://git.openstack.org/openstack/puppet-openstack_spec_helper', + :require => false +end + +if facterversion = ENV['FACTER_GEM_VERSION'] + gem 'facter', facterversion, :require => false +else + gem 'facter', :require => false +end + +if puppetversion = ENV['PUPPET_GEM_VERSION'] + gem 'puppet', puppetversion, :require => false +else + gem 'puppet', :require => false +end + +# vim:ft=ruby diff --git a/deployment_scripts/puppet/modules/oslo/LICENSE b/deployment_scripts/puppet/modules/oslo/LICENSE new file mode 100644 index 0000000..13f6ec4 --- /dev/null +++ b/deployment_scripts/puppet/modules/oslo/LICENSE @@ -0,0 +1,13 @@ +Copyright 2016 OpenStack Foundation + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/deployment_scripts/puppet/modules/oslo/README.md b/deployment_scripts/puppet/modules/oslo/README.md new file mode 100644 index 0000000..49a996c --- /dev/null +++ b/deployment_scripts/puppet/modules/oslo/README.md @@ -0,0 +1,111 @@ +Team and repository tags +======================== + +[![Team and repository tags](http://governance.openstack.org/badges/puppet-oslo.svg)](http://governance.openstack.org/reference/tags/index.html) + + + +oslo +======= + +#### Table of Contents + +1. [Overview - What is the oslo module?](#overview) +2. [Module Description - What does the module do?](#module-description) +3. [Setup - The basics of getting started with oslo](#setup) +4. [Implementation - An under-the-hood peek at what the module is doing](#implementation) +5. [Limitations - OS compatibility, etc.](#limitations) +6. [Development - Guide for contributing to the module](#development) +7. [Contributors - Those with commits](#contributors) + +Overview +-------- + +The oslo module is a part of [OpenStack](https://www.openstack.org), an effort by the OpenStack infrastructure team to provide continuous integration testing and code review for OpenStack and OpenStack community projects not part of the core software. The module its self is used to flexibly configure and manage the FIXME service for OpenStack. + +Module Description +------------------ + +The oslo module is a thorough attempt to make Puppet capable of managing the entirety of oslo libraries. This includes manifests to provision region specific endpoint and database connections. Types are shipped as part of the oslo module to assist in manipulation of configuration files. + +Following versions of oslo libraries are get from requirements.txt in each project. + +| Name | oslo.cache | oslo.config | oslo.concurrency | oslo.context | oslo.db | oslo.log | oslo.messaging | oslo.middleware | oslo.policy | oslo.reports | oslo.rootwrap | oslo.serialization | oslo.utils | oslo.versionedobjects | oslo.service | oslo.i18n | oslo.vmware | +| ---- |:-------:| -----:| -----:| -----:| -----:| -----:| -----:| -----:| -----:| -----:| -----:| -----:| -----:| -----:| -----:| -----:| -----:| +| Aodh | n/a | >=2.6.0 | n/a | >=0.2.0 | >=1.12.0 | >=1.2.0 | !=2.8.0,>2.6.1 | !=2.0.0,>=1.2.0 | >=0.5.0 | n/a | n/a | >=1.4.0 | >=1.9.0 | n/a | >=0.1.0 | >=1.5.0 | n/a | +| Barbican | n/a | >=3.2.0 | >=2.3.0 | >=0.2.0 | n/a | >=1.14.0 | !=2.8.0,!=3.1.0,>2.6.1 | n/a | >=0.5.0 | n/a | n/a | >=1.10.0 | >=3.4.0 | n/a | >=1.0.0 | >=1.5.0 | n/a | +| Cinder | n/a | >=3.2.0 | >=2.3.0 | >=0.2.0 | >=4.1.0 | >=1.14.0 | !=2.8.0,!=3.1.0,>2.6.1 | >=3.0.0 | >=0.5.0 | >=0.6.0 | >=2.0.0 | >=1.10.0 | >=3.2.0 | >=0.13.0 | >=1.0.0 | >=1.5.0 | >=1.16.0 | +| Ceilometer | n/a | >=3.2.0 | >=2.3.0 | >=0.2.0 | >=4.1.0 | >=1.14.0 | !=2.8.0,!=3.1.0,>2.6.1 | >=3.0.0 | >=0.5.0 | >=0.6.0 | >=2.0.0 | >=1.10.0 | >=3.4.0 | n/a | >=1.0.0 | >=1.5.0 | n/a | +| Designate | n/a | >=3.2.0 | >=2.3.0 | >=0.2.0 | >=4.1.0 | >=1.14.0 | !=2.8.0,!=3.1.0,>2.6.1 | >=3.0.0 | >=0.5.0 | >=0.6.0 | >=2.0.0 | >=1.10.0 | >=3.4.0 | n/a | >=1.0.0 | >=1.5.0 | n/a | +| Glance | n/a | >=3.2.0 | >=2.3.0 | >=0.2.0 | >=4.1.0| >=1.14.0 | !=2.8.0,!=3.1.0,>2.6.1 | >=3.0.0 | >=0.5.0 | >=0.6.0 | >=2.0.0 | >=1.10.0 | >=3.2.0 | n/a | >=1.0.0 | >=1.5.0 | n/a | +| Gnocchi | n/a | >=2.6.0 | n/a | n/a | n/a | >=1.0.0 | n/a | ? | >=0.3.0 | n/a | n/a | >=1.4.0 | >=1.6.0 | n/a | n/a | n/a | n/a | +| Heat | >= 0.8.0 | >=3.2.0 | >=2.3.0 | >=0.2.0 | >=4.1.0| >=1.14.0 | !=2.8.0,!=3.1.0,>2.6.1 | >=3.0.0 | >=0.5.0 | >=0.6.0 | >=2.0.0 | >=1.10.0 | >=3.4.0 | >= 0.13.0 | >=1.0.0 | >=1.5.0 | n/a | +| Ironic | n/a | >=3.2.0 | >=2.3.0 | >=0.2.0 | >=4.1.0| >=1.14.0 | !=2.8.0,!=3.1.0,>2.6.1 | >=3.0.0 | >=0.5.0 | >=0.6.0 | >=2.0.0 | >=1.10.0 | >=3.2.0 | >= 0.13.0 | >=1.0.0 | >=1.5.0 | n/a | +| Keystone | >= 0.8.0 | >=3.2.0 | >=2.3.0 | >=0.2.0 | >=4.1.0| >=1.14.0 | !=2.8.0,!=3.1.0,>2.6.1 | >=3.0.0 | >=0.5.0 | >=0.6.0 | >=2.0.0 | >=1.10.0 | >=3.2.0 | n/a | >=1.0.0 | >=1.5.0 | n/a | +| Manila | n/a | >=3.2.0 | >=2.3.0 | >=0.2.0 | >=4.1.0 | >=1.14.0 | !=2.8.0,!=3.1.0,>2.6.1 | >=3.0.0 | >=0.5.0 | >=0.6.0 | >=2.0.0 | >=1.10.0 | >=3.4.0 | n/a | >=1.0.0 | >=1.5.0 | n/a | +| Mistral | n/a | >=3.2.0 | >=2.3.0 | n/a | >=4.1.0 | >=1.14.0 | !=2.8.0,!=3.1.0,>2.6.1 | n/a | n/a | n/a | n/a | >=1.10.0 | >=3.2.0 | n/a | >=1.0.0 | n/a | n/a | +| Murano | n/a | >=3.2.0 | n/a | >=0.2.0 | >=4.1.0 | >=1.14.0 | !=2.8.0,!=3.1.0,>2.6.1 | >=3.0.0 | >=0.5.0 | n/a | n/a | >=1.10.0 | >=3.4.0 | n/a | >=1.0.0 | >=1.5.0 | n/a | +| Neutron | n/a | >=3.2.0 | >=2.3.0 | >=0.2.0 | >=4.1.0 | >=1.14.0 | !=2.8.0,!=3.1.0,>2.6.1 | >=3.0.0 | >=0.5.0 | >=0.6.0 | >=2.0.0 | >=1.10.0 | >=3.4.0 | >= 0.13.0 | >=1.0.0 | >=1.5.0 | n/a | +| Rally | n/a | >=3.2.0 | n/a | >=3.2.0 | >=4.1.0 | >=1.14.0 | n/a | n/a | n/a | n/a | n/a | >=1.10.0 | >=3.4.0 | n/a | n/a | >=1.5.0 | n/a | +| Sahara | n/a | >=3.2.0 | >=2.3.0 | >=0.2.0 | >=4.1.0 | >=1.14.0 | !=2.8.0,!=3.1.0,>2.6.1 | >=3.0.0 | >= 0.5.0 | n/a | >=2.0.0 | >=1.10.0 | >=3.4.0 | n/a | >=1.0.0 | >=1.5.0 | n/a | +| Tempest | n/a | >=3.2.0 | >=2.3.0 | n/a | n/a | >=1.14.0 | n/a | n/a | n/a | n/a | n/a | >=1.10.0 | >=3.2.0 | n/a | >=1.0.0 | >=1.5.0 | n/a | +| Trove | n/a | >=3.2.0 | >=2.3.0 | >=0.2.0 | >=4.1.0 | >=1.14.0 | !=2.8.0,!=3.1.0,>2.6.1 | >=3.0.0 | n/a | n/a | n/a | >=1.10.0 | >=3.4.0 | n/a | >=1.0.0 | >=1.5.0 | n/a | +| Tuskar | n/a | >=2.3.0 | n/a | n/a | >=2.4.1 | n/a | n/a | n/a | n/a | n/a | n/a | n/a | n/a | n/a | n/a | n/a | n/a | +| Swift | n/a | n/a | n/a | n/a | n/a | n/a | n/a | n/a | n/a | n/a | n/a | n/a | n/a | n/a | n/a | n/a | n/a | +| Zaqar | >= 0.8.0 | >=3.2.0 | n/a | >=0.2.0 | n/a | >=1.14.0 | n/a | n/a | >= 0.5.0 | n/a | n/a | >=1.10.0 | >=3.2.0 | n/a | n/a | >=1.5.0 | n/a | + +Setup +----- + +**What the oslo module affects** + +* [Oslo](https://wiki.openstack.org/wiki/Oslo), the FIXME service for OpenStack. + +### Installing oslo + + oslo is not currently in Puppet Forge, but is anticipated to be added soon. Once that happens, you'll be able to install oslo with: + puppet module install openstack/oslo + +### Beginning with oslo + +To utilize the oslo module's functionality you will need to declare multiple resources. + +Implementation +-------------- + +### oslo + +oslo is a combination of Puppet manifest and ruby code to delivery configuration and extra functionality through types and providers. + +Limitations +------------ + +* All the oslo types use the CLI tools and so need to be ran on the oslo node. + +Beaker-Rspec +------------ + +This module has beaker-rspec tests + +To run the tests on the default vagrant node: + +```shell +bundle install +bundle exec rake acceptance +``` + +For more information on writing and running beaker-rspec tests visit the documentation: + +* https://github.com/puppetlabs/beaker-rspec/blob/master/README.md + +Development +----------- + +Developer documentation for the entire puppet-openstack project. + +* http://docs.openstack.org/developer/puppet-openstack-guide/ + +Contributors +------------ + +* https://github.com/openstack/puppet-oslo/graphs/contributors diff --git a/deployment_scripts/puppet/modules/oslo/Rakefile b/deployment_scripts/puppet/modules/oslo/Rakefile new file mode 100644 index 0000000..168d108 --- /dev/null +++ b/deployment_scripts/puppet/modules/oslo/Rakefile @@ -0,0 +1 @@ +require 'puppet-openstack_spec_helper/rake_tasks' diff --git a/deployment_scripts/puppet/modules/oslo/bindep.txt b/deployment_scripts/puppet/modules/oslo/bindep.txt new file mode 100644 index 0000000..e69de29 diff --git a/deployment_scripts/puppet/modules/oslo/lib/puppet/provider/oslo_config/ini_setting.rb b/deployment_scripts/puppet/modules/oslo/lib/puppet/provider/oslo_config/ini_setting.rb new file mode 100644 index 0000000..40a6b37 --- /dev/null +++ b/deployment_scripts/puppet/modules/oslo/lib/puppet/provider/oslo_config/ini_setting.rb @@ -0,0 +1,10 @@ +Puppet::Type.type(:oslo_config).provide( + :ini_setting, + :parent => Puppet::Type.type(:openstack_config).provider(:ini_setting) +) do + + def self.file_path + '/etc/oslo/oslo.conf' + end + +end diff --git a/deployment_scripts/puppet/modules/oslo/lib/puppet/type/oslo_config.rb b/deployment_scripts/puppet/modules/oslo/lib/puppet/type/oslo_config.rb new file mode 100644 index 0000000..0fd9196 --- /dev/null +++ b/deployment_scripts/puppet/modules/oslo/lib/puppet/type/oslo_config.rb @@ -0,0 +1,53 @@ +Puppet::Type.newtype(:oslo_config) do + + ensurable + + newparam(:name, :namevar => true) do + desc 'Section/setting name to manage from oslo.conf' + newvalues(/\S+\/\S+/) + end + + newproperty(:value) do + desc 'The value of the setting to be defined.' + munge do |value| + value = value.to_s.strip + value.capitalize! if value =~ /^(true|false)$/i + value + end + newvalues(/^[\S ]*$/) + + def is_to_s( currentvalue ) + if resource.secret? + return '[old secret redacted]' + else + return currentvalue + end + end + + def should_to_s( newvalue ) + if resource.secret? + return '[new secret redacted]' + else + return newvalue + end + end + end + + newparam(:secret, :boolean => true) do + desc 'Whether to hide the value from Puppet logs. Defaults to `false`.' + + newvalues(:true, :false) + + defaultto false + end + + newparam(:ensure_absent_val) do + desc 'A value that is specified as the value property will behave as if ensure => absent was specified' + defaultto('') + end + + autorequire(:package) do + 'oslo' + end + +end diff --git a/deployment_scripts/puppet/modules/oslo/manifests/cache.pp b/deployment_scripts/puppet/modules/oslo/manifests/cache.pp new file mode 100644 index 0000000..f430e03 --- /dev/null +++ b/deployment_scripts/puppet/modules/oslo/manifests/cache.pp @@ -0,0 +1,182 @@ +# == Define: oslo::cache +# +# Configure oslo.cache options +# +# This resource configures Oslo cache resources for an OpenStack service. +# It will manage the [cache] section in the given config resource. +# It supports all of the oslo.cache parameters specified at +# https://github.com/openstack/oslo.cache/blob/master/oslo_cache/_opts.py +# +# For example, when configuring glance cache, instead of doing this: +# +# glance_api_config { +# 'cache/memcached_servers': value => $memcached_servers; +# 'cache/memcache_dead_retry': value => $memcache_dead_retry; +# ... +# } +# +# manifests should do this instead:: +# +# oslo::cache { 'glance_api_config': +# memcached_servers => $memcached_servers, +# memcache_dead_retry => $memcache_dead_retry, +# ... +# } +# +# or add following code in glance::api: +# +# create_resources(oslo::cache, $cache_config) +# +# Then in hiera should add this: +# +# glance::api::cache_config: +# 'glance_api_config': +# memcached_servers: '127.0.0.1' +# memcache_dead_retry: '100' +# +# === Parameters: +# +# [*config_prefix*] +# (Optional) Prefix for building the configuration dictionary for +# the cache region. This should not need to be changed unless there +# is another dogpile.cache region with the same configuration name. +# (string value) +# Defaults to $::os_service_default +# +# [*expiration_time*] +# (Optional) Default TTL, in seconds, for any cached item in the +# dogpile.cache region. This applies to any cached method that +# doesn't have an explicit cache expiration time defined for it. +# (integer value) +# Defaults to $::os_service_default +# +# [*backend*] +# (Optional) Dogpile.cache backend module. It is recommended that +# Memcache with pooling (oslo_cache.memcache_pool) or Redis +# (dogpile.cache.redis) be used in production deployments. (string value) +# Defaults to $::os_service_default +# +# [*backend_argument*] +# (Optional) Arguments supplied to the backend module. Specify this option +# once per argument to be passed to the dogpile.cache backend. +# Example format: ":". (list value) +# Defaults to $::os_service_default +# +# [*proxies*] +# (Optional) Proxy classes to import that will affect the way the +# dogpile.cache backend functions. See the dogpile.cache documentation on +# changing-backend-behavior. (list value) +# Defaults to $::os_service_default +# +# [*enabled*] +# (Optional) Global toggle for caching. (boolean value) +# Defaults to $::os_service_default +# +# [*debug_cache_backend*] +# (Optional) Extra debugging from the cache backend (cache keys, +# get/set/delete/etc calls). This is only really useful if you need +# to see the specific cache-backend get/set/delete calls with the keys/values. +# Typically this should be left set to false. (boolean value) +# Defaults to $::os_service_default +# +# [*memcache_servers*] +# (Optional) Memcache servers in the format of "host:port". +# (dogpile.cache.memcache and oslo_cache.memcache_pool backends only). +# (list value) +# Defaults to $::os_service_default +# +# [*memcache_dead_retry*] +# (Optional) Number of seconds memcached server is considered dead before +# it is tried again. (dogpile.cache.memcache and oslo_cache.memcache_pool +# backends only). (integer value) +# Defaults to $::os_service_default +# +# [*memcache_socket_timeout*] +# (Optional) Timeout in seconds for every call to a server. +# (dogpile.cache.memcache and oslo_cache.memcache_pool backends only). +# (integer value) +# Defaults to $::os_service_default +# +# [*memcache_pool_maxsize*] +# Max total number of open connections to every memcached server. +# (oslo_cache.memcache_pool backend only). (integer value) +# Defaults to $::os_service_default +# +# [*memcache_pool_unused_timeout*] +# (Optional) Number of seconds a connection to memcached is held unused +# in the pool before it is closed. (oslo_cache.memcache_pool backend only) +# (integer value) +# Defaults to $::os_service_default +# +# [*memcache_pool_connection_get_timeout*] +# (Optional) Number of seconds that an operation will wait to get a memcache +# client connection. (integer value) +# Defaults to $::os_service_default +# +define oslo::cache( + $config_prefix = $::os_service_default, + $expiration_time = $::os_service_default, + $backend = $::os_service_default, + $backend_argument = $::os_service_default, + $proxies = $::os_service_default, + $enabled = $::os_service_default, + $debug_cache_backend = $::os_service_default, + $memcache_servers = $::os_service_default, + $memcache_dead_retry = $::os_service_default, + $memcache_socket_timeout = $::os_service_default, + $memcache_pool_maxsize = $::os_service_default, + $memcache_pool_unused_timeout = $::os_service_default, + $memcache_pool_connection_get_timeout = $::os_service_default, +){ + + include ::oslo::params + + if !is_service_default($backend_argument) { + $backend_argument_orig = join(any2array($backend_argument), ',') + } else { + $backend_argument_orig = $backend_argument + } + + if !is_service_default($memcache_servers) { + $memcache_servers_orig = join(any2array($memcache_servers), ',') + } else { + $memcache_servers_orig = $memcache_servers + } + + if !is_service_default($proxies) { + $proxies_orig = join(any2array($proxies), ',') + } else { + $proxies_orig = $proxies + } + + if ($backend =~ /pylibmc/ ) { + ensure_packages('python-pylibmc', { + ensure => present, + name => $::oslo::params::pylibmc_package_name, + tag => 'openstack', + }) + } elsif ($backend =~ /\.memcache/ ) { + ensure_resources('package', { 'python-memcache' => { + name => $::oslo::params::python_memcache_package_name, + tag => ['openstack'], + }}) + } + + $cache_options = { + 'cache/config_prefix' => { value => $config_prefix }, + 'cache/expiration_time' => { value => $expiration_time }, + 'cache/backend' => { value => $backend }, + 'cache/backend_argument' => { value => $backend_argument_orig }, + 'cache/proxies' => { value => $proxies_orig }, + 'cache/enabled' => { value => $enabled }, + 'cache/debug_cache_backend' => { value => $debug_cache_backend }, + 'cache/memcache_servers' => { value => $memcache_servers_orig }, + 'cache/memcache_dead_retry' => { value => $memcache_dead_retry }, + 'cache/memcache_socket_timeout' => { value => $memcache_socket_timeout }, + 'cache/memcache_pool_maxsize' => { value => $memcache_pool_maxsize }, + 'cache/memcache_pool_unused_timeout' => { value => $memcache_pool_unused_timeout }, + 'cache/memcache_pool_connection_get_timeout' => { value => $memcache_pool_connection_get_timeout }, + } + + create_resources($name, $cache_options) +} diff --git a/deployment_scripts/puppet/modules/oslo/manifests/concurrency.pp b/deployment_scripts/puppet/modules/oslo/manifests/concurrency.pp new file mode 100644 index 0000000..3d63299 --- /dev/null +++ b/deployment_scripts/puppet/modules/oslo/manifests/concurrency.pp @@ -0,0 +1,30 @@ +# == Define: oslo::concurrency +# +# Configure oslo_concurrency options +# +# This resource configures Oslo concurrency resources for an OpenStack service. +# It will manage the [oslo_concurrency] section in the given config resource. +# +# === Parameters: +# +# [*disable_process_locking*] +# (Optional) Enables or disables inter-process locks. (boolean value) +# Defaults to $::os_service_default. +# +# [*lock_path*] +# (Optional) Directory to use for lock files. For security, the specified directory +# should only be writable by the user running the processes that need locking. +# If external locks are used, a lock path must be set. (string value) +# Defaults to $::os_service_default. +# +define oslo::concurrency( + $disable_process_locking = $::os_service_default, + $lock_path = $::os_service_default, +) { + $concurrency_options = { + 'oslo_concurrency/disable_process_locking' => { value => $disable_process_locking }, + 'oslo_concurrency/lock_path' => { value => $lock_path } + } + + create_resources($name, $concurrency_options) +} diff --git a/deployment_scripts/puppet/modules/oslo/manifests/cors.pp b/deployment_scripts/puppet/modules/oslo/manifests/cors.pp new file mode 100644 index 0000000..4fc0b94 --- /dev/null +++ b/deployment_scripts/puppet/modules/oslo/manifests/cors.pp @@ -0,0 +1,60 @@ +# == Define: oslo::cors +# +# Configure oslo_middleware options in cors section +# +# This resource configures oslo.middleware cors resources for an OpenStack +# service. It will manage the [cors]/[cors.$subdomain] section in the given config resource. +# +# === Parameters: +# +# [*allowed_origin*] +# (Optional) Indicate whether this resource may be shared with the domain +# received in the requests "origin" header. +# (string value) +# Defaults to $::os_service_default. +# +# [*allow_credentials*] +# (Optional) Indicate that the actual request can include user credentials. +# (boolean value) +# Defaults to $::os_service_default. +# +# [*expose_headers*] +# (Optional) Indicate which headers are safe to expose to the API. +# (list value) +# Defaults to $::os_service_default. +# +# [*max_age*] +# (Optional) Maximum cache age of CORS preflight requests. +# (integer value) +# Defaults to $::os_service_default. +# +# [*allow_methods*] +# (Optional) Indicate which methods can be used during the actual request. +# (list value) +# Defaults to $::os_service_default. +# +# [*allow_headers*] +# (Optional) Indicate which header field names may be used during the actual +# request. +# (list value) +# Defaults to $::os_service_default. +# +define oslo::cors( + $allowed_origin = $::os_service_default, + $allow_credentials = $::os_service_default, + $expose_headers = $::os_service_default, + $max_age = $::os_service_default, + $allow_methods = $::os_service_default, + $allow_headers = $::os_service_default, +) { + + $cors_options = { + 'cors/allowed_origin' => { value => $allowed_origin }, + 'cors/allow_credentials' => { value => $allow_credentials }, + 'cors/expose_headers' => { value => $expose_headers }, + 'cors/max_age' => { value => $max_age }, + 'cors/allow_methods' => { value => $allow_methods }, + 'cors/allow_headers' => { value => $allow_headers } + } + create_resources($name, $cors_options) +} diff --git a/deployment_scripts/puppet/modules/oslo/manifests/db.pp b/deployment_scripts/puppet/modules/oslo/manifests/db.pp new file mode 100644 index 0000000..0793412 --- /dev/null +++ b/deployment_scripts/puppet/modules/oslo/manifests/db.pp @@ -0,0 +1,203 @@ +# == Define: oslo::db +# +# Configure oslo_db options +# +# This resource configures Oslo database configs for an OpenStack service. +# It will manage the [database] section in the given config resource. +# +# === Parameters: +# +# [*sqlite_synchronous*] +# (Optional) If True, SQLite uses synchronous mode (boolean value). +# Defaults to $::os_service_default +# +# [*backend*] +# (Optional) The back end to use for the database. +# Defaults to $::os_service_default +# +# [*backend_package_ensure*] +# (Optional) Desired ensure state of the backend database package, +# accepts latest or specific versions. +# Defaults to present. +# +# [*connection*] +# (Optional) The SQLAlchemy connection string to use to connect to the database. +# Defaults to $::os_service_default +# +# [*slave_connection*] +# (Optional) The SQLAlchemy connection string to use to connect to the slave database. +# Defaults to $::os_service_default +# +# [*mysql_sql_mode*] +# (Optional) The SQL mode to be used for MySQL sessions. +# Defaults to $::os_service_default +# +# [*idle_timeout*] +# (Optional) Timeout before idle SQL connections are reaped. +# Defaults to $::os_service_default +# +# [*min_pool_size*] +# (Optional) Minimum number of SQL connections to keep open in a pool. +# Defaults to $::os_service_default +# +# [*max_pool_size*] +# (Optional) Maximum number of SQL connections to keep open in a pool. +# Defaults to $::os_service_default +# +# [*max_retries*] +# (Optional) Maximum number of database connection retries during startup. +# Set to -1 to specify an infinite retry count. +# Defaults to $::os_service_default +# +# [*retry_interval*] +# (Optional) Interval between retries of opening a SQL connection. +# Defaults to $::os_service_default +# +# [*max_overflow*] +# (Optional) If set, use this value for max_overflow with SQLALchemy. +# Defaults to $::os_service_default +# +# [*connection_debug*] +# (Optional) Verbosity of SQL debugging information: 0=None, 100=Everything. +# Defaults to $::os_service_default +# +# [*connection_trace*] +# (Optional) Add Python stack traces to SQL as comment strings (boolean value). +# Defaults to $::os_service_default +# +# [*pool_timeout*] +# (Optional) If set, use this value for pool_timeout with SQLAlchemy. +# Defaults to $::os_service_default +# +# [*use_db_reconnect*] +# (Optional) Enable the experimental use of database reconnect on connection lost (boolean value) +# Defaults to $::os_service_default +# +# [*db_retry_interval*] +# (Optional) Seconds between retries of a database transaction. +# Defaults to $::os_service_default +# +# [*db_inc_retry_interval*] +# (Optional) If True, increases the interval between retries of +# a database operation up to db_max_retry_interval. +# Defaults to $::os_service_default +# +# [*db_max_retry_interval*] +# (Optional) If db_inc_retry_interval is set, the maximum seconds between +# retries of adatabase operation. +# Defaults to $::os_service_default +# +# [*db_max_retries*] +# (Optional) Maximum retries in case of connection error or deadlock error +# before error is raised. Set to -1 to specify an infinite retry count. +# Defaults to $::os_service_default +# +# [*use_tpool*] +# (Optional) Enable the experimental use of thread pooling for all DB API calls (boolean value) +# Defaults to $::os_service_default +# +# DEPRECATED PARAMETERS +# +# [*sqlite_db*] +# (Optional) The file name to use with SQLite. +# Defaults to undef +# +define oslo::db( + $sqlite_synchronous = $::os_service_default, + $backend = $::os_service_default, + $backend_package_ensure = present, + $connection = $::os_service_default, + $slave_connection = $::os_service_default, + $mysql_sql_mode = $::os_service_default, + $idle_timeout = $::os_service_default, + $min_pool_size = $::os_service_default, + $max_pool_size = $::os_service_default, + $max_retries = $::os_service_default, + $retry_interval = $::os_service_default, + $max_overflow = $::os_service_default, + $connection_debug = $::os_service_default, + $connection_trace = $::os_service_default, + $pool_timeout = $::os_service_default, + $use_db_reconnect = $::os_service_default, + $db_retry_interval = $::os_service_default, + $db_inc_retry_interval = $::os_service_default, + $db_max_retry_interval = $::os_service_default, + $db_max_retries = $::os_service_default, + $use_tpool = $::os_service_default, + # DEPRECATED PARAMETERS + $sqlite_db = undef, +){ + + include ::oslo::params + + if !is_service_default($connection) { + + validate_re($connection, + '^(sqlite|mysql(\+pymysql)?|postgresql|mongodb):\/\/(\S+:\S+@\S+\/\S+)?') + + case $connection { + /^mysql(\+pymysql)?:\/\//: { + require '::mysql::bindings' + require '::mysql::bindings::python' + if $connection =~ /^mysql\+pymysql/ { + $backend_package = $::oslo::params::pymysql_package_name + } else { + $backend_package = false + } + } + /^postgresql:\/\//: { + $backend_package = false + require '::postgresql::lib::python' + } + /^mongodb:\/\//: { + $backend_package = $::oslo::params::pymongo_package_name + } + /^sqlite:\/\//: { + $backend_package = $::oslo::params::sqlite_package_name + } + default: { + fail('Unsupported backend configured') + } + } + + if $backend_package and !defined(Package[$backend_package]) { + package { 'db_backend_package': + ensure => $backend_package_ensure, + name => $backend_package, + tag => 'openstack', + } + } + } + + if $sqlite_db { + warning("The sqlite_db parameter is now deprecated and will be removed in the \ +future release. Please use configuration option connection or slave_connection \ +to connect to the database.") + } + + $database_options = { + 'database/sqlite_synchronous' => { value => $sqlite_synchronous }, + 'database/backend' => { value => $backend }, + 'database/connection' => { value => $connection, secret => true }, + 'database/slave_connection' => { value => $slave_connection, secret => true }, + 'database/mysql_sql_mode' => { value => $mysql_sql_mode }, + 'database/idle_timeout' => { value => $idle_timeout }, + 'database/min_pool_size' => { value => $min_pool_size }, + 'database/max_pool_size' => { value => $max_pool_size }, + 'database/max_retries' => { value => $max_retries }, + 'database/retry_interval' => { value => $retry_interval }, + 'database/max_overflow' => { value => $max_overflow }, + 'database/connection_debug' => { value => $connection_debug }, + 'database/connection_trace' => { value => $connection_trace }, + 'database/pool_timeout' => { value => $pool_timeout }, + 'database/use_db_reconnect' => { value => $use_db_reconnect }, + 'database/db_retry_interval' => { value => $db_retry_interval }, + 'database/db_inc_retry_interval' => { value => $db_inc_retry_interval }, + 'database/db_max_retry_interval' => { value => $db_max_retry_interval }, + 'database/db_max_retries' => { value => $db_max_retries }, + 'database/use_tpool' => { value => $use_tpool }, + } + + create_resources($name, $database_options) + +} diff --git a/deployment_scripts/puppet/modules/oslo/manifests/init.pp b/deployment_scripts/puppet/modules/oslo/manifests/init.pp new file mode 100644 index 0000000..2f4e2e8 --- /dev/null +++ b/deployment_scripts/puppet/modules/oslo/manifests/init.pp @@ -0,0 +1,14 @@ +# == Class: oslo +# +# Full description of class oslo here. +# +# === Parameters +# +# [*sample_parameter*] +# Explanation of what this parameter affects and what it defaults to. +# +class oslo { + + include ::oslo::params + +} diff --git a/deployment_scripts/puppet/modules/oslo/manifests/log.pp b/deployment_scripts/puppet/modules/oslo/manifests/log.pp new file mode 100644 index 0000000..8778d46 --- /dev/null +++ b/deployment_scripts/puppet/modules/oslo/manifests/log.pp @@ -0,0 +1,157 @@ +# == Define: oslo::log +# +# Configure oslo_log options +# +# This resource configures Oslo logging resources for an OpenStack service. +# It will manage the [DEFAULT] section in the given config resource. +# +# === Parameters: +# +# [*debug*] +# (Optional) Should the daemons log debug messages +# Defaults to $::os_service_default +# +# [*log_config_append*] +# The name of an additional logging configuration file. +# Defaults to $::os_service_default +# See https://docs.python.org/2/howto/logging.html +# +# [*log_date_format*] +# (Optional) Format string for %%(asctime)s in log records. +# Defaults to $::os_service_default +# Example: 'Y-%m-%d %H:%M:%S' +# +# [*log_file*] +# (Optional) Name of log file to output to. If no default is set, logging will go to stdout. +# This option is ignored if log_config_append is set. +# Defaults to $::os_service_default +# +# [*log_dir*] +# (Optional) Directory where logs should be stored. +# If set to $::os_service_default, it will not log to any directory. +# Defaults to $::os_service_default +# +# [*watch_log_file*] +# (Optional) Uses logging handler designed to watch file system (boolean value). +# Defaults to $::os_service_default +# +# [*use_syslog*] +# (Optional) Use syslog for logging (boolean value). +# Defaults to $::os_service_default +# +# [*syslog_log_facility*] +# (Optional) Syslog facility to receive log lines. +# This option is ignored if log_config_append is set. +# Defaults to $::os_service_default +# +# [*use_stderr*] +# (Optional) Log output to standard error. +# This option is ignored if log_config_append is set. +# Defaults to $::os_service_default +# +# [*logging_context_format_string*] +# (Optional) Format string to use for log messages with context. +# Defaults to $::os_service_default +# Example: '%(asctime)s.%(msecs)03d %(process)d %(levelname)s %(name)s \ +# [%(request_id)s %(user_identity)s] %(instance)s%(message)s' +# +# [*logging_default_format_string*] +# (Optional) Format string to use for log messages when context is undefined. +# Defaults to $::os_service_default +# Example: '%(asctime)s.%(msecs)03d %(process)d %(levelname)s \ +# %(name)s [-] %(instance)s%(message)s' +# +# [*logging_debug_format_suffix*] +# (Optional) Additional data to append to log message when logging level for the message is DEBUG' +# Defaults to $::os_service_default +# Example: '%(funcName)s %(pathname)s:%(lineno)d' +# +# [*logging_exception_prefix*] +# (Optional) Prefix each line of exception output with this format. +# Defaults to $::os_service_default +# Example: '%(asctime)s.%(msecs)03d %(process)d ERROR %(name)s %(instance)s' +# +# [*logging_user_identity_format*] +# (Optional) Defines the format string for %(user_identity)s that is used in logging_context_format_string. +# Defaults to $::os_service_default +# Example: '%(user)s %(tenant)s %(domain)s %(user_domain)s %(project_domain)s' +# +# [*default_log_levels*] +# (Optional) Hash of logger (keys) and level (values) pairs. +# Defaults to $::os_service_default +# Example: +# { 'amqp' => 'WARN', 'amqplib' => 'WARN', 'boto' => 'WARN', +# 'sqlalchemy' => 'WARN', 'suds' => 'INFO', 'iso8601' => 'WARN', +# 'requests.packages.urllib3.connectionpool' => 'WARN' } +# +# [*publish_errors*] +# (Optional) Enables or disables publication of error events (boolean value). +# Defaults to $::os_service_default +# +# [*instance_format*] +# (Optional) The format for an instance that is passed with the log message. +# Defaults to $::os_service_default +# Example: '[instance: %(uuid)s] ' +# +# [*instance_uuid_format*] +# (Optional) The format for an instance UUID that is passed with the log message. +# Defaults to $::os_service_default +# Example: '[instance: %(uuid)s] ' +# +# [*fatal_deprecations*] +# (Optional) Enables or disables fatal status of deprecations (boolean value). +# Defaults to $::os_service_default +# +define oslo::log( + $debug = $::os_service_default, + $log_config_append = $::os_service_default, + $log_date_format = $::os_service_default, + $log_file = $::os_service_default, + $log_dir = $::os_service_default, + $watch_log_file = $::os_service_default, + $use_syslog = $::os_service_default, + $syslog_log_facility = $::os_service_default, + $use_stderr = $::os_service_default, + $logging_context_format_string = $::os_service_default, + $logging_default_format_string = $::os_service_default, + $logging_debug_format_suffix = $::os_service_default, + $logging_exception_prefix = $::os_service_default, + $logging_user_identity_format = $::os_service_default, + $default_log_levels = $::os_service_default, + $publish_errors = $::os_service_default, + $instance_format = $::os_service_default, + $instance_uuid_format = $::os_service_default, + $fatal_deprecations = $::os_service_default, +){ + + if is_service_default($default_log_levels) { + $default_log_levels_real = $default_log_levels + } else { + validate_hash($default_log_levels) + $default_log_levels_real = join(sort(join_keys_to_values($default_log_levels, '=')), ',') + } + + $log_options = { + 'DEFAULT/debug' => { value => $debug }, + 'DEFAULT/log_config_append' => { value => $log_config_append }, + 'DEFAULT/log_date_format' => { value => $log_date_format }, + 'DEFAULT/log_file' => { value => $log_file }, + 'DEFAULT/log_dir' => { value => $log_dir }, + 'DEFAULT/watch_log_file' => { value => $watch_log_file }, + 'DEFAULT/use_syslog' => { value => $use_syslog }, + 'DEFAULT/syslog_log_facility' => { value => $syslog_log_facility }, + 'DEFAULT/use_stderr' => { value => $use_stderr }, + 'DEFAULT/logging_context_format_string' => { value => $logging_context_format_string }, + 'DEFAULT/logging_default_format_string' => { value => $logging_default_format_string }, + 'DEFAULT/logging_debug_format_suffix' => { value => $logging_debug_format_suffix }, + 'DEFAULT/logging_exception_prefix' => { value => $logging_exception_prefix }, + 'DEFAULT/logging_user_identity_format' => { value => $logging_user_identity_format }, + 'DEFAULT/default_log_levels' => { value => $default_log_levels_real }, + 'DEFAULT/publish_errors' => { value => $publish_errors }, + 'DEFAULT/instance_format' => { value => $instance_format }, + 'DEFAULT/instance_uuid_format' => { value => $instance_uuid_format }, + 'DEFAULT/fatal_deprecations' => { value => $fatal_deprecations }, + } + + create_resources($name, $log_options) +} diff --git a/deployment_scripts/puppet/modules/oslo/manifests/messaging/amqp.pp b/deployment_scripts/puppet/modules/oslo/manifests/messaging/amqp.pp new file mode 100644 index 0000000..0a6e917 --- /dev/null +++ b/deployment_scripts/puppet/modules/oslo/manifests/messaging/amqp.pp @@ -0,0 +1,184 @@ +# == Define: oslo::messaging::amqp +# +# Configure oslo_messaging_amqp options +# +# This resource configures Oslo messaging resources for an OpenStack service. +# It will manage the [oslo_messaging_amqp] section in the given config resource. +# +# === Parameters: +# +# [*addressing_mode*] +# (Optional) Indicates the addressing mode used by the driver +# Defaults to $::os_service_default. +# +# [*server_request_prefix*] +# (Optional) Address prefix used when sending to a specific server +# Defaults to $::os_service_default. +# +# [*broadcast_prefix*] +# (Optional) Address prefix used when broadcasting to all servers +# Defaults to $::os_service_default. +# +# [*group_request_prefix*] +# (Optional) Address prefix when sending to any server in group +# Defaults to $::os_service_default. +# +# [*rpc_address_prefix*] +# (Optional) Address prefix for all generated RPC addresses +# Defaults to $::os_service_default. +# +# [*notify_address_prefix*] +# (Optional) Address prefix for all generated Notification addresses +# Defaults to $::os_service_default. +# +# [*multicast_address*] +# (Optional) Appended to address prefix when sending fanout message +# Defaults to $::os_service_default. +# +# [*unicast_address*] +# (Optional) Appended to address prefix when sending to a +# particular RPC/Notification server. +# Defaults to $::os_service_default. +# +# [*anycast_address*] +# (Optional) Appended to address prefix when sending to a +# group of consumers. +# Defaults to $::os_service_default. +# +# [*default_notification_exchange*] +# (Optional) Exchange name used in notification addreses +# Defaults to $::os_service_default. +# +# [*default_rpc_exchange*] +# (Optional) Exchange name used in RPC addreses +# Defaults to $::os_service_default. +# +# [*pre_settled*] +# (Optional) Send messages of this type pre-settled +# Defaults to $::os_service_default. +# +# [*container_name*] +# (Optional) Name for the AMQP container +# Defaults to $::os_service_default. +# +# [*idle_timeout*] +# (Optional) Timeout for inactive connections +# Defaults to $::os_service_default. +# +# [*trace*] +# (Optional) Debug: dump AMQP frames to stdout +# Defaults to $::os_service_default. +# +# [*ssl*] +# (Optional) Attempt to connect via SSL. +# Defaults to $::os_service_default. +# +# [*ssl_ca_file*] +# (Optional) CA certificate PEM file to verify server certificate +# Defaults to $::os_service_default. +# +# [*ssl_cert_file*] +# (Optional) Identifying certificate PEM file to present to clients +# Defaults to $::os_service_default. +# +# [*ssl_key_file*] +# (Optional) Private key PEM file used to sign cert_file certificate +# Defaults to $::os_service_default. +# +# [*ssl_key_password*] +# (Optional) Password for decrypting ssl_key_file (if encrypted) +# Defaults to $::os_service_default. +# +# [*allow_insecure_clients*] +# (Optional) Accept clients using either SSL or plain TCP +# Defaults to $::os_service_default. +# +# [*sasl_mechanisms*] +# (Optional) Space separated list of acceptable SASL mechanisms +# Defaults to $::os_service_default. +# +# [*sasl_config_dir*] +# (Optional) Path to directory that contains the SASL configuration +# Defaults to $::os_service_default. +# +# [*sasl_config_name*] +# (Optional) Name of configuration file (without .conf suffix) +# Defaults to $::os_service_default. +# +# [*username*] +# (Optional) User name for message broker authentication +# Defaults to $::os_service_default. +# +# [*password*] +# (Optional) Password for message broker authentication +# Defaults to $::os_service_default. +# +# [*default_send_timeout*] +# (Optional) The deadline for an rpc cast or call message delivery +# Defaults to $::os_service_default. +# +# [*default_notify_timeout*] +# (Optional) The deadline for a sent notification message delivery +# Defaults to $::os_service_default. +# +define oslo::messaging::amqp( + $addressing_mode = $::os_service_default, + $server_request_prefix = $::os_service_default, + $broadcast_prefix = $::os_service_default, + $group_request_prefix = $::os_service_default, + $rpc_address_prefix = $::os_service_default, + $notify_address_prefix = $::os_service_default, + $multicast_address = $::os_service_default, + $unicast_address = $::os_service_default, + $anycast_address = $::os_service_default, + $default_notification_exchange = $::os_service_default, + $default_rpc_exchange = $::os_service_default, + $pre_settled = $::os_service_default, + $container_name = $::os_service_default, + $idle_timeout = $::os_service_default, + $trace = $::os_service_default, + $ssl = $::os_service_default, + $ssl_ca_file = $::os_service_default, + $ssl_cert_file = $::os_service_default, + $ssl_key_file = $::os_service_default, + $ssl_key_password = $::os_service_default, + $allow_insecure_clients = $::os_service_default, + $sasl_mechanisms = $::os_service_default, + $sasl_config_dir = $::os_service_default, + $sasl_config_name = $::os_service_default, + $username = $::os_service_default, + $password = $::os_service_default, + $default_send_timeout = $::os_service_default, + $default_notify_timeout = $::os_service_default, +){ + $amqp_options={ 'oslo_messaging_amqp/addressing_mode' => { value => $addressing_mode }, + 'oslo_messaging_amqp/server_request_prefix' => { value => $server_request_prefix }, + 'oslo_messaging_amqp/broadcast_prefix' => { value => $broadcast_prefix }, + 'oslo_messaging_amqp/group_request_prefix' => { value => $group_request_prefix }, + 'oslo_messaging_amqp/rpc_address_prefix' => { value => $rpc_address_prefix }, + 'oslo_messaging_amqp/notify_address_prefix' => { value => $notify_address_prefix }, + 'oslo_messaging_amqp/multicast_address' => { value => $multicast_address }, + 'oslo_messaging_amqp/unicast_address' => { value => $unicast_address }, + 'oslo_messaging_amqp/anycast_address' => { value => $anycast_address }, + 'oslo_messaging_amqp/default_notification_exchange' => { value => $default_notification_exchange }, + 'oslo_messaging_amqp/default_rpc_exchange' => { value => $default_rpc_exchange }, + 'oslo_messaging_amqp/pre_settled' => { value => any2array($pre_settled) }, + 'oslo_messaging_amqp/container_name' => { value => $container_name }, + 'oslo_messaging_amqp/idle_timeout' => { value => $idle_timeout }, + 'oslo_messaging_amqp/trace' => { value => $trace }, + 'oslo_messaging_amqp/ssl' => { value => $ssl }, + 'oslo_messaging_amqp/ssl_ca_file' => { value => $ssl_ca_file }, + 'oslo_messaging_amqp/ssl_cert_file' => { value => $ssl_cert_file }, + 'oslo_messaging_amqp/ssl_key_file' => { value => $ssl_key_file }, + 'oslo_messaging_amqp/ssl_key_password' => { value => $ssl_key_password, secret => true }, + 'oslo_messaging_amqp/allow_insecure_clients' => { value => $allow_insecure_clients }, + 'oslo_messaging_amqp/sasl_mechanisms' => { value => $sasl_mechanisms }, + 'oslo_messaging_amqp/sasl_config_dir' => { value => $sasl_config_dir }, + 'oslo_messaging_amqp/sasl_config_name' => { value => $sasl_config_name }, + 'oslo_messaging_amqp/username' => { value => $username }, + 'oslo_messaging_amqp/password' => { value => $password, secret => true }, + 'oslo_messaging_amqp/default_send_timeout' => { value => $default_send_timeout }, + 'oslo_messaging_amqp/default_notify_timeout' => { value => $default_notify_timeout }, + } + create_resources($name, $amqp_options) +} diff --git a/deployment_scripts/puppet/modules/oslo/manifests/messaging/default.pp b/deployment_scripts/puppet/modules/oslo/manifests/messaging/default.pp new file mode 100644 index 0000000..be099dc --- /dev/null +++ b/deployment_scripts/puppet/modules/oslo/manifests/messaging/default.pp @@ -0,0 +1,42 @@ +# == Define: oslo::messaging::default +# +# Configure oslo DEFAULT messaging options +# +# It will manage the [DEFAULT] section in the given config resource. +# +# === Parameters: +# +# [*rpc_response_timeout*] +# (Optional) Seconds to wait for a response from a call. (integer value) +# Defaults to $::os_service_default. +# +# [*transport_url*] +# (Optional) A URL representing the messaging driver to use +# and its full configuration. If not set, we fall back to +# the rpc_backend option and driver specific configuration. +# Transport URLs take the form: +# transport://user:pass@host1:port[,hostN:portN]/virtual_host +# (string value) +# Defaults to $::os_service_default. +# +# [*control_exchange*] +# (Optional) The default exchange under which topics are scoped. +# May be overridden by an exchange name specified in the transport_url option. +# (string value) +# Defaults to $::os_service_default. +# + +define oslo::messaging::default( + $rpc_response_timeout = $::os_service_default, + $transport_url = $::os_service_default, + $control_exchange = $::os_service_default, +) { + + $default_options = { + 'DEFAULT/rpc_response_timeout' => { value => $rpc_response_timeout }, + 'DEFAULT/transport_url' => { value => $transport_url, secret => true }, + 'DEFAULT/control_exchange' => { value => $control_exchange }, + } + + create_resources($name, $default_options) +} diff --git a/deployment_scripts/puppet/modules/oslo/manifests/messaging/notifications.pp b/deployment_scripts/puppet/modules/oslo/manifests/messaging/notifications.pp new file mode 100644 index 0000000..45d0d34 --- /dev/null +++ b/deployment_scripts/puppet/modules/oslo/manifests/messaging/notifications.pp @@ -0,0 +1,54 @@ +# == Define: oslo::messaging::notifications +# +# Configure oslo_messaging_notifications options +# +# This resource configures Oslo Notifications resources for an OpenStack service. +# It will manage the [oslo_messaging_notifications] section in the given config resource. +# +# === Parameters: +# +# [*driver*] +# (Optional) The Driver(s) to handle sending notifications. +# Possible values are messaging, messagingv2, routing, log, test, noop. +# (list value) +# Defaults to $::os_service_default. +# +# [*transport_url*] +# (Optional) A URL representing the messaging driver to use for +# notifications. If not set, we fall back to the same +# configuration used for RPC. +# Transport URLs take the form:: +# transport://user:pass@host1:port[,hostN:portN]/virtual_host +# (string value) +# Defaults to $::os_service_default. +# +# [*topics*] +# (Optional) AMQP topic(s) used for OpenStack notifications +# (list value) +# Defaults to $::os_service_default. +# +define oslo::messaging::notifications( + $driver = $::os_service_default, + $transport_url = $::os_service_default, + $topics = $::os_service_default, +) { + if !is_service_default($driver) { + $driver_orig = join(any2array($driver), ',') + } else { + $driver_orig = $driver + } + + if !is_service_default($topics) { + $topics_orig = join(any2array($topics), ',') + } else { + $topics_orig = $topics + } + + $notification_options = { + 'oslo_messaging_notifications/driver' => { value => $driver_orig }, + 'oslo_messaging_notifications/transport_url' => { value => $transport_url, secret => true }, + 'oslo_messaging_notifications/topics' => { value => $topics_orig }, + } + + create_resources($name, $notification_options) +} diff --git a/deployment_scripts/puppet/modules/oslo/manifests/messaging/rabbit.pp b/deployment_scripts/puppet/modules/oslo/manifests/messaging/rabbit.pp new file mode 100644 index 0000000..9169ecf --- /dev/null +++ b/deployment_scripts/puppet/modules/oslo/manifests/messaging/rabbit.pp @@ -0,0 +1,233 @@ +# == Define: oslo::messaging::rabbit +# +# Configure oslo_messaging_rabbit options +# +# This resource configures Oslo messaging resources for an OpenStack service. +# It manages the [oslo_messaging_rabbit] section in the given config resource. +# +# === Parameters: +# +# [*amqp_durable_queues*] +# (optional) Define queues as "durable" to rabbitmq. (boolean value) +# Defaults to $::os_service_default +# +# [*kombu_ssl_version*] +# (Optional) SSL version to use (valid only if SSL enabled). ' +# Valid values are TLSv1 and SSLv23. SSLv2, SSLv3, TLSv1_1, +# and TLSv1_2 may be available on some distributions. (string value) +# Defaults to $::os_service_default +# +# [*kombu_ssl_keyfile*] +# (Optional) SSL key file (valid only if SSL enabled). (string value) +# Defaults to $::os_service_default +# +# [*kombu_ssl_certfile*] +# (Optional) SSL cert file (valid only if SSL enabled). (string value) +# Defaults to $::os_service_default +# +# [*kombu_ssl_ca_certs*] +# (Optional) SSL certification authority file (valid only if SSL enabled). +# (string value) +# Defaults to $::os_service_default +# +# [*kombu_reconnect_delay*] +# (Optional) How long to wait before reconnecting in response +# to an AMQP consumer cancel notification. (floating point value) +# Defaults to $::os_service_default +# +# [*kombu_missing_consumer_retry_timeout*] +# (Optional) How long to wait a missing client beforce abandoning to send it +# its replies. This value should not be longer than rpc_response_timeout. +# (integer value) +# Defaults to $::os_service_default +# +# [*kombu_failover_strategy*] +# (Optional) Determines how the next RabbitMQ node is chosen in case the one +# we are currently connected to becomes unavailable. Takes effect only if +# more than one RabbitMQ node is provided in config. (string value) +# Defaults to $::os_service_default +# +# [*kombu_compression*] +# (optional) Possible values are: gzip, bz2. If not set compression will not +# be used. This option may notbe available in future versions. EXPERIMENTAL. +# (string value) +# Defaults to $::os_service_default +# +# [*rabbit_host*] +# (Optional) The RabbitMQ broker address where a single node is used. +# (string value) +# Defaults to $::os_service_default +# +# [*rabbit_port*] +# (Optional) The RabbitMQ broker port where a single node is used. +# (port value) +# Defaults to $::os_service_default +# +# [*rabbit_hosts*] +# (Optional) RabbitMQ HA cluster host:port pairs. (array value) +# Defaults to $::os_service_default +# +# [*rabbit_use_ssl*] +# (Optional) Connect over SSL for RabbitMQ. (boolean value) +# Defaults to $::os_service_default +# +# [*rabbit_userid*] +# (Optional) The RabbitMQ userid. (string value) +# Defaults to $::os_service_default +# +# [*rabbit_password*] +# (Optional) The RabbitMQ password. (string value) +# Defaults to $::os_service_default +# +# [*rabbit_login_method*] +# (Optional) The RabbitMQ login method. (string value) +# Defaults to $::os_service_default +# +# [*rabbit_virtual_host*] +# (Optional) The RabbitMQ virtual host. (string value) +# Defaults to $::os_service_default +# +# [*rabbit_retry_interval*] +# (Optional) How frequently to retry connecting with RabbitMQ. +# (integer value) +# Defaults to $::os_service_default +# +# [*rabbit_retry_backoff*] +# (Optional) How long to backoff for between retries when connecting +# to RabbitMQ. (integer value) +# Defaults to $::os_service_default +# +# [*rabbit_interval_max*] +# (Optional) Maximum interval of RabbitMQ connection retries. (integer value) +# Defaults to $::os_service_default +# +# [*rabbit_max_retries*] +# (Optional) Maximum number of RabbitMQ connection retries. (integer value) +# Defaults to $::os_service_default +# +# [*rabbit_ha_queues*] +# (Optional) Use HA queues in RabbitMQ (x-ha-policy: all). If you change this +# option, you must wipe the RabbitMQ database. (boolean value) +# Defaults to $::os_service_default +# +# [*rabbit_transient_queues_ttl*] +# (Optional) Positive integer representing duration in seconds for +# queue TTL (x-expires). Queues which are unused for the duration +# of the TTL are automatically deleted. +# The parameter affects only reply and fanout queues. (integer value) +# Min to 1 +# Defaults to $::os_service_default +# +# [*heartbeat_timeout_threshold*] +# (Optional) Number of seconds after which the Rabbit broker is +# considered down if heartbeat's keep-alive fails +# (0 disable the heartbeat). EXPERIMENTAL. (integer value) +# Defaults to $::os_service_default +# +# [*heartbeat_rate*] +# (Optional) How often times during the heartbeat_timeout_threshold +# we check the heartbeat. (integer value) +# Defaults to $::os_service_default +# + +define oslo::messaging::rabbit( + $amqp_durable_queues = $::os_service_default, + $kombu_ssl_version = $::os_service_default, + $kombu_ssl_keyfile = $::os_service_default, + $kombu_ssl_certfile = $::os_service_default, + $kombu_ssl_ca_certs = $::os_service_default, + $kombu_reconnect_delay = $::os_service_default, + $kombu_missing_consumer_retry_timeout = $::os_service_default, + $kombu_failover_strategy = $::os_service_default, + $kombu_compression = $::os_service_default, + $rabbit_host = $::os_service_default, + $rabbit_port = $::os_service_default, + $rabbit_hosts = $::os_service_default, + $rabbit_use_ssl = $::os_service_default, + $rabbit_userid = $::os_service_default, + $rabbit_password = $::os_service_default, + $rabbit_login_method = $::os_service_default, + $rabbit_virtual_host = $::os_service_default, + $rabbit_retry_interval = $::os_service_default, + $rabbit_retry_backoff = $::os_service_default, + $rabbit_interval_max = $::os_service_default, + $rabbit_max_retries = $::os_service_default, + $rabbit_ha_queues = $::os_service_default, + $rabbit_transient_queues_ttl = $::os_service_default, + $heartbeat_timeout_threshold = $::os_service_default, + $heartbeat_rate = $::os_service_default, +){ + + if $rabbit_use_ssl != true { + if ! is_service_default($kombu_ssl_ca_certs) and ($kombu_ssl_ca_certs) { + fail('The kombu_ssl_ca_certs parameter requires rabbit_use_ssl to be set to true') + } + if ! is_service_default($kombu_ssl_certfile) and ($kombu_ssl_certfile) { + fail('The kombu_ssl_certfile parameter requires rabbit_use_ssl to be set to true') + } + if ! is_service_default($kombu_ssl_keyfile) and ($kombu_ssl_keyfile) { + fail('The kombu_ssl_keyfile parameter requires rabbit_use_ssl to be set to true') + } + if !is_service_default($kombu_ssl_version) and ($kombu_ssl_version) { + fail('The kombu_ssl_version parameter requires rabbit_use_ssl to be set to true') + } + } + + if !is_service_default($kombu_compression) and !($kombu_compression in ['gzip','bz2']) { + fail('Unsupported Kombu compression. Possible values are gzip and bz2') + } + + if !is_service_default($rabbit_hosts) or !is_service_default($rabbit_host) { + warning("The oslo_messaging rabbit_host, rabbit_hosts, rabbit_port, rabbit_userid, \ +rabbit_password, rabbit_virtual_host parameters have been deprecated by the \ +[DEFAULT]\\transport_url. Please use oslo::messaging::default::transport_url instead.") + } + + if !is_service_default($rabbit_hosts) { + $rabbit_hosts_orig = join(any2array($rabbit_hosts), ',') + if size($rabbit_hosts) > 1 and is_service_default($rabbit_ha_queues) { + $rabbit_ha_queues_orig = true + } else { + $rabbit_ha_queues_orig = $rabbit_ha_queues + } + # Do not set rabbit_port and rabbit_host + $rabbit_port_orig = $::os_service_default + $rabbit_host_orig = $::os_service_default + } else { + $rabbit_port_orig = $rabbit_port + $rabbit_host_orig = $rabbit_host + $rabbit_ha_queues_orig = $rabbit_ha_queues + # Do not set rabbit_hosts if host or port or both are set + $rabbit_hosts_orig = $::os_service_default + } + + $rabbit_options = { 'oslo_messaging_rabbit/amqp_durable_queues' => { value => $amqp_durable_queues }, + 'oslo_messaging_rabbit/heartbeat_rate' => { value => $heartbeat_rate }, + 'oslo_messaging_rabbit/heartbeat_timeout_threshold' => { value => $heartbeat_timeout_threshold }, + 'oslo_messaging_rabbit/kombu_compression' => { value => $kombu_compression }, + 'oslo_messaging_rabbit/kombu_failover_strategy' => { value => $kombu_failover_strategy }, + 'oslo_messaging_rabbit/kombu_missing_consumer_retry_timeout' => { value => $kombu_missing_consumer_retry_timeout }, + 'oslo_messaging_rabbit/kombu_reconnect_delay' => { value => $kombu_reconnect_delay }, + 'oslo_messaging_rabbit/rabbit_interval_max' => { value => $rabbit_interval_max }, + 'oslo_messaging_rabbit/rabbit_login_method' => { value => $rabbit_login_method }, + 'oslo_messaging_rabbit/rabbit_max_retries' => { value => $rabbit_max_retries }, + 'oslo_messaging_rabbit/rabbit_password' => { value => $rabbit_password, secret => true }, + 'oslo_messaging_rabbit/rabbit_retry_backoff' => { value => $rabbit_retry_backoff }, + 'oslo_messaging_rabbit/rabbit_retry_interval' => { value => $rabbit_retry_interval }, + 'oslo_messaging_rabbit/rabbit_transient_queues_ttl' => { value => $rabbit_transient_queues_ttl }, + 'oslo_messaging_rabbit/ssl' => { value => $rabbit_use_ssl }, + 'oslo_messaging_rabbit/rabbit_userid' => { value => $rabbit_userid }, + 'oslo_messaging_rabbit/rabbit_virtual_host' => { value => $rabbit_virtual_host }, + 'oslo_messaging_rabbit/rabbit_hosts' => { value => $rabbit_hosts_orig }, + 'oslo_messaging_rabbit/rabbit_port' => { value => $rabbit_port_orig }, + 'oslo_messaging_rabbit/rabbit_host' => { value => $rabbit_host_orig }, + 'oslo_messaging_rabbit/rabbit_ha_queues' => { value => $rabbit_ha_queues_orig }, + 'oslo_messaging_rabbit/ssl_ca_file' => { value => $kombu_ssl_ca_certs }, + 'oslo_messaging_rabbit/ssl_cert_file' => { value => $kombu_ssl_certfile }, + 'oslo_messaging_rabbit/ssl_key_file' => { value => $kombu_ssl_keyfile }, + 'oslo_messaging_rabbit/ssl_version' => { value => $kombu_ssl_version }, + 'DEFAULT/rpc_backend' => { value => 'rabbit' }, + } + + create_resources($name, $rabbit_options) +} diff --git a/deployment_scripts/puppet/modules/oslo/manifests/messaging/zmq.pp b/deployment_scripts/puppet/modules/oslo/manifests/messaging/zmq.pp new file mode 100644 index 0000000..89cb8d8 --- /dev/null +++ b/deployment_scripts/puppet/modules/oslo/manifests/messaging/zmq.pp @@ -0,0 +1,119 @@ +# == Define: oslo::messaging::zmq +# +# Configure ZeroMQ messaging options +# +# This resource configures ZeroMQ messaging resources for an OpenStack service. +# It will manage the [DEFAULT] section in the given config resource. +# +# == Parameters +# +# [*rpc_cast_timeout*] +# (optional) Seconds to wait before a cast expires (TTL). +# The default value of -1 specifies an infinite linger +# period. The value of 0 specifies no linger period. +# Pending messages shall be discarded immediately +# when the socket is closed. Only supported by impl_zmq. +# Defaults to $::os_service_default. +# +# [*rpc_poll_timeout*] +# (optional) The default number of seconds that poll should wait. +# Poll raises timeout exception when timeout expired. +# Defaults to $::os_service_default. +# +# [*rpc_zmq_bind_address*] +# (optional) ZeroMQ bind address. +# Should be a wildcard (*), an ethernet interface, or IP. +# The "host" option should point or resolve to this address. +# Defaults to $::os_service_default. +# +# [*rpc_zmq_bind_port_retries*] +# (optional) Number of retries to find free port number +# before fail with ZMQBindError. +# Defaults to $::os_service_default. +# +# [*rpc_zmq_concurrency*] +# (optional) Type of concurrency used. +# Either "native" or "eventlet". +# Defaults to $::os_service_default. +# +# [*rpc_zmq_contexts*] +# (optional) Number of ZeroMQ contexts. +# Defaults to $::os_service_default. +# +# [*rpc_zmq_host*] +# (optional) Name of this node. +# Must be a valid hostname, FQDN, or IP address. +# Must match "host" option, if running Nova. +# Defaults to $::os_service_default. +# +# [*rpc_zmq_ipc_dir*] +# (optional) Directory for holding IPC sockets. +# Defaults to $::os_service_default. +# +# [*rpc_zmq_matchmaker*] +# (optional) MatchMaker driver. +# Defaults to $::os_service_default. +# +# [*rpc_zmq_max_port*] +# (optional) Maximal port number for random ports range. +# Defaults to $::os_service_default. +# +# [*rpc_zmq_min_port*] +# (optional) Minimal port number for random ports range. +# Defaults to $::os_service_default. +# +# [*rpc_zmq_topic_backlog*] +# (optional) Maximum number of ingress messages to locally buffer per topic. +# Defaults to $::os_service_default. +# +# [*use_pub_sub*] +# (optional) Use PUB/SUB pattern for fanout methods. +# PUB/SUB always uses proxy. +# Defaults to $::os_service_default. +# +# [*zmq_target_expire*] +# (optional) Expiration timeout in seconds of a name service +# record about existing target ( < 0 means no timeout). +# Defaults to $::os_service_default. +# +define oslo::messaging::zmq( + $rpc_cast_timeout = $::os_service_default, + $rpc_poll_timeout = $::os_service_default, + $rpc_zmq_bind_address = $::os_service_default, + $rpc_zmq_bind_port_retries = $::os_service_default, + $rpc_zmq_concurrency = $::os_service_default, + $rpc_zmq_contexts = $::os_service_default, + $rpc_zmq_host = $::os_service_default, + $rpc_zmq_ipc_dir = $::os_service_default, + $rpc_zmq_matchmaker = $::os_service_default, + $rpc_zmq_max_port = $::os_service_default, + $rpc_zmq_min_port = $::os_service_default, + $rpc_zmq_topic_backlog = $::os_service_default, + $use_pub_sub = $::os_service_default, + $zmq_target_expire = $::os_service_default, +) { + + if ! ( is_service_default($rpc_zmq_concurrency) or $rpc_zmq_concurrency in [ 'eventlet', 'native' ] ) { + fail('Unsupported type of zmq concurrency is used.') + } + + $zmq_options = { + 'DEFAULT/rpc_cast_timeout' => { value => $rpc_cast_timeout }, + 'DEFAULT/rpc_poll_timeout' => { value => $rpc_poll_timeout }, + 'DEFAULT/rpc_zmq_bind_address' => { value => $rpc_zmq_bind_address }, + 'DEFAULT/rpc_zmq_bind_port_retries' => { value => $rpc_zmq_bind_port_retries }, + 'DEFAULT/rpc_zmq_concurrency' => { value => $rpc_zmq_concurrency }, + 'DEFAULT/rpc_zmq_contexts' => { value => $rpc_zmq_contexts }, + 'DEFAULT/rpc_zmq_host' => { value => $rpc_zmq_host }, + 'DEFAULT/rpc_zmq_ipc_dir' => { value => $rpc_zmq_ipc_dir }, + 'DEFAULT/rpc_zmq_matchmaker' => { value => $rpc_zmq_matchmaker }, + 'DEFAULT/rpc_zmq_max_port' => { value => $rpc_zmq_max_port }, + 'DEFAULT/rpc_zmq_min_port' => { value => $rpc_zmq_min_port }, + 'DEFAULT/rpc_zmq_topic_backlog' => { value => $rpc_zmq_topic_backlog }, + 'DEFAULT/use_pub_sub' => { value => $use_pub_sub }, + 'DEFAULT/zmq_target_expire' => { value => $zmq_target_expire }, + 'DEFAULT/rpc_backend' => { value => 'zmq' }, + } + + create_resources($name, $zmq_options) +} diff --git a/deployment_scripts/puppet/modules/oslo/manifests/middleware.pp b/deployment_scripts/puppet/modules/oslo/manifests/middleware.pp new file mode 100644 index 0000000..3a8a70e --- /dev/null +++ b/deployment_scripts/puppet/modules/oslo/manifests/middleware.pp @@ -0,0 +1,29 @@ +# == Define: oslo::middleware +# +# Configure oslo_middleware options +# +# This resource configures oslo.middleware resources for an OpenStack service. +# It will manage the [oslo_middleware] section in the given config resource. +# +# === Parameters: +# +# [*max_request_body_size*] +# (Optional) Make exception message format errors fatal. +# (integer value) +# Defaults to $::os_service_default. +# +# [*enable_proxy_headers_parsing*] +# (Optional) Enables SSL request handling from HTTPProxyToWSGI middleware. +# (boolean value) +# Defaults to $::os_service_default. +# +define oslo::middleware( + $max_request_body_size = $::os_service_default, + $enable_proxy_headers_parsing = $::os_service_default, +) { + $middleware_options = { + 'oslo_middleware/max_request_body_size' => { value => $max_request_body_size }, + 'oslo_middleware/enable_proxy_headers_parsing' => { value => $enable_proxy_headers_parsing }, + } + create_resources($name, $middleware_options) +} diff --git a/deployment_scripts/puppet/modules/oslo/manifests/params.pp b/deployment_scripts/puppet/modules/oslo/manifests/params.pp new file mode 100644 index 0000000..f0992a6 --- /dev/null +++ b/deployment_scripts/puppet/modules/oslo/manifests/params.pp @@ -0,0 +1,27 @@ +# ==Class: oslo::params +# +# Parameters for puppet-oslo +# +class oslo::params { + include ::openstacklib::defaults + + $pymongo_package_name = 'python-pymongo' + $pylibmc_package_name = 'python-pylibmc' + + case $::osfamily { + 'RedHat': { + $sqlite_package_name = undef + $pymysql_package_name = undef + $python_memcache_package_name = 'python-memcached' + } + 'Debian': { + $sqlite_package_name = 'python-pysqlite2' + $pymysql_package_name = 'python-pymysql' + $python_memcache_package_name = 'python-memcache' + } + default: { + fail("Unsupported osfamily: ${::osfamily} operatingsystem") + } + + } # Case $::osfamily +} diff --git a/deployment_scripts/puppet/modules/oslo/manifests/policy.pp b/deployment_scripts/puppet/modules/oslo/manifests/policy.pp new file mode 100644 index 0000000..0b6dcb0 --- /dev/null +++ b/deployment_scripts/puppet/modules/oslo/manifests/policy.pp @@ -0,0 +1,45 @@ +# == Define: oslo::policy +# +# Configure oslo_policy options +# +# This resource configures Oslo policy resources for an OpenStack service. +# It will manage the [oslo_policy] section in the given config resource. +# +# === Parameters: +# +# [*policy_file*] +# (Optional) The JSON file that defines policies. (string value) +# Defaults to $::os_service_default. +# +# [*policy_default_rule*] +# (Optional) Default rule. Enforced when a requested rule is not found. +# (string value) +# Defaults to $::os_service_default. +# +# [*policy_dirs*] +# (Optional) Directories where policy configuration files are stored. +# They can be relative to any directory in the search path defined by +# the config_dir option, or absolute paths. +# The file defined by policy_file must exist for these directories to be searched. +# Missing or empty directories are ignored. (list value) +# Defaults to $::os_service_default. +# +define oslo::policy( + $policy_file = $::os_service_default, + $policy_default_rule = $::os_service_default, + $policy_dirs = $::os_service_default, +) { + if !is_service_default($policy_dirs) { + $policy_dirs_orig = join(any2array($policy_dirs), ',') + } else { + $policy_dirs_orig = $policy_dirs + } + + $policy_options = { + 'oslo_policy/policy_file' => { value => $policy_file }, + 'oslo_policy/policy_default_rule' => { value => $policy_default_rule }, + 'oslo_policy/policy_dirs' => { value => $policy_dirs_orig }, + } + + create_resources($name, $policy_options) +} diff --git a/deployment_scripts/puppet/modules/oslo/manifests/privsep.pp b/deployment_scripts/puppet/modules/oslo/manifests/privsep.pp new file mode 100644 index 0000000..6958ffc --- /dev/null +++ b/deployment_scripts/puppet/modules/oslo/manifests/privsep.pp @@ -0,0 +1,59 @@ +# == Define: oslo::privsep +# +# Configure oslo_privsep options +# +# This resource configures Oslo privilege separator resources for an OpenStack service. +# It will manage the [privsep_${entrypoint}] section in the given config resource. +# +# === Parameters: +# +# [*entrypoint*] +# (Required) Privsep entrypoint. (string value) +# Defaults to $name. +# +# [*config*] +# (Required) Configuration file to manage. (string value) +# +# [*user*] +# (Optional) User that the privsep daemon should run as. (string value) +# Defaults to $::os_service_default. +# +# [*group*] +# (Optional) Group that the privsep daemon should run as. (string value) +# Defaults to $::os_service_default. +# +# [*capabilities*] +# (Optional) List of Linux capabilities retained by the privsep daemon. (list value) +# Defaults to $::os_service_default. +# +# [*helper_command*] +# (Optional) Command to invoke to start the privsep daemon if not using the "fork" method. +# If not specified, a default is generated using "sudo privsep-helper" and arguments designed to +# recreate the current configuration. This command must accept suitable --privsep_context +# and --privsep_sock_path arguments. +# Defaults to $::os_service_default. +# +# == Examples +# +# oslo::privsep { 'osbrick': +# config => 'nova_config' +# } +# +define oslo::privsep ( + $config, + $entrypoint = $name, + $user = $::os_service_default, + $group = $::os_service_default, + $capabilities = $::os_service_default, + $helper_command = $::os_service_default, +) { + + $privsep_options = { + "privsep_${entrypoint}/user" => { value => $user }, + "privsep_${entrypoint}/group" => { value => $group }, + "privsep_${entrypoint}/capabilities" => { value => $capabilities }, + "privsep_${entrypoint}/helper_command" => { value => $helper_command }, + } + + create_resources($config, $privsep_options) +} diff --git a/deployment_scripts/puppet/modules/oslo/manifests/releasenotes/notes/rabbitmq-connection-params-1a8ace0c23e7249e.yaml b/deployment_scripts/puppet/modules/oslo/manifests/releasenotes/notes/rabbitmq-connection-params-1a8ace0c23e7249e.yaml new file mode 100644 index 0000000..3f13356 --- /dev/null +++ b/deployment_scripts/puppet/modules/oslo/manifests/releasenotes/notes/rabbitmq-connection-params-1a8ace0c23e7249e.yaml @@ -0,0 +1,6 @@ +--- +deprecations: + - The rabbitmq connection paramters have been deprecated in favor of + transport_url which is provided by the oslo::messaging::default class. + This affects, rabbit_host, rabbit_port, rabbit_hosts, rabbit_userid, + rabbit_password and rabbit_virtual_host. diff --git a/deployment_scripts/puppet/modules/oslo/manifests/service.pp b/deployment_scripts/puppet/modules/oslo/manifests/service.pp new file mode 100644 index 0000000..f245518 --- /dev/null +++ b/deployment_scripts/puppet/modules/oslo/manifests/service.pp @@ -0,0 +1,141 @@ +# == Define: oslo::service +# +# Configure oslo_service options +# +# This resource configures Oslo service resources for an OpenStack service. +# It will manage the [DEFAULT] and [ssl] sections in the given config resource. +# +# === Parameters: +# +# [*api_paste_config*] +# (optional) File name for the paste.deploy config for api service. +# (string value) +# Defaults to $::os_service_default. +# +# [*backdoor_port*] +# (optional) Enable eventlet backdoor. Acceptable values are 0, , and +# :, where 0 results in listening on a random tcp port number. +# Defaults to $::os_service_default. +# +# [*backdoor_socket*] +# (optional) Enable eventlet backdoor, using the provided path as a unix +# socket that can receive connections. (string value) +# Defaults to $::os_service_default. +# +# [*client_socket_timeout*] +# (optional) Timeout for client connections' socket operations. A value of +# '0' means wait forever. (integer value) +# Defaults to $::os_service_default. +# +# [*graceful_shutdown_timeout*] +# (optional) pecify a timeout after which a gracefully shutdown server will +# exit. '0' value means endless wait. (integer value) +# Defaults to $::os_service_default. +# +# [*log_options*] +# (optional) Enables or disables logging values of all registered options +# when starting a service (at DEBUG level). (boolean value) +# Defaults to $::os_service_default. +# +# [*max_header_line*] +# (optional) Maximum line size of message headers to be accepted. +# (integer value) +# Defaults to $::os_service_default. +# +# [*run_external_periodic_tasks*] +# (optional) Some periodic tasks can be run in a separate process. +# (boolean value) +# Defaults to $::os_service_default. +# +# [*tcp_keepidle*] +# (optional) # Sets the value of TCP_KEEPIDLE in seconds for each server socket. +# (integer value) +# Defaults to $::os_service_default. +# +# [*wsgi_default_pool_size*] +# (optional) Size of the pool of greenthreads used by wsgi (integer value) +# Defaults to $::os_service_default. +# +# [*wsgi_keep_alive*] +# (optional) If False, closes the client socket connection explicitly. +# (boolean value) +# Defaults to $::os_service_default. +# +# [*wsgi_log_format*] +# (optional) A python format string that is used as the template to generate +# log lines. (string value) +# Defaults to $::os_service_default. +# Example: '%(client_ip)s "%(request_line)s" status: %(status_code)s len: \ +# %(body_length)s time: %(wall_seconds).7f' +# +# === ssl parameters +# +# [*ca_file*] +# (optional) CA certificate file to use to verify connecting clients. +# (string value) +# Defaults to $::os_service_default. +# +# [*cert_file*] +# (optional) Certificate file to use when starting the server securely. +# (string value) +# Defaults to $::os_service_default. +# +# [*ciphers*] +# (optional) Sets the list of available ciphers. value should be a string +# in the OpenSSL cipher list format. (string value) +# Defaults to $::os_service_default. +# +# [*key_file*] +# (optional) Private key file to use when starting the server securely. +# (string value) +# Defaults to $::os_service_default. +# +# [*version*] +# (optional) SSL version to use (valid only if SSL enabled). Valid values are +# TLSv1 and SSLv23. SSLv2, SSLv3, TLSv1_1, and TLSv1_2 may be available on +# some distributions. (string value) +# Defaults to $::os_service_default. +# +define oslo::service ( + $api_paste_config = $::os_service_default, + $backdoor_port = $::os_service_default, + $backdoor_socket = $::os_service_default, + $client_socket_timeout = $::os_service_default, + $graceful_shutdown_timeout = $::os_service_default, + $log_options = $::os_service_default, + $max_header_line = $::os_service_default, + $run_external_periodic_tasks = $::os_service_default, + $tcp_keepidle = $::os_service_default, + $wsgi_default_pool_size = $::os_service_default, + $wsgi_keep_alive = $::os_service_default, + $wsgi_log_format = $::os_service_default, + $ca_file = $::os_service_default, + $cert_file = $::os_service_default, + $ciphers = $::os_service_default, + $key_file = $::os_service_default, + $version = $::os_service_default, +) { + + $service_options = { + 'DEFAULT/api_paste_config' => { value => $api_paste_config }, + 'DEFAULT/backdoor_port' => { value => $backdoor_port }, + 'DEFAULT/backdoor_socket' => { value => $backdoor_socket }, + 'DEFAULT/client_socket_timeout' => { value => $client_socket_timeout }, + 'DEFAULT/graceful_shutdown_timeout' => { value => $graceful_shutdown_timeout }, + 'DEFAULT/log_options' => { value => $log_options }, + 'DEFAULT/max_header_line' => { value => $max_header_line }, + 'DEFAULT/run_external_periodic_tasks' => { value => $run_external_periodic_tasks }, + 'DEFAULT/tcp_keepidle' => { value => $tcp_keepidle }, + 'DEFAULT/wsgi_default_pool_size' => { value => $wsgi_default_pool_size }, + 'DEFAULT/wsgi_keep_alive' => { value => $wsgi_keep_alive }, + 'DEFAULT/wsgi_log_format' => { value => $wsgi_log_format }, + 'ssl/ca_file' => { value => $ca_file }, + 'ssl/cert_file' => { value => $cert_file }, + 'ssl/ciphers' => { value => $ciphers }, + 'ssl/key_file' => { value => $key_file }, + 'ssl/version' => { value => $version }, + } + + create_resources($name, $service_options) + +} diff --git a/deployment_scripts/puppet/modules/oslo/manifests/versionedobjects.pp b/deployment_scripts/puppet/modules/oslo/manifests/versionedobjects.pp new file mode 100644 index 0000000..a1fc3f3 --- /dev/null +++ b/deployment_scripts/puppet/modules/oslo/manifests/versionedobjects.pp @@ -0,0 +1,18 @@ +# == Define: oslo::versionedobjects +# +# Configure oslo_versionedobjects options +# +# This resource configures oslo.versionedobjects resources for an OpenStack service. +# It will manage the [oslo_versionedobjects] section in the given config resource. +# +# === Parameters: +# +# [*fatal_exception_format_errors*] +# (Optional) Make exception message format errors fatal. (boolean value) +# Defaults to $::os_service_default. +# +define oslo::versionedobjects( + $fatal_exception_format_errors = $::os_service_default, +) { + create_resources($name, {'oslo_versionedobjects/fatal_exception_format_errors' => { value => $fatal_exception_format_errors }}) +} diff --git a/deployment_scripts/puppet/modules/oslo/metadata.json b/deployment_scripts/puppet/modules/oslo/metadata.json new file mode 100644 index 0000000..58d20bc --- /dev/null +++ b/deployment_scripts/puppet/modules/oslo/metadata.json @@ -0,0 +1,61 @@ +{ + "author": "OpenStack Contributors", + "dependencies": [ + { + "name": "puppetlabs/inifile", + "version_requirement": ">=1.0.0 <2.0.0" + }, + { + "name": "puppetlabs/stdlib", + "version_requirement": ">=4.2.0 <5.0.0" + }, + { + "name": "openstack/openstacklib", + "version_requirement": ">=11.0.0 <12.0.0" + } + ], + "description": "Installs and configures OpenStack Oslo.", + "issues_url": "https://bugs.launchpad.net/puppet-oslo", + "license": "Apache-2.0", + "name": "openstack-oslo", + "operatingsystem_support": [ + { + "operatingsystem": "Debian", + "operatingsystemrelease": [ + "8" + ] + }, + { + "operatingsystem": "Fedora", + "operatingsystemrelease": [ + "24" + ] + }, + { + "operatingsystem": "RedHat", + "operatingsystemrelease": [ + "7" + ] + }, + { + "operatingsystem": "Ubuntu", + "operatingsystemrelease": [ + "16.04" + ] + } + ], + "project_page": "https://launchpad.net/puppet-oslo", + "requirements": [ + { + "name": "pe", + "version_requirement": "4.x" + }, + { + "name": "puppet", + "version_requirement": "4.x" + } + ], + "source": "git://github.com/openstack/puppet-oslo.git", + "summary": "Puppet module for OpenStack Oslo", + "version": "11.0.0" +} \ No newline at end of file diff --git a/deployment_scripts/puppet/modules/oslo/releasenotes/notes/add_oslo_privsep-3f125445bce8b431.yaml b/deployment_scripts/puppet/modules/oslo/releasenotes/notes/add_oslo_privsep-3f125445bce8b431.yaml new file mode 100644 index 0000000..eb15dac --- /dev/null +++ b/deployment_scripts/puppet/modules/oslo/releasenotes/notes/add_oslo_privsep-3f125445bce8b431.yaml @@ -0,0 +1,4 @@ +--- +features: + - Add oslo::privsep define to configure privsep_${entrypoint} section + of given config resource. diff --git a/deployment_scripts/puppet/modules/oslo/releasenotes/notes/add_zmq_messaging-7ea20df747c78035.yaml b/deployment_scripts/puppet/modules/oslo/releasenotes/notes/add_zmq_messaging-7ea20df747c78035.yaml new file mode 100644 index 0000000..d54157a --- /dev/null +++ b/deployment_scripts/puppet/modules/oslo/releasenotes/notes/add_zmq_messaging-7ea20df747c78035.yaml @@ -0,0 +1,3 @@ +--- +features: + - Add possibility to configure ZeroMQ messaging system. diff --git a/deployment_scripts/puppet/modules/oslo/releasenotes/notes/backend_package_ensure-54b4525895ce9acd.yaml b/deployment_scripts/puppet/modules/oslo/releasenotes/notes/backend_package_ensure-54b4525895ce9acd.yaml new file mode 100644 index 0000000..0809b17 --- /dev/null +++ b/deployment_scripts/puppet/modules/oslo/releasenotes/notes/backend_package_ensure-54b4525895ce9acd.yaml @@ -0,0 +1,6 @@ +--- +features: + - Allow setting the desired state of the backend + database package. This will default to present + which maintains original behavior but allows + for more flexibility. diff --git a/deployment_scripts/puppet/modules/oslo/releasenotes/notes/deprecate_config_sqlite_db-1a239175d42378e3.yaml b/deployment_scripts/puppet/modules/oslo/releasenotes/notes/deprecate_config_sqlite_db-1a239175d42378e3.yaml new file mode 100644 index 0000000..d20da8a --- /dev/null +++ b/deployment_scripts/puppet/modules/oslo/releasenotes/notes/deprecate_config_sqlite_db-1a239175d42378e3.yaml @@ -0,0 +1,7 @@ +--- +deprecations: + - | + The configuration option ``sqlite_db`` is now deprecated and + will be removed in the future. Please use configuration + option ``connection`` or ``slave_connection`` to connect to the database. + diff --git a/deployment_scripts/puppet/modules/oslo/releasenotes/notes/first_release-a7268e1c8959eca3.yaml b/deployment_scripts/puppet/modules/oslo/releasenotes/notes/first_release-a7268e1c8959eca3.yaml new file mode 100644 index 0000000..4a1edb7 --- /dev/null +++ b/deployment_scripts/puppet/modules/oslo/releasenotes/notes/first_release-a7268e1c8959eca3.yaml @@ -0,0 +1,3 @@ +--- +prelude: > + First release of puppet-oslo. diff --git a/deployment_scripts/puppet/modules/oslo/releasenotes/notes/fix_log_dir_documentation-050052366584e83e.yaml b/deployment_scripts/puppet/modules/oslo/releasenotes/notes/fix_log_dir_documentation-050052366584e83e.yaml new file mode 100644 index 0000000..25e070f --- /dev/null +++ b/deployment_scripts/puppet/modules/oslo/releasenotes/notes/fix_log_dir_documentation-050052366584e83e.yaml @@ -0,0 +1,3 @@ +--- +fixes: + - Fixed documentation for log_dir parameter diff --git a/deployment_scripts/puppet/modules/oslo/releasenotes/notes/remove_verbose-0b599cd4810a8c51.yaml b/deployment_scripts/puppet/modules/oslo/releasenotes/notes/remove_verbose-0b599cd4810a8c51.yaml new file mode 100644 index 0000000..9a865cd --- /dev/null +++ b/deployment_scripts/puppet/modules/oslo/releasenotes/notes/remove_verbose-0b599cd4810a8c51.yaml @@ -0,0 +1,4 @@ +--- +other: + - The verbose option was marked to be removed in Ocata, + in Newton the option was deprecated. diff --git a/deployment_scripts/puppet/modules/oslo/releasenotes/notes/secure-transport-url-d67d307cf85a16b1.yaml b/deployment_scripts/puppet/modules/oslo/releasenotes/notes/secure-transport-url-d67d307cf85a16b1.yaml new file mode 100644 index 0000000..c5dbb4c --- /dev/null +++ b/deployment_scripts/puppet/modules/oslo/releasenotes/notes/secure-transport-url-d67d307cf85a16b1.yaml @@ -0,0 +1,3 @@ +--- +security: + - Secure transport_url option in logs diff --git a/deployment_scripts/puppet/modules/oslo/releasenotes/notes/update-amqp-opts-1f14b8d3648b2b30.yaml b/deployment_scripts/puppet/modules/oslo/releasenotes/notes/update-amqp-opts-1f14b8d3648b2b30.yaml new file mode 100644 index 0000000..46e2528 --- /dev/null +++ b/deployment_scripts/puppet/modules/oslo/releasenotes/notes/update-amqp-opts-1f14b8d3648b2b30.yaml @@ -0,0 +1,3 @@ +--- +features: + - Add new configuration options for amqp 1.0 messaging driver diff --git a/deployment_scripts/puppet/modules/oslo/releasenotes/source/_static/.placeholder b/deployment_scripts/puppet/modules/oslo/releasenotes/source/_static/.placeholder new file mode 100644 index 0000000..e69de29 diff --git a/deployment_scripts/puppet/modules/oslo/releasenotes/source/conf.py b/deployment_scripts/puppet/modules/oslo/releasenotes/source/conf.py new file mode 100644 index 0000000..8e17c20 --- /dev/null +++ b/deployment_scripts/puppet/modules/oslo/releasenotes/source/conf.py @@ -0,0 +1,262 @@ +# -*- coding: utf-8 -*- +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# If extensions (or modules to document with autodoc) are in another directory, +# add these directories to sys.path here. If the directory is relative to the +# documentation root, use os.path.abspath to make it absolute, like shown here. +#sys.path.insert(0, os.path.abspath('.')) + +# -- General configuration ------------------------------------------------ + +# If your documentation needs a minimal Sphinx version, state it here. +#needs_sphinx = '1.0' + +# Add any Sphinx extension module names here, as strings. They can be +# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom +# ones. +extensions = [ + 'oslosphinx', + 'reno.sphinxext', +] + +# Add any paths that contain templates here, relative to this directory. +templates_path = ['_templates'] + +# The suffix of source filenames. +source_suffix = '.rst' + +# The encoding of source files. +#source_encoding = 'utf-8-sig' + +# The master toctree document. +master_doc = 'index' + +# General information about the project. +project = u'puppet-oslo Release Notes' +copyright = u'2017, Puppet OpenStack Developers' + +# The version info for the project you're documenting, acts as replacement for +# |version| and |release|, also used in various other places throughout the +# built documents. +# +# The short X.Y version. +version = '11.0.0' +# The full version, including alpha/beta/rc tags. +release = '11.0.0' + +# The language for content autogenerated by Sphinx. Refer to documentation +# for a list of supported languages. +#language = None + +# There are two options for replacing |today|: either, you set today to some +# non-false value, then it is used: +#today = '' +# Else, today_fmt is used as the format for a strftime call. +#today_fmt = '%B %d, %Y' + +# List of patterns, relative to source directory, that match files and +# directories to ignore when looking for source files. +exclude_patterns = [] + +# The reST default role (used for this markup: `text`) to use for all +# documents. +#default_role = None + +# If true, '()' will be appended to :func: etc. cross-reference text. +#add_function_parentheses = True + +# If true, the current module name will be prepended to all description +# unit titles (such as .. function::). +#add_module_names = True + +# If true, sectionauthor and moduleauthor directives will be shown in the +# output. They are ignored by default. +#show_authors = False + +# The name of the Pygments (syntax highlighting) style to use. +pygments_style = 'sphinx' + +# A list of ignored prefixes for module index sorting. +#modindex_common_prefix = [] + +# If true, keep warnings as "system message" paragraphs in the built documents. +#keep_warnings = False + + +# -- Options for HTML output ---------------------------------------------- + +# The theme to use for HTML and HTML Help pages. See the documentation for +# a list of builtin themes. +html_theme = 'default' + +# Theme options are theme-specific and customize the look and feel of a theme +# further. For a list of options available for each theme, see the +# documentation. +#html_theme_options = {} + +# Add any paths that contain custom themes here, relative to this directory. +#html_theme_path = [] + +# The name for this set of Sphinx documents. If None, it defaults to +# " v documentation". +#html_title = None + +# A shorter title for the navigation bar. Default is the same as html_title. +#html_short_title = None + +# The name of an image file (relative to this directory) to place at the top +# of the sidebar. +#html_logo = None + +# The name of an image file (within the static path) to use as favicon of the +# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 +# pixels large. +#html_favicon = None + +# Add any paths that contain custom static files (such as style sheets) here, +# relative to this directory. They are copied after the builtin static files, +# so a file named "default.css" will overwrite the builtin "default.css". +html_static_path = ['_static'] + +# Add any extra paths that contain custom files (such as robots.txt or +# .htaccess) here, relative to this directory. These files are copied +# directly to the root of the documentation. +#html_extra_path = [] + +# If not '', a 'Last updated on:' timestamp is inserted at every page bottom, +# using the given strftime format. +#html_last_updated_fmt = '%b %d, %Y' + +# If true, SmartyPants will be used to convert quotes and dashes to +# typographically correct entities. +#html_use_smartypants = True + +# Custom sidebar templates, maps document names to template names. +#html_sidebars = {} + +# Additional templates that should be rendered to pages, maps page names to +# template names. +#html_additional_pages = {} + +# If false, no module index is generated. +#html_domain_indices = True + +# If false, no index is generated. +#html_use_index = True + +# If true, the index is split into individual pages for each letter. +#html_split_index = False + +# If true, links to the reST sources are added to the pages. +#html_show_sourcelink = True + +# If true, "Created using Sphinx" is shown in the HTML footer. Default is True. +#html_show_sphinx = True + +# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. +#html_show_copyright = True + +# If true, an OpenSearch description file will be output, and all pages will +# contain a tag referring to it. The value of this option must be the +# base URL from which the finished HTML is served. +#html_use_opensearch = '' + +# This is the file name suffix for HTML files (e.g. ".xhtml"). +#html_file_suffix = None + +# Output file base name for HTML help builder. +htmlhelp_basename = 'puppet-osloReleaseNotesdoc' + + +# -- Options for LaTeX output --------------------------------------------- + +latex_elements = { +# The paper size ('letterpaper' or 'a4paper'). +#'papersize': 'letterpaper', + +# The font size ('10pt', '11pt' or '12pt'). +#'pointsize': '10pt', + +# Additional stuff for the LaTeX preamble. +#'preamble': '', +} + +# Grouping the document tree into LaTeX files. List of tuples +# (source start file, target name, title, +# author, documentclass [howto, manual, or own class]). +latex_documents = [ + ('index', 'puppet-osloReleaseNotes.tex', u'puppet-oslo Release Notes Documentation', + u'2017, Puppet OpenStack Developers', 'manual'), +] + +# The name of an image file (relative to this directory) to place at the top of +# the title page. +#latex_logo = None + +# For "manual" documents, if this is true, then toplevel headings are parts, +# not chapters. +#latex_use_parts = False + +# If true, show page references after internal links. +#latex_show_pagerefs = False + +# If true, show URL addresses after external links. +#latex_show_urls = False + +# Documents to append as an appendix to all manuals. +#latex_appendices = [] + +# If false, no module index is generated. +#latex_domain_indices = True + + +# -- Options for manual page output --------------------------------------- + +# One entry per manual page. List of tuples +# (source start file, name, description, authors, manual section). +man_pages = [ + ('index', 'puppet-osloreleasenotes', u'puppet-oslo Release Notes Documentation', + [u'2017, Puppet OpenStack Developers'], 1) +] + +# If true, show URL addresses after external links. +#man_show_urls = False + + +# -- Options for Texinfo output ------------------------------------------- + +# Grouping the document tree into Texinfo files. List of tuples +# (source start file, target name, title, author, +# dir menu entry, description, category) +texinfo_documents = [ + ('index', 'puppet-osloReleaseNotes', u'puppet-oslo Release Notes Documentation', + u'2017, Puppet OpenStack Developers', 'puppet-osloReleaseNotes', 'One line description of project.', + 'Miscellaneous'), +] + +# Documents to append as an appendix to all manuals. +#texinfo_appendices = [] + +# If false, no module index is generated. +#texinfo_domain_indices = True + +# How to display URL addresses: 'footnote', 'no', or 'inline'. +#texinfo_show_urls = 'footnote' + +# If true, do not generate a @detailmenu in the "Top" node's menu. +#texinfo_no_detailmenu = False + +# -- Options for Internationalization output ------------------------------ +locale_dirs = ['locale/'] diff --git a/deployment_scripts/puppet/modules/oslo/releasenotes/source/index.rst b/deployment_scripts/puppet/modules/oslo/releasenotes/source/index.rst new file mode 100644 index 0000000..8b2f9eb --- /dev/null +++ b/deployment_scripts/puppet/modules/oslo/releasenotes/source/index.rst @@ -0,0 +1,20 @@ +======================================== +Welcome to puppet-oslo Release Notes! +======================================== + +Contents +======== + +.. toctree:: + :maxdepth: 2 + + unreleased + ocata + newton + + +Indices and tables +================== + +* :ref:`genindex` +* :ref:`search` diff --git a/deployment_scripts/puppet/modules/oslo/releasenotes/source/newton.rst b/deployment_scripts/puppet/modules/oslo/releasenotes/source/newton.rst new file mode 100644 index 0000000..97036ed --- /dev/null +++ b/deployment_scripts/puppet/modules/oslo/releasenotes/source/newton.rst @@ -0,0 +1,6 @@ +=================================== + Newton Series Release Notes +=================================== + +.. release-notes:: + :branch: origin/stable/newton diff --git a/deployment_scripts/puppet/modules/oslo/releasenotes/source/ocata.rst b/deployment_scripts/puppet/modules/oslo/releasenotes/source/ocata.rst new file mode 100644 index 0000000..ebe62f4 --- /dev/null +++ b/deployment_scripts/puppet/modules/oslo/releasenotes/source/ocata.rst @@ -0,0 +1,6 @@ +=================================== + Ocata Series Release Notes +=================================== + +.. release-notes:: + :branch: origin/stable/ocata diff --git a/deployment_scripts/puppet/modules/oslo/releasenotes/source/unreleased.rst b/deployment_scripts/puppet/modules/oslo/releasenotes/source/unreleased.rst new file mode 100644 index 0000000..2334dd5 --- /dev/null +++ b/deployment_scripts/puppet/modules/oslo/releasenotes/source/unreleased.rst @@ -0,0 +1,5 @@ +============================== + Current Series Release Notes +============================== + + .. release-notes:: diff --git a/deployment_scripts/puppet/modules/oslo/setup.cfg b/deployment_scripts/puppet/modules/oslo/setup.cfg new file mode 100644 index 0000000..5edd58b --- /dev/null +++ b/deployment_scripts/puppet/modules/oslo/setup.cfg @@ -0,0 +1,13 @@ +[metadata] +name = puppet-oslo +summary = Puppet module for Oslo +description-file = + README.md +author = OpenStack Contributors +author-email = openstack-dev@lists.openstack.org +home-page = http://docs.openstack.org/developer/puppet-openstack-guide/ +classifier = + Intended Audience :: Developers + Intended Audience :: System Administrators + License :: OSI Approved :: Apache Software License + Operating System :: POSIX :: Linux diff --git a/deployment_scripts/puppet/modules/oslo/setup.py b/deployment_scripts/puppet/modules/oslo/setup.py new file mode 100644 index 0000000..70c2b3f --- /dev/null +++ b/deployment_scripts/puppet/modules/oslo/setup.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python +# Copyright (c) 2013 Hewlett-Packard Development Company, L.P. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# THIS FILE IS MANAGED BY THE GLOBAL REQUIREMENTS REPO - DO NOT EDIT +import setuptools + +setuptools.setup( + setup_requires=['pbr'], + pbr=True) diff --git a/deployment_scripts/puppet/modules/oslo/spec/acceptance/nodesets/centos-70-x64.yml b/deployment_scripts/puppet/modules/oslo/spec/acceptance/nodesets/centos-70-x64.yml new file mode 100644 index 0000000..5f097e9 --- /dev/null +++ b/deployment_scripts/puppet/modules/oslo/spec/acceptance/nodesets/centos-70-x64.yml @@ -0,0 +1,11 @@ +HOSTS: + centos-server-70-x64: + roles: + - master + platform: el-7-x86_64 + box: puppetlabs/centos-7.0-64-nocm + box_url: https://vagrantcloud.com/puppetlabs/centos-7.0-64-nocm + hypervisor: vagrant +CONFIG: + log_level: debug + type: foss diff --git a/deployment_scripts/puppet/modules/oslo/spec/acceptance/nodesets/default.yml b/deployment_scripts/puppet/modules/oslo/spec/acceptance/nodesets/default.yml new file mode 100644 index 0000000..486b6a3 --- /dev/null +++ b/deployment_scripts/puppet/modules/oslo/spec/acceptance/nodesets/default.yml @@ -0,0 +1,10 @@ +HOSTS: + ubuntu-server-14.04-amd64: + roles: + - master + platform: ubuntu-14.04-amd64 + box: puppetlabs/ubuntu-14.04-64-nocm + box_url: https://vagrantcloud.com/puppetlabs/ubuntu-14.04-64-nocm + hypervisor: vagrant +CONFIG: + type: foss diff --git a/deployment_scripts/puppet/modules/oslo/spec/acceptance/nodesets/nodepool-centos7.yml b/deployment_scripts/puppet/modules/oslo/spec/acceptance/nodesets/nodepool-centos7.yml new file mode 100644 index 0000000..c552874 --- /dev/null +++ b/deployment_scripts/puppet/modules/oslo/spec/acceptance/nodesets/nodepool-centos7.yml @@ -0,0 +1,10 @@ +HOSTS: + centos-70-x64: + roles: + - master + platform: el-7-x86_64 + hypervisor: none + ip: 127.0.0.1 +CONFIG: + type: foss + set_env: false diff --git a/deployment_scripts/puppet/modules/oslo/spec/acceptance/nodesets/nodepool-trusty.yml b/deployment_scripts/puppet/modules/oslo/spec/acceptance/nodesets/nodepool-trusty.yml new file mode 100644 index 0000000..9fc624e --- /dev/null +++ b/deployment_scripts/puppet/modules/oslo/spec/acceptance/nodesets/nodepool-trusty.yml @@ -0,0 +1,10 @@ +HOSTS: + ubuntu-14.04-amd64: + roles: + - master + platform: ubuntu-14.04-amd64 + hypervisor: none + ip: 127.0.0.1 +CONFIG: + type: foss + set_env: false diff --git a/deployment_scripts/puppet/modules/oslo/spec/acceptance/nodesets/nodepool-xenial.yml b/deployment_scripts/puppet/modules/oslo/spec/acceptance/nodesets/nodepool-xenial.yml new file mode 100644 index 0000000..99dd318 --- /dev/null +++ b/deployment_scripts/puppet/modules/oslo/spec/acceptance/nodesets/nodepool-xenial.yml @@ -0,0 +1,10 @@ +HOSTS: + ubuntu-16.04-amd64: + roles: + - master + platform: ubuntu-16.04-amd64 + hypervisor: none + ip: 127.0.0.1 +CONFIG: + type: foss + set_env: false diff --git a/deployment_scripts/puppet/modules/oslo/spec/acceptance/nodesets/ubuntu-server-1404-x64.yml b/deployment_scripts/puppet/modules/oslo/spec/acceptance/nodesets/ubuntu-server-1404-x64.yml new file mode 100644 index 0000000..8001929 --- /dev/null +++ b/deployment_scripts/puppet/modules/oslo/spec/acceptance/nodesets/ubuntu-server-1404-x64.yml @@ -0,0 +1,11 @@ +HOSTS: + ubuntu-server-14.04-amd64: + roles: + - master + platform: ubuntu-14.04-amd64 + box: puppetlabs/ubuntu-14.04-64-nocm + box_url: https://vagrantcloud.com/puppetlabs/ubuntu-14.04-64-nocm + hypervisor: vagrant +CONFIG: + log_level: debug + type: foss diff --git a/deployment_scripts/puppet/modules/oslo/spec/classes/oslo_init_spec.rb b/deployment_scripts/puppet/modules/oslo/spec/classes/oslo_init_spec.rb new file mode 100644 index 0000000..1abfe03 --- /dev/null +++ b/deployment_scripts/puppet/modules/oslo/spec/classes/oslo_init_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +describe 'oslo' do + + shared_examples 'oslo' do + + context 'with default parameters' do + it 'contains the logging class' do + is_expected.to contain_class('oslo::params') + end + end + + end + +end diff --git a/deployment_scripts/puppet/modules/oslo/spec/defines/oslo_cache_spec.rb b/deployment_scripts/puppet/modules/oslo/spec/defines/oslo_cache_spec.rb new file mode 100644 index 0000000..e489c92 --- /dev/null +++ b/deployment_scripts/puppet/modules/oslo/spec/defines/oslo_cache_spec.rb @@ -0,0 +1,136 @@ +require 'spec_helper' + +describe 'oslo::cache' do + + let (:title) { 'keystone_config' } + + shared_examples 'oslo-cache' do + + context 'with default parameters' do + it 'configure oslo_cache default params' do + is_expected.to contain_keystone_config('cache/config_prefix').with_value('') + is_expected.to contain_keystone_config('cache/expiration_time').with_value('') + is_expected.to contain_keystone_config('cache/backend').with_value('') + is_expected.to contain_keystone_config('cache/backend_argument').with_value('') + is_expected.to contain_keystone_config('cache/proxies').with_value('') + is_expected.to contain_keystone_config('cache/enabled').with_value('') + is_expected.to contain_keystone_config('cache/debug_cache_backend').with_value('') + is_expected.to contain_keystone_config('cache/memcache_servers').with_value('') + is_expected.to contain_keystone_config('cache/memcache_dead_retry').with_value('') + is_expected.to contain_keystone_config('cache/memcache_socket_timeout').with_value('') + is_expected.to contain_keystone_config('cache/memcache_pool_maxsize').with_value('') + is_expected.to contain_keystone_config('cache/memcache_pool_unused_timeout').with_value('') + is_expected.to contain_keystone_config('cache/memcache_pool_connection_get_timeout').with_value('') + end + end + + context 'with overridden parameters' do + let :params do + { + :config_prefix => 'cache.oslo', + :expiration_time => '600', + :backend => 'dogpile.cache.null', + :backend_argument => ['foo:bar'], + :proxies => ['proxy1', 'proxy2'], + :enabled => true, + :debug_cache_backend => true, + :memcache_servers => ['host1:11211', 'host2:11211'], + :memcache_dead_retry => '300', + :memcache_socket_timeout => '3', + :memcache_pool_maxsize => '10', + :memcache_pool_unused_timeout => '60', + :memcache_pool_connection_get_timeout => '10', + } + end + + it 'configures cache section' do + is_expected.to contain_keystone_config('cache/config_prefix').with_value('cache.oslo') + is_expected.to contain_keystone_config('cache/expiration_time').with_value('600') + is_expected.to contain_keystone_config('cache/backend').with_value('dogpile.cache.null') + is_expected.to contain_keystone_config('cache/backend_argument').with_value('foo:bar') + is_expected.to contain_keystone_config('cache/proxies').with_value('proxy1,proxy2') + is_expected.to contain_keystone_config('cache/enabled').with_value('true') + is_expected.to contain_keystone_config('cache/debug_cache_backend').with_value('true') + is_expected.to contain_keystone_config('cache/memcache_servers').with_value('host1:11211,host2:11211') + is_expected.to contain_keystone_config('cache/memcache_dead_retry').with_value('300') + is_expected.to contain_keystone_config('cache/memcache_socket_timeout').with_value('3') + is_expected.to contain_keystone_config('cache/memcache_pool_maxsize').with_value('10') + is_expected.to contain_keystone_config('cache/memcache_pool_unused_timeout').with_value('60') + is_expected.to contain_keystone_config('cache/memcache_pool_connection_get_timeout').with_value('10') + end + end + + context 'with pylibmc backend' do + let :params do + { + :backend => 'dogpile.cache.pylibmc', + } + end + + it 'configures cache backend' do + is_expected.to contain_keystone_config('cache/backend').with_value('dogpile.cache.pylibmc') + is_expected.to contain_package('python-pylibmc').with( + :ensure => 'present', + :name => platform_params[:pylibmc_package_name], + :tag => 'openstack', + ) + end + end + + context 'with memcache backend' do + let :params do + { + :backend => 'dogpile.cache.memcache', + } + end + + it 'configures cache backend' do + is_expected.to contain_keystone_config('cache/backend').with_value('dogpile.cache.memcache') + is_expected.to contain_package('python-memcache').with( + :name => platform_params[:python_memcache_package_name], + :tag => ['openstack'], + ) + end + end + + context 'with string in list parameters' do + let :params do + { + :backend_argument => 'foo:bar', + :memcache_servers => 'host1:11211,host2:11211', + :proxies => 'proxy1,proxy2', + } + end + + it 'configures oslo_policy section with overriden list values as strings' do + is_expected.to contain_keystone_config('cache/backend_argument').with_value('foo:bar') + is_expected.to contain_keystone_config('cache/memcache_servers').with_value('host1:11211,host2:11211') + is_expected.to contain_keystone_config('cache/proxies').with_value('proxy1,proxy2') + end + end + end + + on_supported_os({ + :supported_os => OSDefaults.get_supported_os + }).each do |os,facts| + context "on #{os}" do + let (:facts) do + facts.merge!(OSDefaults.get_facts()) + end + let(:platform_params) do + platform_params = { :pylibmc_package_name => 'python-pylibmc' } + + case facts[:osfamily] + when 'Debian' + platform_params[:python_memcache_package_name] = 'python-memcache' + when 'RedHat' + platform_params[:python_memcache_package_name] = 'python-memcached' + end + + platform_params + end + + it_behaves_like 'oslo-cache' + end + end +end diff --git a/deployment_scripts/puppet/modules/oslo/spec/defines/oslo_concurrency_spec.rb b/deployment_scripts/puppet/modules/oslo/spec/defines/oslo_concurrency_spec.rb new file mode 100644 index 0000000..507d6e7 --- /dev/null +++ b/deployment_scripts/puppet/modules/oslo/spec/defines/oslo_concurrency_spec.rb @@ -0,0 +1,42 @@ +require 'spec_helper' + +describe 'oslo::concurrency' do + + let (:title) { 'keystone_config' } + + shared_examples 'oslo-concurrency' do + + context 'with default parameters' do + it 'configures oslo_concurrency default params' do + is_expected.to contain_keystone_config('oslo_concurrency/disable_process_locking').with_value('') + is_expected.to contain_keystone_config('oslo_concurrency/lock_path').with_value('') + end + end + + context 'with overridden parameters' do + let :params do + { + :disable_process_locking => 'true', + :lock_path => '/lock/dir/', + } + end + + it 'configures oslo_concurrency section' do + is_expected.to contain_keystone_config('oslo_concurrency/disable_process_locking').with_value('true') + is_expected.to contain_keystone_config('oslo_concurrency/lock_path').with_value('/lock/dir/') + end + end + end + + on_supported_os({ + :supported_os => OSDefaults.get_supported_os + }).each do |os,facts| + context "on #{os}" do + let (:facts) do + facts.merge!(OSDefaults.get_facts()) + end + + it_behaves_like 'oslo-concurrency' + end + end +end diff --git a/deployment_scripts/puppet/modules/oslo/spec/defines/oslo_cors_spec.rb b/deployment_scripts/puppet/modules/oslo/spec/defines/oslo_cors_spec.rb new file mode 100644 index 0000000..89a510f --- /dev/null +++ b/deployment_scripts/puppet/modules/oslo/spec/defines/oslo_cors_spec.rb @@ -0,0 +1,33 @@ +require 'spec_helper' + +describe 'oslo::cors' do + + let (:title) { 'keystone_config' } + + shared_examples 'shared examples' do + + context 'with default parameters' do + it 'configure cors default params' do + is_expected.to contain_keystone_config('cors/allowed_origin').with_value('') + is_expected.to contain_keystone_config('cors/allow_credentials').with_value('') + is_expected.to contain_keystone_config('cors/expose_headers').with_value('') + is_expected.to contain_keystone_config('cors/max_age').with_value('') + is_expected.to contain_keystone_config('cors/allow_methods').with_value('') + is_expected.to contain_keystone_config('cors/allow_headers').with_value('') + end + + end + end + + on_supported_os({ + :supported_os => OSDefaults.get_supported_os + }).each do |os,facts| + context "on #{os}" do + let (:facts) do + facts.merge!(OSDefaults.get_facts()) + end + + include_examples 'shared examples' + end + end +end diff --git a/deployment_scripts/puppet/modules/oslo/spec/defines/oslo_db_spec.rb b/deployment_scripts/puppet/modules/oslo/spec/defines/oslo_db_spec.rb new file mode 100644 index 0000000..6daafc4 --- /dev/null +++ b/deployment_scripts/puppet/modules/oslo/spec/defines/oslo_db_spec.rb @@ -0,0 +1,191 @@ +require 'spec_helper' + +describe 'oslo::db' do + + let (:title) { 'keystone_config' } + + shared_examples 'oslo-db' do + + context 'with default parameters' do + it 'configure oslo_db default params' do + is_expected.to contain_keystone_config('database/sqlite_synchronous').with_value('') + is_expected.to contain_keystone_config('database/backend').with_value('') + is_expected.to contain_keystone_config('database/connection').with_value('') + is_expected.to contain_keystone_config('database/slave_connection').with_value('') + is_expected.to contain_keystone_config('database/mysql_sql_mode').with_value('') + is_expected.to contain_keystone_config('database/idle_timeout').with_value('') + is_expected.to contain_keystone_config('database/min_pool_size').with_value('') + is_expected.to contain_keystone_config('database/max_pool_size').with_value('') + is_expected.to contain_keystone_config('database/max_retries').with_value('') + is_expected.to contain_keystone_config('database/retry_interval').with_value('') + is_expected.to contain_keystone_config('database/max_overflow').with_value('') + is_expected.to contain_keystone_config('database/connection_debug').with_value('') + is_expected.to contain_keystone_config('database/connection_trace').with_value('') + is_expected.to contain_keystone_config('database/pool_timeout').with_value('') + is_expected.to contain_keystone_config('database/use_db_reconnect').with_value('') + is_expected.to contain_keystone_config('database/db_retry_interval').with_value('') + is_expected.to contain_keystone_config('database/db_inc_retry_interval').with_value('') + is_expected.to contain_keystone_config('database/db_max_retry_interval').with_value('') + is_expected.to contain_keystone_config('database/db_max_retries').with_value('') + is_expected.to contain_keystone_config('database/use_tpool').with_value('') + end + end + + context 'with overridden parameters' do + let :params do + { + :backend => 'sqlalchemy', + :connection => 'mysql+pymysql://db:db@localhost/db', + :mysql_sql_mode => 'TRADITIONAL', + :idle_timeout => '3601', + :min_pool_size => '2', + :max_pool_size => '100', + :max_retries => '10', + :retry_interval => '10', + :max_overflow => '50', + :connection_debug => '0', + :connection_trace => true, + :pool_timeout => '10', + :use_db_reconnect => true, + :db_retry_interval => '1', + :db_inc_retry_interval => true, + :db_max_retry_interval => '10', + :db_max_retries => '20', + :use_tpool => true, + } + end + + it 'configures database parameters' do + is_expected.to contain_keystone_config('database/backend').with_value('sqlalchemy') + is_expected.to contain_keystone_config('database/connection').with_value('mysql+pymysql://db:db@localhost/db').with_secret(true) + is_expected.to contain_keystone_config('database/mysql_sql_mode').with_value('TRADITIONAL') + is_expected.to contain_keystone_config('database/idle_timeout').with_value('3601') + is_expected.to contain_keystone_config('database/min_pool_size').with_value('2') + is_expected.to contain_keystone_config('database/max_pool_size').with_value('100') + is_expected.to contain_keystone_config('database/max_retries').with_value('10') + is_expected.to contain_keystone_config('database/retry_interval').with_value('10') + is_expected.to contain_keystone_config('database/max_overflow').with_value('50') + is_expected.to contain_keystone_config('database/connection_debug').with_value('0') + is_expected.to contain_keystone_config('database/connection_trace').with_value(true) + is_expected.to contain_keystone_config('database/pool_timeout').with_value('10') + is_expected.to contain_keystone_config('database/use_db_reconnect').with_value(true) + is_expected.to contain_keystone_config('database/db_retry_interval').with_value('1') + is_expected.to contain_keystone_config('database/db_inc_retry_interval').with_value(true) + is_expected.to contain_keystone_config('database/db_max_retry_interval').with_value('10') + is_expected.to contain_keystone_config('database/db_max_retries').with_value('20') + is_expected.to contain_keystone_config('database/use_tpool').with_value(true) + end + end + + context 'with mongodb backend' do + let :params do + { :connection => 'mongodb://localhost:1234/db' } + end + + it 'install the proper backend package' do + is_expected.to contain_package('db_backend_package').with( + :ensure => 'present', + :name => 'python-pymongo', + :tag => 'openstack' + ) + end + end + + context 'with specific mongodb connection string' do + let :params do + { :connection => 'mongodb://user:password@host1:27017,host2:27017,host3:27017/db_name?replicaSet=replica&readPreference=primaryPreferred' } + end + + it { is_expected.to contain_keystone_config('database/connection').with_value( + 'mongodb://user:password@host1:27017,host2:27017,host3:27017/db_name?replicaSet=replica&readPreference=primaryPreferred').with_secret(true) } + end + + context 'with pymysql connection' do + let :params do + { :connection => 'mysql+pymysql://db:db@localhost/db' } + end + + it { is_expected.to contain_class('oslo::params') } + it { is_expected.to contain_keystone_config('database/connection').with_value('mysql+pymysql://db:db@localhost/db').with_secret(true) } + end + + context 'with postgresql backend' do + let :params do + { :connection => 'postgresql://db:db@localhost/db', } + end + + it 'install the proper backend package' do + is_expected.to contain_package('python-psycopg2').with(:ensure => 'present') + end + end + + context 'with incorrect database_connection string' do + let :params do + { :connection => 'foo://db:db@localhost/db', } + end + + it_raises 'a Puppet::Error', /validate_re/ + end + + context 'with incorrect pymysql database_connection string' do + let :params do + { :connection => 'foo+pymysql://db:db@localhost/db', } + end + + it_raises 'a Puppet::Error', /validate_re/ + end + end + + shared_examples 'oslo-db on Debian' do + context 'using pymysql driver' do + let :params do + { :connection => 'mysql+pymysql:///db:db@localhost/db', } + end + + it 'install the proper backend package' do + is_expected.to contain_package('db_backend_package').with( + :ensure => 'present', + :name => 'python-pymysql', + :tag => 'openstack' + ) + end + end + + context 'with sqlite backend' do + let :params do + { :connection => 'sqlite:///var/lib/db.db', } + end + + it 'install the proper backend package' do + is_expected.to contain_package('db_backend_package').with( + :ensure => 'present', + :name => 'python-pysqlite2', + :tag => 'openstack' + ) + end + end + end + + shared_examples 'oslo-db on RedHat' do + context 'using pymysql driver' do + let :params do + { :connection => 'mysql+pymysql:///db:db@localhost/db', } + end + + it { is_expected.not_to contain_package('db_backend_package') } + end + end + + on_supported_os({ + :supported_os => OSDefaults.get_supported_os + }).each do |os,facts| + context "on #{os}" do + let (:facts) do + facts.merge!(OSDefaults.get_facts()) + end + + it_behaves_like 'oslo-db' + it_behaves_like "oslo-db on #{facts[:osfamily]}" + end + end +end diff --git a/deployment_scripts/puppet/modules/oslo/spec/defines/oslo_log_spec.rb b/deployment_scripts/puppet/modules/oslo/spec/defines/oslo_log_spec.rb new file mode 100644 index 0000000..3240d18 --- /dev/null +++ b/deployment_scripts/puppet/modules/oslo/spec/defines/oslo_log_spec.rb @@ -0,0 +1,100 @@ +require 'spec_helper' + +describe 'oslo::log' do + + let (:title) { 'keystone_config' } + + shared_examples 'oslo-log' do + + context 'with default parameters' do + it 'configure oslo_log default params' do + is_expected.to contain_keystone_config('DEFAULT/debug').with_value('') + is_expected.to contain_keystone_config('DEFAULT/log_config_append').with_value('') + is_expected.to contain_keystone_config('DEFAULT/log_date_format').with_value('') + is_expected.to contain_keystone_config('DEFAULT/log_file').with_value('') + is_expected.to contain_keystone_config('DEFAULT/log_dir').with_value('') + is_expected.to contain_keystone_config('DEFAULT/watch_log_file').with_value('') + is_expected.to contain_keystone_config('DEFAULT/use_syslog').with_value('') + is_expected.to contain_keystone_config('DEFAULT/syslog_log_facility').with_value('') + is_expected.to contain_keystone_config('DEFAULT/use_stderr').with_value('') + is_expected.to contain_keystone_config('DEFAULT/logging_context_format_string').with_value('') + is_expected.to contain_keystone_config('DEFAULT/logging_default_format_string').with_value('') + is_expected.to contain_keystone_config('DEFAULT/logging_debug_format_suffix').with_value('') + is_expected.to contain_keystone_config('DEFAULT/logging_exception_prefix').with_value('') + is_expected.to contain_keystone_config('DEFAULT/logging_user_identity_format').with_value('') + is_expected.to contain_keystone_config('DEFAULT/default_log_levels').with_value('') + is_expected.to contain_keystone_config('DEFAULT/publish_errors').with_value('') + is_expected.to contain_keystone_config('DEFAULT/instance_format').with_value('') + is_expected.to contain_keystone_config('DEFAULT/instance_uuid_format').with_value('') + is_expected.to contain_keystone_config('DEFAULT/fatal_deprecations').with_value('') + end + end + + context 'with overridden parameters' do + let :params do + { :debug => true, + :log_config_append => '/var/log/keystone/keystone.log', + :log_date_format => '%Y-%m-%d %H:%M:%S', + :log_file => '/var/log/keystone/keystone.log', + :log_dir => '/var/log/keystone', + :watch_log_file => true, + :use_syslog => true, + :syslog_log_facility => 'LOG_USER', + :use_stderr => true, + :logging_context_format_string => + '%(asctime)s.%(msecs)03d %(process)d %(levelname)s %(name)s [%(request_id)s %(user_identity)s] %(instance)s%(message)s', + :logging_default_format_string => '%(asctime)s.%(msecs)03d %(process)d %(levelname)s %(name)s [-] %(instance)s%(message)s', + :logging_debug_format_suffix => '%(funcName)s %(pathname)s:%(lineno)d', + :logging_exception_prefix => '%(asctime)s.%(msecs)03d %(process)d ERROR %(name)s %(instance)s', + :logging_user_identity_format => '%(user)s %(tenant)s %(domain)s %(user_domain)s %(project_domain)s', + :default_log_levels => { + 'amqp' => 'WARN', 'amqplib' => 'WARN', 'boto' => 'WARN', 'sqlalchemy' => 'WARN', + 'suds' => 'INFO', 'iso8601' => 'WARN', 'requests.packages.urllib3.connectionpool' => 'WARN' }, + :publish_errors => true, + :instance_format => '[instance: %(uuid)s]', + :instance_uuid_format => '[instance: %(uuid)s]', + :fatal_deprecations => true, + } + end + + it 'configures logging' do + is_expected.to contain_keystone_config('DEFAULT/debug').with_value(true) + is_expected.to contain_keystone_config('DEFAULT/log_config_append').with_value('/var/log/keystone/keystone.log') + is_expected.to contain_keystone_config('DEFAULT/log_date_format').with_value('%Y-%m-%d %H:%M:%S') + is_expected.to contain_keystone_config('DEFAULT/log_file').with_value('/var/log/keystone/keystone.log') + is_expected.to contain_keystone_config('DEFAULT/log_dir').with_value('/var/log/keystone') + is_expected.to contain_keystone_config('DEFAULT/watch_log_file').with_value(true) + is_expected.to contain_keystone_config('DEFAULT/use_syslog').with_value(true) + is_expected.to contain_keystone_config('DEFAULT/syslog_log_facility').with_value('LOG_USER') + is_expected.to contain_keystone_config('DEFAULT/use_stderr').with_value(true) + is_expected.to contain_keystone_config('DEFAULT/logging_context_format_string').with_value( + '%(asctime)s.%(msecs)03d %(process)d %(levelname)s %(name)s [%(request_id)s %(user_identity)s] %(instance)s%(message)s') + is_expected.to contain_keystone_config('DEFAULT/logging_default_format_string').with_value( + '%(asctime)s.%(msecs)03d %(process)d %(levelname)s %(name)s [-] %(instance)s%(message)s') + is_expected.to contain_keystone_config('DEFAULT/logging_debug_format_suffix').with_value('%(funcName)s %(pathname)s:%(lineno)d') + is_expected.to contain_keystone_config('DEFAULT/logging_exception_prefix').with_value( + '%(asctime)s.%(msecs)03d %(process)d ERROR %(name)s %(instance)s') + is_expected.to contain_keystone_config('DEFAULT/logging_user_identity_format').with_value( +'%(user)s %(tenant)s %(domain)s %(user_domain)s %(project_domain)s') + is_expected.to contain_keystone_config('DEFAULT/default_log_levels').with_value( + 'amqp=WARN,amqplib=WARN,boto=WARN,iso8601=WARN,requests.packages.urllib3.connectionpool=WARN,sqlalchemy=WARN,suds=INFO') + is_expected.to contain_keystone_config('DEFAULT/publish_errors').with_value(true) + is_expected.to contain_keystone_config('DEFAULT/instance_format').with_value('[instance: %(uuid)s]') + is_expected.to contain_keystone_config('DEFAULT/instance_uuid_format').with_value('[instance: %(uuid)s]') + is_expected.to contain_keystone_config('DEFAULT/fatal_deprecations').with_value(true) + end + end + end + + on_supported_os({ + :supported_os => OSDefaults.get_supported_os + }).each do |os,facts| + context "on #{os}" do + let (:facts) do + facts.merge!(OSDefaults.get_facts()) + end + + it_behaves_like 'oslo-log' + end + end +end diff --git a/deployment_scripts/puppet/modules/oslo/spec/defines/oslo_messaging_amqp_spec.rb b/deployment_scripts/puppet/modules/oslo/spec/defines/oslo_messaging_amqp_spec.rb new file mode 100644 index 0000000..f465493 --- /dev/null +++ b/deployment_scripts/puppet/modules/oslo/spec/defines/oslo_messaging_amqp_spec.rb @@ -0,0 +1,76 @@ +require 'spec_helper' + +describe 'oslo::messaging::amqp' do + + let (:title) { 'keystone_config' } + + shared_examples 'oslo-messaging-amqp' do + + context 'with default parameters' do + it 'configure oslo_messaging_amqp default params' do + is_expected.to contain_keystone_config('oslo_messaging_amqp/addressing_mode').with_value('') + is_expected.to contain_keystone_config('oslo_messaging_amqp/server_request_prefix').with_value('') + is_expected.to contain_keystone_config('oslo_messaging_amqp/broadcast_prefix').with_value('') + is_expected.to contain_keystone_config('oslo_messaging_amqp/group_request_prefix').with_value('') + is_expected.to contain_keystone_config('oslo_messaging_amqp/rpc_address_prefix').with_value('') + is_expected.to contain_keystone_config('oslo_messaging_amqp/notify_address_prefix').with_value('') + is_expected.to contain_keystone_config('oslo_messaging_amqp/multicast_address').with_value('') + is_expected.to contain_keystone_config('oslo_messaging_amqp/unicast_address').with_value('') + is_expected.to contain_keystone_config('oslo_messaging_amqp/anycast_address').with_value('') + is_expected.to contain_keystone_config('oslo_messaging_amqp/default_notification_exchange').with_value('') + is_expected.to contain_keystone_config('oslo_messaging_amqp/default_rpc_exchange').with_value('') + is_expected.to contain_keystone_config('oslo_messaging_amqp/pre_settled').with_value(['']) + is_expected.to contain_keystone_config('oslo_messaging_amqp/container_name').with_value('') + is_expected.to contain_keystone_config('oslo_messaging_amqp/idle_timeout').with_value('') + is_expected.to contain_keystone_config('oslo_messaging_amqp/trace').with_value('') + is_expected.to contain_keystone_config('oslo_messaging_amqp/ssl').with_value('') + is_expected.to contain_keystone_config('oslo_messaging_amqp/ssl_ca_file').with_value('') + is_expected.to contain_keystone_config('oslo_messaging_amqp/ssl_cert_file').with_value('') + is_expected.to contain_keystone_config('oslo_messaging_amqp/ssl_key_file').with_value('') + is_expected.to contain_keystone_config('oslo_messaging_amqp/ssl_key_password').with_value('').with_secret(true) + is_expected.to contain_keystone_config('oslo_messaging_amqp/allow_insecure_clients').with_value('') + is_expected.to contain_keystone_config('oslo_messaging_amqp/sasl_mechanisms').with_value('') + is_expected.to contain_keystone_config('oslo_messaging_amqp/sasl_config_dir').with_value('') + is_expected.to contain_keystone_config('oslo_messaging_amqp/sasl_config_name').with_value('') + is_expected.to contain_keystone_config('oslo_messaging_amqp/username').with_value('') + is_expected.to contain_keystone_config('oslo_messaging_amqp/password').with_value('').with_secret(true) + is_expected.to contain_keystone_config('oslo_messaging_amqp/default_send_timeout').with_value('') + is_expected.to contain_keystone_config('oslo_messaging_amqp/default_notify_timeout').with_value('') + end + + end + + context 'with overridden parameters' do + let :params do + { :idle_timeout => 2000, + :container_name => 'openstack', + :username => 'newuser', + :password => 'p@ssw0rd', + :pre_settled => ['rpc-cast','rpc-reply','notify'], + :ssl => true, + } + end + it 'configure oslo_messaging_amqp with overriden values' do + is_expected.to contain_keystone_config('oslo_messaging_amqp/idle_timeout').with_value(2000) + is_expected.to contain_keystone_config('oslo_messaging_amqp/container_name').with_value('openstack') + is_expected.to contain_keystone_config('oslo_messaging_amqp/username').with_value('newuser') + is_expected.to contain_keystone_config('oslo_messaging_amqp/password').with_value('p@ssw0rd').with_secret(true) + is_expected.to contain_keystone_config('oslo_messaging_amqp/pre_settled').with_value(['rpc-cast','rpc-reply','notify']) + is_expected.to contain_keystone_config('oslo_messaging_amqp/ssl').with_value(true) + end + + end + end + + on_supported_os({ + :supported_os => OSDefaults.get_supported_os + }).each do |os,facts| + context "on #{os}" do + let (:facts) do + facts.merge!(OSDefaults.get_facts()) + end + + it_behaves_like 'oslo-messaging-amqp' + end + end +end diff --git a/deployment_scripts/puppet/modules/oslo/spec/defines/oslo_messaging_default_spec.rb b/deployment_scripts/puppet/modules/oslo/spec/defines/oslo_messaging_default_spec.rb new file mode 100644 index 0000000..b51ac48 --- /dev/null +++ b/deployment_scripts/puppet/modules/oslo/spec/defines/oslo_messaging_default_spec.rb @@ -0,0 +1,46 @@ +require 'spec_helper' + +describe 'oslo::messaging::default' do + + let (:title) { 'keystone_config' } + + shared_examples 'oslo-messaging-default' do + + context 'with default parameters' do + it 'configure DEFAULT default params' do + is_expected.to contain_keystone_config('DEFAULT/rpc_response_timeout').with_value('') + is_expected.to contain_keystone_config('DEFAULT/transport_url').with_value('').with_secret(true) + is_expected.to contain_keystone_config('DEFAULT/control_exchange').with_value('') + end + + end + + context 'with overridden parameters' do + let :params do + { + :rpc_response_timeout => '42', + :transport_url => 'proto://url', + :control_exchange => 'openstack', + } + end + + it 'configure DEFAULT with overriden values' do + is_expected.to contain_keystone_config('DEFAULT/rpc_response_timeout').with_value('42') + is_expected.to contain_keystone_config('DEFAULT/transport_url').with_value('proto://url').with_secret(true) + is_expected.to contain_keystone_config('DEFAULT/control_exchange').with_value('openstack') + end + end + end + + on_supported_os({ + :supported_os => OSDefaults.get_supported_os + }).each do |os,facts| + context "on #{os}" do + let (:facts) do + facts.merge!(OSDefaults.get_facts()) + end + + it_behaves_like 'oslo-messaging-default' + end + end +end diff --git a/deployment_scripts/puppet/modules/oslo/spec/defines/oslo_messaging_notifications_spec.rb b/deployment_scripts/puppet/modules/oslo/spec/defines/oslo_messaging_notifications_spec.rb new file mode 100644 index 0000000..d3ca96b --- /dev/null +++ b/deployment_scripts/puppet/modules/oslo/spec/defines/oslo_messaging_notifications_spec.rb @@ -0,0 +1,59 @@ +require 'spec_helper' + +describe 'oslo::messaging::notifications' do + + let (:title) { 'keystone_config' } + + shared_examples 'oslo-messaging-notifications' do + + context 'with default parameters' do + it 'configure oslo_messaging_notifications default params' do + is_expected.to contain_keystone_config('oslo_messaging_notifications/driver').with_value('') + is_expected.to contain_keystone_config('oslo_messaging_notifications/transport_url').with_value('').with_secret(true) + is_expected.to contain_keystone_config('oslo_messaging_notifications/topics').with_value('') + end + + end + + context 'with overridden parameters' do + let :params do + { :driver => ['messaging'], + :transport_url => 'some_protocol://some_url', + :topics => ['notifications'], + } + end + + it 'configure oslo_messaging_notifications with overriden values' do + is_expected.to contain_keystone_config('oslo_messaging_notifications/driver').with_value('messaging') + is_expected.to contain_keystone_config('oslo_messaging_notifications/transport_url').with_value('some_protocol://some_url').with_secret(true) + is_expected.to contain_keystone_config('oslo_messaging_notifications/topics').with_value('notifications') + end + end + + context 'with string in list parameters' do + let :params do + { + :driver => 'messaging', + :topics => 'notifications', + } + end + + it 'configures oslo_messaging_notifications section with overriden list values as strings' do + is_expected.to contain_keystone_config('oslo_messaging_notifications/driver').with_value('messaging') + is_expected.to contain_keystone_config('oslo_messaging_notifications/topics').with_value('notifications') + end + end + end + + on_supported_os({ + :supported_os => OSDefaults.get_supported_os + }).each do |os,facts| + context "on #{os}" do + let (:facts) do + facts.merge!(OSDefaults.get_facts()) + end + + it_behaves_like 'oslo-messaging-notifications' + end + end +end diff --git a/deployment_scripts/puppet/modules/oslo/spec/defines/oslo_messaging_rabbit_spec.rb b/deployment_scripts/puppet/modules/oslo/spec/defines/oslo_messaging_rabbit_spec.rb new file mode 100644 index 0000000..99a7ec6 --- /dev/null +++ b/deployment_scripts/puppet/modules/oslo/spec/defines/oslo_messaging_rabbit_spec.rb @@ -0,0 +1,213 @@ +require 'spec_helper' + +describe 'oslo::messaging::rabbit' do + + let (:title) { 'keystone_config' } + + shared_examples 'oslo-messaging-rabbit' do + + context 'with default parameters' do + it 'configure oslo_messaging_rabbit default params' do + is_expected.to contain_keystone_config('oslo_messaging_rabbit/amqp_durable_queues').with_value('') + is_expected.to contain_keystone_config('oslo_messaging_rabbit/kombu_reconnect_delay').with_value('') + is_expected.to contain_keystone_config('oslo_messaging_rabbit/kombu_missing_consumer_retry_timeout').with_value('') + is_expected.to contain_keystone_config('oslo_messaging_rabbit/kombu_failover_strategy').with_value('') + is_expected.to contain_keystone_config('oslo_messaging_rabbit/kombu_compression').with_value('') + is_expected.to contain_keystone_config('oslo_messaging_rabbit/rabbit_host').with_value('') + is_expected.to contain_keystone_config('oslo_messaging_rabbit/rabbit_port').with_value('') + is_expected.to contain_keystone_config('oslo_messaging_rabbit/rabbit_hosts').with_value('') + is_expected.to contain_keystone_config('oslo_messaging_rabbit/ssl').with_value('') + is_expected.to contain_keystone_config('oslo_messaging_rabbit/rabbit_userid').with_value('') + is_expected.to contain_keystone_config('oslo_messaging_rabbit/rabbit_password').with_value('').with_secret(true) + is_expected.to contain_keystone_config('oslo_messaging_rabbit/rabbit_login_method').with_value('') + is_expected.to contain_keystone_config('oslo_messaging_rabbit/rabbit_virtual_host').with_value('') + is_expected.to contain_keystone_config('oslo_messaging_rabbit/rabbit_retry_interval').with_value('') + is_expected.to contain_keystone_config('oslo_messaging_rabbit/rabbit_retry_backoff').with_value('') + is_expected.to contain_keystone_config('oslo_messaging_rabbit/rabbit_interval_max').with_value('') + is_expected.to contain_keystone_config('oslo_messaging_rabbit/rabbit_max_retries').with_value('') + is_expected.to contain_keystone_config('oslo_messaging_rabbit/rabbit_ha_queues').with_value('') + is_expected.to contain_keystone_config('oslo_messaging_rabbit/rabbit_transient_queues_ttl').with_value('') + is_expected.to contain_keystone_config('oslo_messaging_rabbit/heartbeat_timeout_threshold').with_value('') + is_expected.to contain_keystone_config('oslo_messaging_rabbit/heartbeat_rate').with_value('') + is_expected.to contain_keystone_config('DEFAULT/rpc_backend').with_value('rabbit') + end + end + + context 'with overridden parameters' do + let :params do + { :rabbit_host => 'rabbit', + :rabbit_userid => 'rabbit_user', + :rabbit_port => '5673', + :rabbit_password => 'password', + :heartbeat_timeout_threshold => '60', + :heartbeat_rate => '10', + :rabbit_virtual_host => '/', + :kombu_compression => 'bz2', } + end + + it 'configures rabbit' do + is_expected.to contain_keystone_config('oslo_messaging_rabbit/rabbit_host').with_value('rabbit') + is_expected.to contain_keystone_config('oslo_messaging_rabbit/rabbit_password').with_value('password').with_secret(true) + is_expected.to contain_keystone_config('oslo_messaging_rabbit/rabbit_port').with_value('5673') + is_expected.to contain_keystone_config('oslo_messaging_rabbit/rabbit_userid').with_value('rabbit_user') + is_expected.to contain_keystone_config('oslo_messaging_rabbit/rabbit_virtual_host').with_value('/') + is_expected.to contain_keystone_config('oslo_messaging_rabbit/heartbeat_timeout_threshold').with_value('60') + is_expected.to contain_keystone_config('oslo_messaging_rabbit/heartbeat_rate').with_value('10') + is_expected.to contain_keystone_config('oslo_messaging_rabbit/kombu_compression').with_value('bz2') + end + end + + context 'with rabbit_hosts parameter (one server)' do + let :params do + { :rabbit_hosts => ['rabbit:5672'] } + end + + it 'configures rabbit' do + is_expected.to contain_keystone_config('oslo_messaging_rabbit/rabbit_host').with_value('') + is_expected.to contain_keystone_config('oslo_messaging_rabbit/rabbit_port').with_value('') + is_expected.to contain_keystone_config('oslo_messaging_rabbit/rabbit_hosts').with_value('rabbit:5672') + is_expected.to contain_keystone_config('oslo_messaging_rabbit/rabbit_ha_queues').with_value('') + end + end + + context 'with rabbit_hosts parameter' do + let :params do + { :rabbit_hosts => ['rabbit1:5672', 'rabbit2:5673'] } + end + + it 'configures rabbit' do + is_expected.to contain_keystone_config('oslo_messaging_rabbit/rabbit_host').with_value('') + is_expected.to contain_keystone_config('oslo_messaging_rabbit/rabbit_port').with_value('') + is_expected.to contain_keystone_config('oslo_messaging_rabbit/rabbit_hosts').with_value('rabbit1:5672,rabbit2:5673') + is_expected.to contain_keystone_config('oslo_messaging_rabbit/rabbit_ha_queues').with_value(true) + end + end + + context 'with rabbit_hosts parameter and disabled rabbit_ha_queues' do + let :params do + { :rabbit_hosts => ['rabbit1:5672', 'rabbit2:5673'], + :rabbit_ha_queues => false, } + end + + it 'configures rabbit' do + is_expected.to contain_keystone_config('oslo_messaging_rabbit/rabbit_host').with_value('') + is_expected.to contain_keystone_config('oslo_messaging_rabbit/rabbit_port').with_value('') + is_expected.to contain_keystone_config('oslo_messaging_rabbit/rabbit_hosts').with_value('rabbit1:5672,rabbit2:5673') + is_expected.to contain_keystone_config('oslo_messaging_rabbit/rabbit_ha_queues').with_value(false) + end + end + + context 'with rabbit ssl enabled with kombu' do + let :params do + { :rabbit_use_ssl => true, + :kombu_ssl_ca_certs => '/etc/ca.cert', + :kombu_ssl_certfile => '/etc/certfile', + :kombu_ssl_keyfile => '/etc/key', + :kombu_ssl_version => 'TLSv1', } + end + + it 'configures rabbit' do + is_expected.to contain_keystone_config('oslo_messaging_rabbit/ssl').with_value(true) + is_expected.to contain_keystone_config('oslo_messaging_rabbit/ssl_ca_file').with_value('/etc/ca.cert') + is_expected.to contain_keystone_config('oslo_messaging_rabbit/ssl_cert_file').with_value('/etc/certfile') + is_expected.to contain_keystone_config('oslo_messaging_rabbit/ssl_key_file').with_value('/etc/key') + is_expected.to contain_keystone_config('oslo_messaging_rabbit/ssl_version').with_value('TLSv1') + end + end + + context 'with rabbit ssl enabled without kombu' do + let :params do + { :rabbit_use_ssl => true } + end + + it 'configures rabbit' do + is_expected.to contain_keystone_config('oslo_messaging_rabbit/ssl').with_value(true) + is_expected.to contain_keystone_config('oslo_messaging_rabbit/ssl_ca_file').with_value('') + is_expected.to contain_keystone_config('oslo_messaging_rabbit/ssl_cert_file').with_value('') + is_expected.to contain_keystone_config('oslo_messaging_rabbit/ssl_key_file').with_value('') + is_expected.to contain_keystone_config('oslo_messaging_rabbit/ssl_version').with_value('') + end + end + + context 'with rabbit host set without rabbit port' do + let :params do + { :rabbit_host => 'rabbit1' } + end + + it 'configures rabbit' do + is_expected.to contain_keystone_config('oslo_messaging_rabbit/rabbit_host').with_value('rabbit1') + is_expected.to contain_keystone_config('oslo_messaging_rabbit/rabbit_port').with_value('') + is_expected.to contain_keystone_config('oslo_messaging_rabbit/rabbit_hosts').with_value('') + is_expected.to contain_keystone_config('oslo_messaging_rabbit/rabbit_ha_queues').with_value('') + end + end + + context 'with rabbit host and port' do + let :params do + { :rabbit_host => 'rabbit1', + :rabbit_port => '5673' } + end + + it 'configures rabbit' do + is_expected.to contain_keystone_config('oslo_messaging_rabbit/rabbit_host').with_value('rabbit1') + is_expected.to contain_keystone_config('oslo_messaging_rabbit/rabbit_port').with_value('5673') + is_expected.to contain_keystone_config('oslo_messaging_rabbit/rabbit_hosts').with_value('') + is_expected.to contain_keystone_config('oslo_messaging_rabbit/rabbit_ha_queues').with_value('') + end + end + + context 'with incorrect kombu compression' do + let :params do + { :kombu_compression => 'foo' } + end + + it { is_expected.to raise_error Puppet::Error, /Unsupported Kombu compression. Possible values are gzip and bz2/ } + end + + context 'with kombu_ssl_ca_certs enabled without ssl usage' do + let :params do + { :kombu_ssl_ca_certs => '/etc/ca.cert' } + end + + it { is_expected.to raise_error Puppet::Error, /The kombu_ssl_ca_certs parameter requires rabbit_use_ssl to be set to true/ } + end + + context 'with kombu_ssl_certfile set without rabbit ssl usage' do + let :params do + { :kombu_ssl_certfile => '/tmp/foo' } + end + + it { is_expected.to raise_error Puppet::Error, /The kombu_ssl_certfile parameter requires rabbit_use_ssl to be set to true/ } + end + + context 'with kombu_ssl_version set without rabbit ssl usage' do + let :params do + { :kombu_ssl_version => 'foo' } + end + + it { is_expected.to raise_error Puppet::Error, /The kombu_ssl_version parameter requires rabbit_use_ssl to be set to true/ } + end + + context 'with string in list parameters' do + let :params do + { :rabbit_hosts => 'rabbit1:5672,rabbit2:5673' } + end + + it 'configures rabbit with overriden list values as strings' do + is_expected.to contain_keystone_config('oslo_messaging_rabbit/rabbit_hosts').with_value('rabbit1:5672,rabbit2:5673') + end + end + end + + on_supported_os({ + :supported_os => OSDefaults.get_supported_os + }).each do |os,facts| + context "on #{os}" do + let (:facts) do + facts.merge!(OSDefaults.get_facts()) + end + + it_behaves_like 'oslo-messaging-rabbit' + end + end +end diff --git a/deployment_scripts/puppet/modules/oslo/spec/defines/oslo_messaging_zmq_spec.rb b/deployment_scripts/puppet/modules/oslo/spec/defines/oslo_messaging_zmq_spec.rb new file mode 100644 index 0000000..9e423f8 --- /dev/null +++ b/deployment_scripts/puppet/modules/oslo/spec/defines/oslo_messaging_zmq_spec.rb @@ -0,0 +1,66 @@ +require 'spec_helper' + +describe 'oslo::messaging::zmq' do + + let (:title) { 'keystone_config' } + + shared_examples 'oslo-messaging-zmq' do + + context 'with default parameters' do + it 'configure zmq default params' do + is_expected.to contain_keystone_config('DEFAULT/rpc_cast_timeout').with_value('') + is_expected.to contain_keystone_config('DEFAULT/rpc_poll_timeout').with_value('') + is_expected.to contain_keystone_config('DEFAULT/rpc_zmq_bind_address').with_value('') + is_expected.to contain_keystone_config('DEFAULT/rpc_zmq_bind_port_retries').with_value('') + is_expected.to contain_keystone_config('DEFAULT/rpc_zmq_concurrency').with_value('') + is_expected.to contain_keystone_config('DEFAULT/rpc_zmq_contexts').with_value('') + is_expected.to contain_keystone_config('DEFAULT/rpc_zmq_host').with_value('') + is_expected.to contain_keystone_config('DEFAULT/rpc_zmq_ipc_dir').with_value('') + is_expected.to contain_keystone_config('DEFAULT/rpc_zmq_matchmaker').with_value('') + is_expected.to contain_keystone_config('DEFAULT/rpc_zmq_max_port').with_value('') + is_expected.to contain_keystone_config('DEFAULT/rpc_zmq_min_port').with_value('') + is_expected.to contain_keystone_config('DEFAULT/rpc_zmq_topic_backlog').with_value('') + is_expected.to contain_keystone_config('DEFAULT/use_pub_sub').with_value('') + is_expected.to contain_keystone_config('DEFAULT/zmq_target_expire').with_value('') + end + + end + + context 'with overridden parameters' do + let :params do + { :rpc_zmq_bind_address => '0.0.0.0', + :rpc_zmq_bind_port_retries => '10', + :rpc_zmq_concurrency => 'native', + :rpc_zmq_contexts => '2', + } + end + + it 'configure zmq with overriden values' do + is_expected.to contain_keystone_config('DEFAULT/rpc_zmq_bind_address').with_value('0.0.0.0') + is_expected.to contain_keystone_config('DEFAULT/rpc_zmq_bind_port_retries').with_value('10') + is_expected.to contain_keystone_config('DEFAULT/rpc_zmq_concurrency').with_value('native') + is_expected.to contain_keystone_config('DEFAULT/rpc_zmq_contexts').with_value('2') + end + end + + context 'with wrong zmq concurrency' do + let :params do + { :rpc_zmq_concurrency => 'some_another' } + end + + it_raises 'a Puppet::Error', /Unsupported type of zmq concurrency is used/ + end + end + + on_supported_os({ + :supported_os => OSDefaults.get_supported_os + }).each do |os,facts| + context "on #{os}" do + let (:facts) do + facts.merge!(OSDefaults.get_facts()) + end + + it_behaves_like 'oslo-messaging-zmq' + end + end +end diff --git a/deployment_scripts/puppet/modules/oslo/spec/defines/oslo_middleware_spec.rb b/deployment_scripts/puppet/modules/oslo/spec/defines/oslo_middleware_spec.rb new file mode 100644 index 0000000..0b3ad14 --- /dev/null +++ b/deployment_scripts/puppet/modules/oslo/spec/defines/oslo_middleware_spec.rb @@ -0,0 +1,43 @@ +require 'spec_helper' + +describe 'oslo::middleware' do + + let (:title) { 'keystone_config' } + + shared_examples 'shared examples' do + + context 'with default parameters' do + it 'configure oslo_middleware default params' do + is_expected.to contain_keystone_config('oslo_middleware/max_request_body_size').with_value('') + is_expected.to contain_keystone_config('oslo_middleware/enable_proxy_headers_parsing').with_value('') + end + + end + + context 'with overridden parameters' do + let :params do + { + :max_request_body_size => 114600, + :enable_proxy_headers_parsing => true, + } + end + it 'configure oslo_middleware with overriden values' do + is_expected.to contain_keystone_config('oslo_middleware/max_request_body_size').with_value(114600) + is_expected.to contain_keystone_config('oslo_middleware/enable_proxy_headers_parsing').with_value(true) + end + + end + end + + on_supported_os({ + :supported_os => OSDefaults.get_supported_os + }).each do |os,facts| + context "on #{os}" do + let (:facts) do + facts.merge!(OSDefaults.get_facts()) + end + + include_examples 'shared examples' + end + end +end diff --git a/deployment_scripts/puppet/modules/oslo/spec/defines/oslo_policy_spec.rb b/deployment_scripts/puppet/modules/oslo/spec/defines/oslo_policy_spec.rb new file mode 100644 index 0000000..96ecfd4 --- /dev/null +++ b/deployment_scripts/puppet/modules/oslo/spec/defines/oslo_policy_spec.rb @@ -0,0 +1,57 @@ +require 'spec_helper' + +describe 'oslo::policy' do + + let (:title) { 'keystone_config' } + + shared_examples 'oslo-policy' do + + context 'with default parameters' do + it 'configure oslo_policy default params' do + is_expected.to contain_keystone_config('oslo_policy/policy_file').with_value('') + is_expected.to contain_keystone_config('oslo_policy/policy_default_rule').with_value('') + is_expected.to contain_keystone_config('oslo_policy/policy_dirs').with_value('') + end + end + + context 'with overridden parameters' do + let :params do + { + :policy_file => '/path/to/policy.file', + :policy_default_rule => 'some rule', + :policy_dirs => ['dir1', '/dir/2'], + } + end + + it 'configures oslo_policy section' do + is_expected.to contain_keystone_config('oslo_policy/policy_file').with_value('/path/to/policy.file') + is_expected.to contain_keystone_config('oslo_policy/policy_default_rule').with_value('some rule') + is_expected.to contain_keystone_config('oslo_policy/policy_dirs').with_value('dir1,/dir/2') + end + end + + context 'with string in list parameters' do + let :params do + { + :policy_dirs => 'dir1,/dir/2', + } + end + + it 'configures oslo_policy section with overriden list values as strings' do + is_expected.to contain_keystone_config('oslo_policy/policy_dirs').with_value('dir1,/dir/2') + end + end + end + + on_supported_os({ + :supported_os => OSDefaults.get_supported_os + }).each do |os,facts| + context "on #{os}" do + let (:facts) do + facts.merge!(OSDefaults.get_facts()) + end + + it_behaves_like 'oslo-policy' + end + end +end diff --git a/deployment_scripts/puppet/modules/oslo/spec/defines/oslo_privsep_spec.rb b/deployment_scripts/puppet/modules/oslo/spec/defines/oslo_privsep_spec.rb new file mode 100644 index 0000000..8aaecf7 --- /dev/null +++ b/deployment_scripts/puppet/modules/oslo/spec/defines/oslo_privsep_spec.rb @@ -0,0 +1,53 @@ +require 'spec_helper' + +describe 'oslo::privsep' do + + let (:title) { 'osbrick' } + + let :params do + { :config => 'keystone_config' } + end + + shared_examples 'oslo-privsep' do + + context 'with default parameters' do + it 'configure oslo_privsep default params' do + is_expected.to contain_keystone_config('privsep_osbrick/user').with_value('') + is_expected.to contain_keystone_config('privsep_osbrick/group').with_value('') + is_expected.to contain_keystone_config('privsep_osbrick/capabilities').with_value('') + is_expected.to contain_keystone_config('privsep_osbrick/helper_command').with_value('') + end + end + + context 'with overridden parameters' do + before do + params.merge!({ + :user => 'keystone', + :group => 'keystone', + :capabilities => [], + :helper_command => 'sudo nova-rootwrap /etc/nova/rootwrap.conf privsep-helper --config-file /etc/nova/nova.conf', + }) + end + + it 'configures oslo_privsep section' do + is_expected.to contain_keystone_config('privsep_osbrick/user').with_value('keystone') + is_expected.to contain_keystone_config('privsep_osbrick/group').with_value('keystone') + is_expected.to contain_keystone_config('privsep_osbrick/capabilities').with_value([]) + is_expected.to contain_keystone_config('privsep_osbrick/helper_command').with_value('sudo nova-rootwrap /etc/nova/rootwrap.conf privsep-helper --config-file /etc/nova/nova.conf') + end + end + + end + + on_supported_os({ + :supported_os => OSDefaults.get_supported_os + }).each do |os,facts| + context "on #{os}" do + let (:facts) do + facts.merge!(OSDefaults.get_facts()) + end + + it_behaves_like 'oslo-privsep' + end + end +end diff --git a/deployment_scripts/puppet/modules/oslo/spec/defines/oslo_service_spec.rb b/deployment_scripts/puppet/modules/oslo/spec/defines/oslo_service_spec.rb new file mode 100644 index 0000000..9503d9e --- /dev/null +++ b/deployment_scripts/puppet/modules/oslo/spec/defines/oslo_service_spec.rb @@ -0,0 +1,88 @@ +require 'spec_helper' + +describe 'oslo::service' do + + let (:title) { 'keystone_config' } + + shared_examples 'oslo-service' do + + context 'with default parameters' do + it 'configure oslo_service with default params' do + is_expected.to contain_keystone_config('DEFAULT/api_paste_config').with_value('') + is_expected.to contain_keystone_config('DEFAULT/backdoor_port').with_value('') + is_expected.to contain_keystone_config('DEFAULT/backdoor_socket').with_value('') + is_expected.to contain_keystone_config('DEFAULT/client_socket_timeout').with_value('') + is_expected.to contain_keystone_config('DEFAULT/graceful_shutdown_timeout').with_value('') + is_expected.to contain_keystone_config('DEFAULT/log_options').with_value('') + is_expected.to contain_keystone_config('DEFAULT/max_header_line').with_value('') + is_expected.to contain_keystone_config('DEFAULT/run_external_periodic_tasks').with_value('') + is_expected.to contain_keystone_config('DEFAULT/tcp_keepidle').with_value('') + is_expected.to contain_keystone_config('DEFAULT/wsgi_default_pool_size').with_value('') + is_expected.to contain_keystone_config('DEFAULT/wsgi_keep_alive').with_value('') + is_expected.to contain_keystone_config('DEFAULT/wsgi_log_format').with_value('') + is_expected.to contain_keystone_config('ssl/ca_file').with_value('') + is_expected.to contain_keystone_config('ssl/cert_file').with_value('') + is_expected.to contain_keystone_config('ssl/ciphers').with_value('') + is_expected.to contain_keystone_config('ssl/key_file').with_value('') + is_expected.to contain_keystone_config('ssl/version').with_value('') + end + end + + context 'with overridden parameters' do + let :params do + { + :api_paste_config => 'api-paste.ini', + :backdoor_port => '1234', + :backdoor_socket => 'backdoor.sock', + :client_socket_timeout => '900', + :graceful_shutdown_timeout => '60', + :log_options => true, + :max_header_line => '16384', + :run_external_periodic_tasks => true, + :tcp_keepidle => '600', + :wsgi_default_pool_size => '1000', + :wsgi_keep_alive => true, + :wsgi_log_format => '%(client_ip)s "%(request_line)s" status: %(status_code)s len: %(body_length)s time: %(wall_seconds).7f', + :ca_file => '/path/to/ca/file', + :cert_file => '/path/to/cert/file', + :ciphers => 'HIGH:!RC4:!MD5:!aNULL:!eNULL:!EXP:!LOW:!MEDIUM', + :key_file => '/path/to/key/file', + :version => 'TLSv1', + } + end + + it 'configures default and ssl sections' do + is_expected.to contain_keystone_config('DEFAULT/api_paste_config').with_value('api-paste.ini') + is_expected.to contain_keystone_config('DEFAULT/backdoor_port').with_value('1234') + is_expected.to contain_keystone_config('DEFAULT/backdoor_socket').with_value('backdoor.sock') + is_expected.to contain_keystone_config('DEFAULT/client_socket_timeout').with_value('900') + is_expected.to contain_keystone_config('DEFAULT/graceful_shutdown_timeout').with_value('60') + is_expected.to contain_keystone_config('DEFAULT/log_options').with_value(true) + is_expected.to contain_keystone_config('DEFAULT/max_header_line').with_value('16384') + is_expected.to contain_keystone_config('DEFAULT/run_external_periodic_tasks').with_value(true) + is_expected.to contain_keystone_config('DEFAULT/tcp_keepidle').with_value('600') + is_expected.to contain_keystone_config('DEFAULT/wsgi_default_pool_size').with_value('1000') + is_expected.to contain_keystone_config('DEFAULT/wsgi_keep_alive').with_value(true) + is_expected.to contain_keystone_config('DEFAULT/wsgi_log_format').with_value( + '%(client_ip)s "%(request_line)s" status: %(status_code)s len: %(body_length)s time: %(wall_seconds).7f') + is_expected.to contain_keystone_config('ssl/ca_file').with_value('/path/to/ca/file') + is_expected.to contain_keystone_config('ssl/cert_file').with_value('/path/to/cert/file') + is_expected.to contain_keystone_config('ssl/ciphers').with_value('HIGH:!RC4:!MD5:!aNULL:!eNULL:!EXP:!LOW:!MEDIUM') + is_expected.to contain_keystone_config('ssl/key_file').with_value('/path/to/key/file') + is_expected.to contain_keystone_config('ssl/version').with_value('TLSv1') + end + end + end + + on_supported_os({ + :supported_os => OSDefaults.get_supported_os + }).each do |os,facts| + context "on #{os}" do + let (:facts) do + facts.merge!(OSDefaults.get_facts()) + end + + it_behaves_like 'oslo-service' + end + end +end diff --git a/deployment_scripts/puppet/modules/oslo/spec/defines/oslo_versionedobjects_spec.rb b/deployment_scripts/puppet/modules/oslo/spec/defines/oslo_versionedobjects_spec.rb new file mode 100644 index 0000000..e975ab5 --- /dev/null +++ b/deployment_scripts/puppet/modules/oslo/spec/defines/oslo_versionedobjects_spec.rb @@ -0,0 +1,40 @@ +require 'spec_helper' + +describe 'oslo::versionedobjects' do + + let (:title) { 'keystone_config' } + + shared_examples 'oslo-versionedobjects' do + + context 'with default parameters' do + it 'configure oslo_versionedobjects default params' do + is_expected.to contain_keystone_config('oslo_versionedobjects/fatal_exception_format_errors').with_value('') + end + + end + + context 'with overridden parameters' do + let :params do + { :fatal_exception_format_errors => true, + } + end + it 'configure oslo_versionedobjects with overriden values' do + is_expected.to contain_keystone_config('oslo_versionedobjects/fatal_exception_format_errors').with_value(true) + end + + end + end + + on_supported_os({ + :supported_os => OSDefaults.get_supported_os + }).each do |os,facts| + context "on #{os}" do + let (:facts) do + facts.merge!(OSDefaults.get_facts()) + end + + it_behaves_like 'oslo-versionedobjects' + end + end + +end diff --git a/deployment_scripts/puppet/modules/oslo/spec/shared_examples.rb b/deployment_scripts/puppet/modules/oslo/spec/shared_examples.rb new file mode 100644 index 0000000..fec0eac --- /dev/null +++ b/deployment_scripts/puppet/modules/oslo/spec/shared_examples.rb @@ -0,0 +1,5 @@ +shared_examples_for "a Puppet::Error" do |description| + it "with message matching #{description.inspect}" do + expect { is_expected.to have_class_count(1) }.to raise_error(Puppet::Error, description) + end +end diff --git a/deployment_scripts/puppet/modules/oslo/spec/spec_helper.rb b/deployment_scripts/puppet/modules/oslo/spec/spec_helper.rb new file mode 100644 index 0000000..cad00b1 --- /dev/null +++ b/deployment_scripts/puppet/modules/oslo/spec/spec_helper.rb @@ -0,0 +1,10 @@ +require 'puppetlabs_spec_helper/module_spec_helper' +require 'shared_examples' +require 'puppet-openstack_spec_helper/facts' + +RSpec.configure do |c| + c.alias_it_should_behave_like_to :it_configures, 'configures' + c.alias_it_should_behave_like_to :it_raises, 'raises' +end + +at_exit { RSpec::Puppet::Coverage.report! } diff --git a/deployment_scripts/puppet/modules/oslo/spec/spec_helper_acceptance.rb b/deployment_scripts/puppet/modules/oslo/spec/spec_helper_acceptance.rb new file mode 100644 index 0000000..9196bc9 --- /dev/null +++ b/deployment_scripts/puppet/modules/oslo/spec/spec_helper_acceptance.rb @@ -0,0 +1 @@ +require 'puppet-openstack_spec_helper/beaker_spec_helper' diff --git a/deployment_scripts/puppet/modules/oslo/spec/unit/provider/oslo_config/ini_setting_spec.rb b/deployment_scripts/puppet/modules/oslo/spec/unit/provider/oslo_config/ini_setting_spec.rb new file mode 100644 index 0000000..6278391 --- /dev/null +++ b/deployment_scripts/puppet/modules/oslo/spec/unit/provider/oslo_config/ini_setting_spec.rb @@ -0,0 +1,68 @@ +# +# these tests are a little concerning b/c they are hacking around the +# modulepath, so these tests will not catch issues that may eventually arise +# related to loading these plugins. +# I could not, for the life of me, figure out how to programatcally set the modulepath +$LOAD_PATH.push( + File.join( + File.dirname(__FILE__), + '..', + '..', + '..', + 'fixtures', + 'modules', + 'inifile', + 'lib') +) +$LOAD_PATH.push( + File.join( + File.dirname(__FILE__), + '..', + '..', + '..', + 'fixtures', + 'modules', + 'openstacklib', + 'lib') +) +require 'spec_helper' +provider_class = Puppet::Type.type(:oslo_config).provider(:ini_setting) +describe provider_class do + + it 'should default to the default setting when no other one is specified' do + resource = Puppet::Type::Oslo_config.new( + {:name => 'DEFAULT/foo', :value => 'bar'} + ) + provider = provider_class.new(resource) + expect(provider.section).to eq('DEFAULT') + expect(provider.setting).to eq('foo') + end + + it 'should allow setting to be set explicitly' do + resource = Puppet::Type::Oslo_config.new( + {:name => 'dude/foo', :value => 'bar'} + ) + provider = provider_class.new(resource) + expect(provider.section).to eq('dude') + expect(provider.setting).to eq('foo') + end + + it 'should ensure absent when is specified as a value' do + resource = Puppet::Type::Oslo_config.new( + {:name => 'dude/foo', :value => ''} + ) + provider = provider_class.new(resource) + provider.exists? + expect(resource[:ensure]).to eq :absent + end + + it 'should ensure absent when value matches ensure_absent_val' do + resource = Puppet::Type::Oslo_config.new( + {:name => 'dude/foo', :value => 'foo', :ensure_absent_val => 'foo' } + ) + provider = provider_class.new(resource) + provider.exists? + expect(resource[:ensure]).to eq :absent + end + +end diff --git a/deployment_scripts/puppet/modules/oslo/spec/unit/type/oslo_config_spec.rb b/deployment_scripts/puppet/modules/oslo/spec/unit/type/oslo_config_spec.rb new file mode 100644 index 0000000..79461c5 --- /dev/null +++ b/deployment_scripts/puppet/modules/oslo/spec/unit/type/oslo_config_spec.rb @@ -0,0 +1,64 @@ +require 'puppet' +require 'puppet/type/oslo_config' +describe 'Puppet::Type.type(:oslo_config)' do + before :each do + @oslo_config = Puppet::Type.type(:oslo_config).new(:name => 'DEFAULT/foo', :value => 'bar') + end + + it 'should require a name' do + expect { + Puppet::Type.type(:oslo_config).new({}) + }.to raise_error(Puppet::Error, 'Title or name must be provided') + end + + it 'should not expect a name with whitespace' do + expect { + Puppet::Type.type(:oslo_config).new(:name => 'f oo') + }.to raise_error(Puppet::Error, /Parameter name failed/) + end + + it 'should fail when there is no section' do + expect { + Puppet::Type.type(:oslo_config).new(:name => 'foo') + }.to raise_error(Puppet::Error, /Parameter name failed/) + end + + it 'should not require a value when ensure is absent' do + Puppet::Type.type(:oslo_config).new(:name => 'DEFAULT/foo', :ensure => :absent) + end + + it 'should accept a valid value' do + @oslo_config[:value] = 'bar' + expect(@oslo_config[:value]).to eq('bar') + end + + it 'should not accept a value with whitespace' do + @oslo_config[:value] = 'b ar' + expect(@oslo_config[:value]).to eq('b ar') + end + + it 'should accept valid ensure values' do + @oslo_config[:ensure] = :present + expect(@oslo_config[:ensure]).to eq(:present) + @oslo_config[:ensure] = :absent + expect(@oslo_config[:ensure]).to eq(:absent) + end + + it 'should not accept invalid ensure values' do + expect { + @oslo_config[:ensure] = :latest + }.to raise_error(Puppet::Error, /Invalid value/) + end + + it 'should autorequire the package that install the file' do + catalog = Puppet::Resource::Catalog.new + package = Puppet::Type.type(:package).new(:name => 'oslo') + catalog.add_resource package, @oslo_config + dependency = @oslo_config.autorequire + expect(dependency.size).to eq(1) + expect(dependency[0].target).to eq(@oslo_config) + expect(dependency[0].source).to eq(package) + end + + +end diff --git a/deployment_scripts/puppet/modules/oslo/test-requirements.txt b/deployment_scripts/puppet/modules/oslo/test-requirements.txt new file mode 100644 index 0000000..1ea50a8 --- /dev/null +++ b/deployment_scripts/puppet/modules/oslo/test-requirements.txt @@ -0,0 +1,7 @@ +# This is required for the docs build jobs +sphinx>=1.5.1 # BSD +oslosphinx>=4.7.0 # Apache-2.0 + +# This is required for the releasenotes build jobs +# FIXME: reno is manually pinned to !=2.0.0 because of bug #1651995 +reno>=1.8.0,!=2.0.0 # Apache-2.0 diff --git a/deployment_scripts/puppet/modules/oslo/tests/init.pp b/deployment_scripts/puppet/modules/oslo/tests/init.pp new file mode 100644 index 0000000..3e55da7 --- /dev/null +++ b/deployment_scripts/puppet/modules/oslo/tests/init.pp @@ -0,0 +1,12 @@ +# The baseline for module testing used by Puppet Labs is that each manifest +# should have a corresponding test manifest that declares that class or defined +# type. +# +# Tests are then run by using puppet apply --noop (to check for compilation +# errors and view a log of events) or by fully applying the test in a virtual +# environment (to compare the resulting system state to the desired state). +# +# Learn more about module testing here: +# http://docs.puppetlabs.com/guides/tests_smoke.html +# +include ::oslo diff --git a/deployment_scripts/puppet/modules/oslo/tox.ini b/deployment_scripts/puppet/modules/oslo/tox.ini new file mode 100644 index 0000000..aea06c8 --- /dev/null +++ b/deployment_scripts/puppet/modules/oslo/tox.ini @@ -0,0 +1,8 @@ +[tox] +minversion = 1.6 +skipsdist = True +envlist = releasenotes + +[testenv:releasenotes] +deps = -rtest-requirements.txt +commands = sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html diff --git a/deployment_scripts/puppet/modules/tempest/.rspec b/deployment_scripts/puppet/modules/tempest/.rspec new file mode 100644 index 0000000..8c18f1a --- /dev/null +++ b/deployment_scripts/puppet/modules/tempest/.rspec @@ -0,0 +1,2 @@ +--format documentation +--color diff --git a/deployment_scripts/puppet/modules/tempest/CHANGELOG.md b/deployment_scripts/puppet/modules/tempest/CHANGELOG.md new file mode 100644 index 0000000..2900947 --- /dev/null +++ b/deployment_scripts/puppet/modules/tempest/CHANGELOG.md @@ -0,0 +1,89 @@ +## 8.0.0 and beyond + +From 8.0.0 release and beyond, release notes are published on +[docs.openstack.org](http://docs.openstack.org/releasenotes/puppet-tempest/). + +##2015-11-25 - 7.0.0 +###Summary + +This is a backwards-compatible major release for OpenStack Liberty. + +####Features +- allow to enable/disable Aodh service +- allow to enable/disable Trove service +- allow to enable/disable Sahara service +- add dashboard parameters +- add basic scenarios options +- allow to optionally git clone tempest +- reflect provider change in puppet-openstacklib + +####Bugfixes +- make sure neutron network is created before Tempest_neutron_net_id_setter +- glance_id_setter: execute after creating Glance image +- fix ocnfiguration for glance/neutron setters + +####Maintenance +- initial msync run for all Puppet OpenStack modules +- try to use zuul-cloner to prepare fixtures +- remove class_parameter_defaults puppet-lint check + +##2015-10-10 - 6.1.0 +###Summary + +This is a maintenance and features release in Kilo series. + +The tempest.conf.sample does not exist anymore so we need to stop relying on +this file to create the tempest.conf configuration file. + +####Features +- Add tempest::config class +- Add config parameters to run Keystone v3 tests + +####Maintenance +- acceptance: checkout stable/kilo puppet modules + +####Bugfixes +- do not create tempest.conf from .sample file + +##2015-07-08 - 6.0.0 +###Summary + +This is a major release for OpenStack Kilo. + +####Features +- Puppet 4.x support +- Allow to activate Ceilometer tests +- Allow to not manage Tempest code in Puppet +- Implement more Tempest options + +####Maintenance +- Acceptance tests with Beaker + +##2015-06-17 - 5.1.0 +###Summary + +This is a feature and maintenance release in the Juno series. + +####Features +- Allow to not manage Tempest code in Puppet +- Allow to activate Ceilometer tests + +####Maintenance +- spec: pin rspec-puppet to 1.0.1 +- Update .gitreview file for project rename + +##2014-11-22 - 5.0.0 +###Summary + +Stable Juno release. + +####Features +- Add ability to hide secrets from puppet logs + +####Bugfixes +- Removed orphaned os_concat function + +####Maintenance +- Pin vcsrepo dependency to 2.x +- Bump stdlib dependency to 4.x +- Remove dependencies on mysql and postgresql devel libraries diff --git a/deployment_scripts/puppet/modules/tempest/Gemfile b/deployment_scripts/puppet/modules/tempest/Gemfile new file mode 100644 index 0000000..1fab608 --- /dev/null +++ b/deployment_scripts/puppet/modules/tempest/Gemfile @@ -0,0 +1,21 @@ +source ENV['GEM_SOURCE'] || "https://rubygems.org" + +group :development, :test, :system_tests do + gem 'puppet-openstack_spec_helper', + :git => 'https://git.openstack.org/openstack/puppet-openstack_spec_helper', + :require => false +end + +if facterversion = ENV['FACTER_GEM_VERSION'] + gem 'facter', facterversion, :require => false +else + gem 'facter', :require => false +end + +if puppetversion = ENV['PUPPET_GEM_VERSION'] + gem 'puppet', puppetversion, :require => false +else + gem 'puppet', :require => false +end + +# vim:ft=ruby diff --git a/deployment_scripts/puppet/modules/tempest/LICENSE b/deployment_scripts/puppet/modules/tempest/LICENSE new file mode 100644 index 0000000..88a11a0 --- /dev/null +++ b/deployment_scripts/puppet/modules/tempest/LICENSE @@ -0,0 +1,13 @@ +Copyright 2012 OpenStack Foundation + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/deployment_scripts/puppet/modules/tempest/README.md b/deployment_scripts/puppet/modules/tempest/README.md new file mode 100644 index 0000000..b945a62 --- /dev/null +++ b/deployment_scripts/puppet/modules/tempest/README.md @@ -0,0 +1,29 @@ +Team and repository tags +======================== + +[![Team and repository tags](http://governance.openstack.org/badges/puppet-tempest.svg)](http://governance.openstack.org/reference/tags/index.html) + + + +Tempest +======= + +Module for installing and configuring tempest. + +Tempest is the test suite that can be used to run integration +tests on an installed openstack environment. + +This module assumes the provisioning of the initial OpenStack +resources has been done beforehand. + +Beaker-Rspec +------------ + +This module has beaker-rspec tests + +To run: + +``shell +bundle install +bundle exec rspec spec/acceptance +`` diff --git a/deployment_scripts/puppet/modules/tempest/Rakefile b/deployment_scripts/puppet/modules/tempest/Rakefile new file mode 100644 index 0000000..168d108 --- /dev/null +++ b/deployment_scripts/puppet/modules/tempest/Rakefile @@ -0,0 +1 @@ +require 'puppet-openstack_spec_helper/rake_tasks' diff --git a/deployment_scripts/puppet/modules/tempest/bindep.txt b/deployment_scripts/puppet/modules/tempest/bindep.txt new file mode 100644 index 0000000..e69de29 diff --git a/deployment_scripts/puppet/modules/tempest/lib/puppet/provider/tempest.rb b/deployment_scripts/puppet/modules/tempest/lib/puppet/provider/tempest.rb new file mode 100644 index 0000000..68d145c --- /dev/null +++ b/deployment_scripts/puppet/modules/tempest/lib/puppet/provider/tempest.rb @@ -0,0 +1,51 @@ +require 'puppet/util/inifile' +require 'puppet/provider/openstack' +require 'puppet/provider/openstack/auth' +require 'puppet/provider/openstack/credentials' +class Puppet::Provider::Tempest < Puppet::Provider::Openstack + + extend Puppet::Provider::Openstack::Auth + + def self.tempest_file + return @tempest_file if @tempest_file + @tempest_file = Puppet::Util::IniConfig::File.new + @tempest_file.read(@file_path) + @tempest_file + end + + def self.request(service, action, properties=[], file_path) + @file_path = file_path + begin + super(service, action, properties) + rescue Puppet::Error::OpenstackAuthInputError => error + tempest_request(service, action, error, properties) + end + end + + def self.tempest_request(service, action, error, properties=nil) + @credentials.username = tempest_credentials['admin_user'] + @credentials.password = tempest_credentials['admin_password'] + @credentials.project_name = tempest_credentials['admin_project_name'] + @credentials.auth_url = tempest_credentials['auth_endpoint'] + if @credentials.version == '3' + @credentials.user_domain_name = tempest_credentials['admin_domain_name'] + @credentials.project_domain_name = tempest_credentials['admin_domain_name'] + @credentials.auth_url = tempest_credentials['auth_endpoint_v3'] + end + raise error unless @credentials.set? + Puppet::Provider::Openstack.request(service, action, properties, @credentials) + end + + def self.tempest_credentials + t = {} + t['admin_user'] = tempest_file['auth']['admin_username'] + t['admin_password'] = tempest_file['auth']['admin_password'] + t['admin_project_name'] = tempest_file['auth']['admin_project_name'] + t['auth_endpoint'] = tempest_file['identity']['uri'] + t['auth_endpoint_v3'] = tempest_file['identity']['uri_v3'] + t['admin_domain_name'] = tempest_file['auth']['admin_domain_name'] + return t + end + + +end diff --git a/deployment_scripts/puppet/modules/tempest/lib/puppet/provider/tempest_config/ini_setting.rb b/deployment_scripts/puppet/modules/tempest/lib/puppet/provider/tempest_config/ini_setting.rb new file mode 100644 index 0000000..7221715 --- /dev/null +++ b/deployment_scripts/puppet/modules/tempest/lib/puppet/provider/tempest_config/ini_setting.rb @@ -0,0 +1,10 @@ +Puppet::Type.type(:tempest_config).provide( + :ini_setting, + :parent => Puppet::Type.type(:openstack_config).provider(:ini_setting) +) do + + def file_path + resource[:path] + end + +end diff --git a/deployment_scripts/puppet/modules/tempest/lib/puppet/provider/tempest_ec2_credentials/openstack.rb b/deployment_scripts/puppet/modules/tempest/lib/puppet/provider/tempest_ec2_credentials/openstack.rb new file mode 100644 index 0000000..7b03d39 --- /dev/null +++ b/deployment_scripts/puppet/modules/tempest/lib/puppet/provider/tempest_ec2_credentials/openstack.rb @@ -0,0 +1,85 @@ +require File.join(File.dirname(__FILE__), '..','..','..', 'puppet/provider/tempest') + +Puppet::Type.type(:tempest_ec2_credentials).provide( + :openstack, + :parent => Puppet::Provider::Tempest +) do + + @credentials = Puppet::Provider::Openstack::CredentialsV3.new + + def exists? + access_found = false + secret_found = false + lines.each do |line| + l = line.chomp + if /^aws_access *=/ =~ l + access_found = true + end + if /^aws_secret *=/ =~ l + secret_found = true + end + end + access_found && secret_found + end + + def file_path + resource[:tempest_conf_path] + end + + def create + handle_create + end + + def destroy + handle_create + end + + def get_ec2_credentials + if resource[:ensure] == :present or resource[:ensure].nil? + if @ec2_credentials.nil? + @ec2_credentials = self.class.request('ec2 credentials', 'create', + ['--user', "#{resource[:user]}", + '--project', "#{resource[:project]}"], + file_path) + end + elsif resource[:ensure] != :absent + raise(Puppet::Error, "Cannot ensure to #{resource[:ensure]}") + end + @ec2_credentials + end + + def access_line + "aws_access = #{get_ec2_credentials[:access]}" + end + + def secret_line + "aws_secret = #{get_ec2_credentials[:secret]}" + end + + def conf_regex + /^\s*aws_(access|secret)\s*=\s*/ + end + + def handle_create() + file = lines + file.delete_if { |l| conf_regex.match(l) } + block_pos = file.find_index { |l| /^\[aws\]/ =~ l } + if block_pos.nil? + file += ["[aws]\n", "#{access_line}\n", "#{secret_line}\n"] + else + file.insert(block_pos+1, "#{access_line}\n", "#{secret_line}\n") + end + File.write(file_path, file.join) + end + + private + def lines + # If this type is ever used with very large files, we should + # write this in a different way, using a temp + # file; for now assuming that this type is only used on + # small-ish config files that can fit into memory without + # too much trouble. + @lines ||= File.readlines(file_path) + end + +end diff --git a/deployment_scripts/puppet/modules/tempest/lib/puppet/provider/tempest_glance_id_setter/openstack.rb b/deployment_scripts/puppet/modules/tempest/lib/puppet/provider/tempest_glance_id_setter/openstack.rb new file mode 100644 index 0000000..7c91223 --- /dev/null +++ b/deployment_scripts/puppet/modules/tempest/lib/puppet/provider/tempest_glance_id_setter/openstack.rb @@ -0,0 +1,88 @@ +require File.join(File.dirname(__FILE__), '..','..','..', 'puppet/provider/tempest') + +Puppet::Type.type(:tempest_glance_id_setter).provide( + :openstack, + :parent => Puppet::Provider::Tempest +) do + + @credentials = Puppet::Provider::Openstack::CredentialsV3.new + + def exists? + lines.find do |line| + should_line.chomp == line.chomp + end + end + + def file_path + resource[:tempest_conf_path] + end + + def create + handle_create_with_match + end + + def destroy + handle_create_with_match + end + + def get_image_id + if resource[:ensure] == :present or resource[:ensure].nil? + if @image_id.nil? + images = self.class.request('image', 'list', file_path) + img = images.detect {|img| img[:name] == resource[:image_name]} + if img.nil? + raise(Puppet::Error, "Image #{resource[:image_name]} not found!") + end + @image_id = img[:id] + end + elsif resource[:ensure] != :absent + raise(Puppet::Error, "Cannot ensure to #{resource[:ensure]}") + end + @image_id + end + + def should_line + "#{resource[:name]} = #{get_image_id}" + end + + def match + /^\s*#{resource[:name]}\s*=\s*/ + end + + def handle_create_with_match() + regex = match + match_count = lines.select { |l| regex.match(l) }.count + + file = lines + case match_count + when 1 + File.open(file_path, 'w') do |fh| + lines.each do |l| + fh.puts(regex.match(l) ? "#{should_line}" : l) + end + end + when 0 + block_pos = lines.find_index { |l| /^\[compute\]/ =~ l } + if block_pos.nil? + file += ["[compute]\n", "#{should_line}\n"] + else + file.insert(block_pos+1, "#{should_line}\n") + end + File.write(file_path, file.join) + else # cannot be negative. + raise Puppet::Error, "More than one line in file \ +'#{file_path}' matches pattern '#{regex}'" + end + end + + private + def lines + # If this type is ever used with very large files, we should + # write this in a different way, using a temp + # file; for now assuming that this type is only used on + # small-ish config files that can fit into memory without + # too much trouble. + @lines ||= File.readlines(file_path) + end + +end diff --git a/deployment_scripts/puppet/modules/tempest/lib/puppet/provider/tempest_neutron_net_id_setter/openstack.rb b/deployment_scripts/puppet/modules/tempest/lib/puppet/provider/tempest_neutron_net_id_setter/openstack.rb new file mode 100644 index 0000000..e9542d6 --- /dev/null +++ b/deployment_scripts/puppet/modules/tempest/lib/puppet/provider/tempest_neutron_net_id_setter/openstack.rb @@ -0,0 +1,87 @@ +require File.join(File.dirname(__FILE__), '..','..','..', 'puppet/provider/tempest') + +Puppet::Type.type(:tempest_neutron_net_id_setter).provide( + :openstack, + :parent => Puppet::Provider::Tempest +) do + + @credentials = Puppet::Provider::Openstack::CredentialsV3.new + + def exists? + lines.find do |line| + should_line.chomp == line.chomp + end + end + + def file_path + resource[:tempest_conf_path] + end + + def create + handle_create_with_match + end + + def destroy + handle_create_with_match + end + + def get_network_id + if resource[:ensure] == :present or resource[:ensure].nil? + if @network_id.nil? + nets = self.class.request('network', 'list', file_path) + net = nets.detect {|img| img[:name] == resource[:network_name]} + if net.nil? + raise(Puppet::Error, "Network #{resource[:network_name]} not found!") + end + @network_id = net[:id] + end + elsif resource[:ensure] != :absent + raise(Puppet::Error, "Cannot ensure to #{resource[:ensure]}") + end + @network_id + end + + def should_line + "#{resource[:name]} = #{get_network_id}" + end + + def match + /^\s*#{resource[:name]}\s*=\s*/ + end + + def handle_create_with_match() + regex = match + match_count = lines.select { |l| regex.match(l) }.count + file = lines + case match_count + when 1 + File.open(file_path, 'w') do |fh| + lines.each do |l| + fh.puts(regex.match(l) ? should_line : l) + end + end + when 0 + block_pos = lines.find_index { |l| /^\[network\]/ =~ l } + if block_pos.nil? + file += ["[network]\n", "#{should_line}\n"] + else + file.insert(block_pos+1, "#{should_line}\n") + end + File.write(file_path, file.join) + else # cannot be negative. + raise Puppet::Error, "More than one line in file \ +'#{file_path}' matches pattern '#{regex}'" + end + end + + private + def lines + # If this type is ever used with very large files, we should + # write this in a different way, using a temp + # file; for now assuming that this type is only used on + # small-ish config files that can fit into memory without + # too much trouble. + @lines ||= File.readlines(file_path) + end + +end diff --git a/deployment_scripts/puppet/modules/tempest/lib/puppet/type/tempest_config.rb b/deployment_scripts/puppet/modules/tempest/lib/puppet/type/tempest_config.rb new file mode 100644 index 0000000..0846bc1 --- /dev/null +++ b/deployment_scripts/puppet/modules/tempest/lib/puppet/type/tempest_config.rb @@ -0,0 +1,62 @@ +Puppet::Type.newtype(:tempest_config) do + + ensurable + + newparam(:name, :namevar => true) do + desc 'Section/setting name to manage from tempest.conf' + newvalues(/\S+\/\S+/) + end + + newproperty(:value) do + desc 'The value of the setting to be defined.' + munge do |value| + value = value.to_s.strip + value.capitalize! if value =~ /^(true|false)$/i + value + end + newvalues(/^[\S ]*$/) + + def is_to_s( currentvalue ) + if resource.secret? + return '[old secret redacted]' + else + return currentvalue + end + end + + def should_to_s( newvalue ) + if resource.secret? + return '[new secret redacted]' + else + return newvalue + end + end + end + + newparam(:secret, :boolean => true) do + desc 'Whether to hide the value from Puppet logs. Defaults to `false`.' + + newvalues(:true, :false) + + defaultto false + end + + newparam(:path) do + desc 'The ini file Puppet will ensure contains the specified setting.' + validate do |value| + unless (Puppet.features.posix? and value =~ /^\//) or (Puppet.features.microsoft_windows? and (value =~ /^.:\// or value =~ /^\/\/[^\/]+\/[^\/]+/)) + raise(Puppet::Error, "File paths must be fully qualified, not '#{value}'") + end + end + end + + newparam(:ensure_absent_val) do + desc 'A value that is specified as the value property will behave as if ensure => absent was specified' + defaultto('') + end + + autorequire(:package) do + 'tempest' + end + +end diff --git a/deployment_scripts/puppet/modules/tempest/lib/puppet/type/tempest_ec2_credentials.rb b/deployment_scripts/puppet/modules/tempest/lib/puppet/type/tempest_ec2_credentials.rb new file mode 100644 index 0000000..9cb98b2 --- /dev/null +++ b/deployment_scripts/puppet/modules/tempest/lib/puppet/type/tempest_ec2_credentials.rb @@ -0,0 +1,24 @@ +Puppet::Type.newtype(:tempest_ec2_credentials) do + + ensurable + + newparam(:name, :namevar => true) do + desc 'Name of the credentials.' + end + + newparam(:user) do + desc 'Name of the user to create credentials for.' + end + + newparam(:project) do + desc 'Name of the project to create credentials in.' + end + + newparam(:tempest_conf_path) do + desc 'The path to tempest conf file.' + end + + autorequire(:package) do + ['python-openstackclient'] + end +end diff --git a/deployment_scripts/puppet/modules/tempest/lib/puppet/type/tempest_glance_id_setter.rb b/deployment_scripts/puppet/modules/tempest/lib/puppet/type/tempest_glance_id_setter.rb new file mode 100644 index 0000000..c3700ed --- /dev/null +++ b/deployment_scripts/puppet/modules/tempest/lib/puppet/type/tempest_glance_id_setter.rb @@ -0,0 +1,26 @@ +Puppet::Type.newtype(:tempest_glance_id_setter) do +# +# tempest_glance_id_setter { 'image_id': +# tempest_conf_path => '/var/lib/tempest/etc/tempest.conf', +# image_name => $name, +# } +# + + ensurable + + newparam(:name, :namevar => true) do + desc 'name of the setting to update' + end + + newparam(:tempest_conf_path) do + desc 'path to tempest conf file' + end + + newparam(:image_name) do + desc 'name of glance image' + end + + autorequire(:package) do + ['python-openstackclient'] + end +end diff --git a/deployment_scripts/puppet/modules/tempest/lib/puppet/type/tempest_neutron_net_id_setter.rb b/deployment_scripts/puppet/modules/tempest/lib/puppet/type/tempest_neutron_net_id_setter.rb new file mode 100644 index 0000000..b7ac56b --- /dev/null +++ b/deployment_scripts/puppet/modules/tempest/lib/puppet/type/tempest_neutron_net_id_setter.rb @@ -0,0 +1,20 @@ +Puppet::Type.newtype(:tempest_neutron_net_id_setter) do + + ensurable + + newparam(:name, :namevar => true) do + desc 'The name of the setting to update.' + end + + newparam(:tempest_conf_path) do + desc 'The path to tempest conf file.' + end + + newparam(:network_name) do + desc 'The name of the neutron network.' + end + + autorequire(:package) do + ['python-openstackclient'] + end +end diff --git a/deployment_scripts/puppet/modules/tempest/manifests/config.pp b/deployment_scripts/puppet/modules/tempest/manifests/config.pp new file mode 100644 index 0000000..47aecba --- /dev/null +++ b/deployment_scripts/puppet/modules/tempest/manifests/config.pp @@ -0,0 +1,37 @@ +# == Class: tempest::config +# +# This class is used to manage arbitrary Tempest configurations. +# +# === Parameters +# +# [*tempest_config*] +# (optional) Allow configuration of arbitrary Tempest configurations. +# Note: The tempest_config provider does not hard-code the path +# of the tempest config file so that tempest can be run out of temporary +# locations (i.e. /tmp/tempest). For this reason, you MUST pass "path" +# in this hash. +# The value is an hash of tempest_config resources. Example: +# { +# 'DEFAULT/foo' => { path => '/tmp/tempest/etc/tempest.conf'; value => 'fooValue'}, +# 'DEFAULT/bar' => { path => '/tmp/tempest/etc/tempest.conf'; value => 'fooValue'}, +# } +# In yaml format, Example: +# tempest_config: +# DEFAULT/foo: +# value: fooValue +# path: /tmp/tempest/etc/tempest.conf +# DEFAULT/bar: +# value: barValue +# path: /tmp/tempest/etc/tempest.conf +# +# NOTE: The configuration MUST NOT be already handled by this module +# or Puppet catalog compilation will fail with duplicate resources. +# +class tempest::config ( + $tempest_config = {}, +) { + + validate_hash($tempest_config) + + create_resources('tempest_config', $tempest_config) +} diff --git a/deployment_scripts/puppet/modules/tempest/manifests/init.pp b/deployment_scripts/puppet/modules/tempest/manifests/init.pp new file mode 100644 index 0000000..cdc09fd --- /dev/null +++ b/deployment_scripts/puppet/modules/tempest/manifests/init.pp @@ -0,0 +1,877 @@ +# class for installing and configuring tempest +# +# The class checks out the tempest repo and sets the basic config. +# +# Note that only parameters for which values are provided will be +# managed in tempest.conf. +# +# [*package_ensure*] +# (optional) The state of tempest packages +# Defaults to 'present' +# [*tempest_workspace*] +# Deafults to '/var/lib/tempest' +# [*install_from_source*] +# Defaults to true +# [*git_clone*] +# Defaults to true +# [*tempest_config_file*] +# Defaults to '/var/lib/tempest/etc/tempest.conf' +# [*tempest_repo_uri*] +# Defaults to 'git://github.com/openstack/tempest.git' +# [*tempest_repo_revision*] +# Defaults to undef +# [*tempest_clone_path*] +# Defaults to '/var/lib/tempest' +# [*tempest_clone_owner*] +# Defaults to 'root' +# [*setup_venv*] +# Defaults to false +# [*configure_images*] +# Defaults to true +# [*image_name*] +# Defaults to undef +# [*image_name_alt*] +# Defaults to undef +# [*glance_v1*] +# Defaults to true +# [*glance_v2*] +# Defaults to true +# [*configure_networks*] +# Defaults to true +# [*public_network_name*] +# Defaults to undef +# [*neutron_api_extensions*] +# Defaults to undef +# [*identity_uri*] +# Defaults to undef +# [*identity_uri_v3*] +# Defaults to undef +# [*region_name*] +# Defaults to RegionOne +# [*cli_dir*] +# Defaults to undef +# [*lock_path*] +# Defaults to '/var/lib/tempest' +# [*log_file*] +# Defaults to $::os_service_default +# [*debug*] +# Defaults to false +# [*use_stderr*] +# Defaults to true +# [*use_syslog*] +# Defaults to false +# [*logging_context_format_string*] +# Defaults to $::os_service_default +# [*username*] +# Defaults to undef +# [*password*] +# Defaults to undef +# [*project_name*] +# Defaults to undef +# [*alt_username*] +# Defaults to undef +# [*alt_password*] +# Defaults to undef +# [*alt_project_name*] +# Defaults to undef +# [*admin_username*] +# Defaults to undef +# [*admin_password*] +# Defaults to undef +# [*admin_project_name*] +# Defaults to undef +# [*admin_role*] +# Defaults to undef +# [*admin_domain_name*] +# Defaults to undef +# [*image_ref*] +# Defaults to undef +# [*image_ref_alt*] +# Defaults to undef +# [*image_ssh_user*] +# Defaults to undef +# [*image_alt_ssh_user*] +# Defaults to undef +# [*run_ssh*] +# Defaults to false +# [*flavor_ref*] +# Defaults to undef +# [*flavor_ref_alt*] +# Defaults to undef +# [*whitebox_db_uri*] +# Defaults to undef +# [*resize_available*] +# Defaults to undef +# [*change_password_available*] +# Defaults to undef +# [*use_dynamic_credentials*] +# Defaults to undef +# [*public_network_id*] +# Defaults to undef +# [*public_router_id*] +# Defaults to '' +# [*sahara_plugins*] +# (optional) List of enabled Sahara plugins +# Defaults to undef +# [*cinder_available*] +# Defaults to true +# [*cinder_backup_available*] +# Defaults to false +# [*glance_available*] +# Defaults to true +# [*heat_available*] +# Defaults to false +# [*ceilometer_available*] +# Defaults to false +# [*aodh_available*] +# Defaults to false +# [*gnocchi_available*] +# Defaults to false +# [*panko_available*] +# Defaults to false +# [*designate_available*] +# Defaults to false +# [*horizon_available*] +# Defaults to true +# [*neutron_available*] +# Defaults to false +# [*neutron_bgpvpn_available*] +# Defaults to false +# [*neutron_fwaas_available*] +# Defaults to true +# [*neutron_lbaas_available*] +# Defaults to true +# [*neutron_l2gw_available*] +# Defaults to true +# [*neutron_vpnaas_available*] +# Defaults to false +# [*nova_available*] +# Defaults to true +# [*murano_available*] +# Defaults to false +# [*zaqar_available*] +# Defaults to false +# [*ec2api_available*] +# Defaults to false +# [*mistral_available*] +# Defaults to false +# [*vitrage_available*] +# Defaults to false +# [*run_service_broker_tests*] +# Defaults to false +# [*sahara_available*] +# Defaults to false +# [*swift_available*] +# Defaults to false +# [*trove_available*] +# Defaults to false +# [*ironic_available*] +# Defaults to false +# [*congress_available*] +# Defaults to false +# [*octavia_available*] +# Defaults to false +# [*keystone_v2*] +# Defaults to true +# [*keystone_v3*] +# Defaults to true +# [*auth_version*] +# Defaults to 'v2' +# [*img_dir*] +# Defaults to '/var/lib/tempest' +# [*img_file*] +# Defaults to 'cirros-0.3.4-x86_64-disk.img' +# [*login_url*] +# Defaults to undef +# [*dashboard_url*] +# Defaults to undef +# [*compute_build_interval*] +# Defaults to undef +# [*ca_certificates_file*] +# Defaults to undef +# [*disable_ssl_validation*] +# Defaults to undef +# [*designate_nameservers*] +# Defaults to undef +# [*manage_tests_packages*] +# Defaults to false +# [*attach_encrypted_volume*] +# Defaults to false +# [*tempest_roles*] +# Should be an array. +# Defaults to $::os_service_default +# [*db_flavor_ref*] +# Valid primary flavor to use in Trove tests. +# Defaults to $::os_service_default +# +# DEPREACTED PARAMETERS +# [*tenant_name*] +# Defaults to undef +# [*alt_tenant_name*] +# Defaults to undef +# [*admin_tenant_name*] +# Defaults to undef +# [*allow_tenant_isolation*] +# Defaults to undef +# [*ensure_package*] +# (optional) The state of tempest packages +# Defaults to undef +# +class tempest( + $package_ensure = 'present', + $tempest_workspace = '/var/lib/tempest', + $install_from_source = true, + $git_clone = true, + $tempest_config_file = '/var/lib/tempest/etc/tempest.conf', + + # Clone config + # + $tempest_repo_uri = 'git://github.com/openstack/tempest.git', + $tempest_repo_revision = undef, + $tempest_clone_path = '/var/lib/tempest', + $tempest_clone_owner = 'root', + + $setup_venv = false, + + # Glance image config + # + $configure_images = true, + $image_name = undef, + $image_name_alt = undef, + $glance_v1 = true, + $glance_v2 = true, + + # Neutron network config + # + $configure_networks = true, + $public_network_name = undef, + $neutron_api_extensions = undef, + + # Horizon dashboard config + $login_url = undef, + $dashboard_url = undef, + + # tempest.conf parameters + # + $identity_uri = undef, + $identity_uri_v3 = undef, + $region_name = 'RegionOne', + $cli_dir = undef, + $lock_path = '/var/lib/tempest', + $log_file = $::os_service_default, + $debug = false, + $use_stderr = true, + $use_syslog = false, + $logging_context_format_string = $::os_service_default, + $attach_encrypted_volume = false, + # non admin user + $username = undef, + $password = undef, + $project_name = undef, + # another non-admin user + $alt_username = undef, + $alt_password = undef, + $alt_project_name = undef, + # admin user + $admin_username = undef, + $admin_password = undef, + $admin_project_name = undef, + $admin_role = undef, + $admin_domain_name = undef, + # roles fo the users created by tempest + $tempest_roles = $::os_service_default, + # image information + $image_ref = undef, + $image_ref_alt = undef, + $image_ssh_user = undef, + $image_alt_ssh_user = undef, + $flavor_ref = undef, + $flavor_ref_alt = undef, + $compute_build_interval = undef, + $run_ssh = false, + # whitebox + $whitebox_db_uri = undef, + # testing features that are supported + $resize_available = undef, + $change_password_available = undef, + $use_dynamic_credentials = undef, + # neutron config + $public_network_id = undef, + # Upstream has a bad default - set it to empty string. + $public_router_id = '', + # Sahara config + $sahara_plugins = undef, + # Trove config + $db_flavor_ref = $::os_service_default, + # Service configuration + $cinder_available = true, + $cinder_backup_available = false, + $glance_available = true, + $heat_available = false, + $ceilometer_available = false, + $aodh_available = false, + $gnocchi_available = false, + $panko_available = false, + $designate_available = false, + $horizon_available = true, + $neutron_available = false, + $neutron_bgpvpn_available = false, + $neutron_fwaas_available = true, + $neutron_lbaas_available = true, + $neutron_l2gw_available = false, + $neutron_vpnaas_available = false, + $nova_available = true, + $murano_available = false, + $sahara_available = false, + $swift_available = false, + $trove_available = false, + $ironic_available = false, + $watcher_available = false, + $zaqar_available = false, + $ec2api_available = false, + $mistral_available = false, + $vitrage_available = false, + $congress_available = false, + $octavia_available = false, + $keystone_v2 = true, + $keystone_v3 = true, + $auth_version = 'v2', + $run_service_broker_tests = false, + $ca_certificates_file = undef, + $disable_ssl_validation = undef, + $manage_tests_packages = false, + # scenario options + $img_dir = '/var/lib/tempest', + $img_file = 'cirros-0.3.4-x86_64-disk.img', + # designate options + $designate_nameservers = undef, + # DEPRECATED PARAMETERS + $tenant_name = undef, + $alt_tenant_name = undef, + $admin_tenant_name = undef, + $allow_tenant_isolation = undef, + $ensure_package = undef, + $min_compute_nodes = 2, +) { + + if !is_service_default($tempest_roles) and !empty($tempest_roles){ + validate_array($tempest_roles) + $tempest_roles_real = join($tempest_roles, ',') + } else { + $tempest_roles_real = $::os_service_default + } + + if $tenant_name { + warning('The tempest::tenant_name parameter is deprecated, use tempest::project_name instead.') + $project_name_real = $tenant_name + } + else { + $project_name_real = $project_name + } + + if $alt_tenant_name { + warning('The tempest::alt_tenant_name parameter is deprecated, use tempest::alt_project_name instead.') + $alt_project_name_real = $alt_tenant_name + } + else { + $alt_project_name_real = $alt_project_name + } + + if $admin_tenant_name { + warning('The tempest::admin_tenant_name parameter is deprecated, use tempest::admin_project_name instead.') + $admin_project_name_real = $admin_tenant_name + } + else { + $admin_project_name_real = $admin_project_name + } + + if $allow_tenant_isolation { + warning('The tempest::allow_tenant_isolation parameter is deprecated, use tempest::use_dynamic_credentials instead.') + $use_dynamic_credentials_real = $allow_tenant_isolation + } + else { + $use_dynamic_credentials_real = $use_dynamic_credentials + } + + if $ensure_package { + warning("tempest::ensure_package is deprecated and will be removed in \ +the future release. Please use tempest::package_ensure instead.") + $package_ensure_real = $ensure_package + } else { + $package_ensure_real = $package_ensure + } + + include ::tempest::params + + include ::openstacklib::openstackclient + + if $install_from_source { + ensure_packages([ + 'git', + 'python-setuptools', + ], { allow_virtual => true }) + + ensure_packages($tempest::params::dev_packages) + + exec { 'install-pip': + command => 'easy_install pip', + unless => 'which pip', + path => ['/bin','/usr/bin','/usr/local/bin'], + require => Package['python-setuptools'], + } + + exec { 'install-tox': + command => 'pip install -U tox', + unless => 'which tox', + path => ['/bin','/usr/bin','/usr/local/bin'], + require => Exec['install-pip'], + } + + if $git_clone { + vcsrepo { $tempest_clone_path: + ensure => 'present', + source => $tempest_repo_uri, + revision => $tempest_repo_revision, + provider => 'git', + require => Package['git'], + user => $tempest_clone_owner, + } + Vcsrepo<||> -> Tempest_config<||> + } + + if $setup_venv { + # virtualenv will be installed along with tox + exec { 'setup-venv': + command => "virtualenv ${tempest_clone_path}/.venv && ${tempest_clone_path}/.venv/bin/pip install -U -r requirements.txt", + cwd => $tempest_clone_path, + unless => "test -d ${tempest_clone_path}/.venv", + path => ['/bin','/usr/bin','/usr/local/bin'], + require => [ + Exec['install-tox'], + Package[$tempest::params::dev_packages], + ], + } + if $git_clone { + Vcsrepo<||> -> Exec['setup-venv'] + } + } + + $tempest_conf = "${tempest_clone_path}/etc/tempest.conf" + + Tempest_config { + path => $tempest_conf, + } + } else { + $tempest_conf = "${tempest_workspace}/etc/tempest.conf" + + Tempest_config { + path => $tempest_conf, + } + } + + if ! $install_from_source { + package { 'tempest': + ensure => $package_ensure_real, + name => $::tempest::params::package_name, + tag => ['openstack', 'tempest-package'], + } + + file { '/usr/bin/tempest': + ensure => 'file', + content => "#!/bin/bash\nsource /opt/venvs/virtualenv-tempest/bin/activate\n/opt/venvs/virtualenv-tempest/bin/tempest \"\$@\"", + mode => '0755', + owner => root, + group => root, + require => Package['tempest'], + } + + # Create tempest workspace by running tempest init. + # It will generate etc/tempest.conf, logs and tempest_lock folder + # in tempest workspace + exec {'tempest-workspace': + command => "rm -rf ${tempest_workspace} && mkdir -p ${tempest_workspace} && tempest workspace remove --name default; tempest init --name default ${tempest_workspace} && mkdir -p ${lock_path}", + path => ['/bin', '/usr/bin'], + returns => [0, 1], + refreshonly => true, + require => File['/usr/bin/tempest'], + } + + Package['tempest'] ~> Exec['tempest-workspace'] + Exec['tempest-workspace'] -> Tempest_config<||> + Exec['tempest-workspace'] -> Tempest_glance_id_setter<||> + } + + + tempest_config { + 'default/log_dir': value => "${tempest_workspace}/logs"; + 'default/log_file': value => "${tempest_workspace}/logs/tempest.log"; + 'auth/admin_domain_name': value => $admin_domain_name; + 'auth/admin_password': value => $admin_password, secret => true; + 'auth/admin_project_name': value => $admin_project_name_real; + 'auth/admin_username': value => $admin_username; + 'auth/tempest_roles': value => $tempest_roles_real; + 'auth/use_dynamic_credentials': value => $use_dynamic_credentials_real; + 'compute/change_password_available': value => $change_password_available; + 'compute/flavor_ref': value => $flavor_ref; + 'compute/flavor_ref_alt': value => $flavor_ref_alt; + 'compute/image_alt_ssh_user': value => $image_alt_ssh_user; + 'compute/image_ref': value => $image_ref; + 'compute/image_ref_alt': value => $image_ref_alt; + 'compute/resize_available': value => $resize_available; + 'compute/build_interval': value => $compute_build_interval; + 'compute/min_compute_nodes': value => $min_compute_nodes; + 'validation/image_ssh_user': value => $image_ssh_user; + 'validation/run_validation': value => $run_ssh; + 'identity/admin_role': value => $admin_role; + 'identity/alt_password': value => $alt_password, secret => true; + 'identity/alt_project_name': value => $alt_project_name_real; + 'identity/alt_username': value => $alt_username; + 'identity/password': value => $password, secret => true; + 'identity/project_name': value => $project_name_real; + 'identity/uri': value => $identity_uri; + 'identity/uri_v3': value => $identity_uri_v3; + 'identity/username': value => $username; + 'identity/auth_version': value => $auth_version; + 'identity/ca_certificates_file': value => $ca_certificates_file; + 'identity/disable_ssl_certificate_validation': value => $disable_ssl_validation; + 'identity-feature-enabled/api_v2': value => $keystone_v2; + 'identity-feature-enabled/api_v3': value => $keystone_v3; + 'image-feature-enabled/api_v1': value => $glance_v1; + 'image-feature-enabled/api_v2': value => $glance_v2; + 'network-feature-enabled/api_extensions': value => $neutron_api_extensions; + 'network/public_network_id': value => $public_network_id; + 'network/public_router_id': value => $public_router_id; + 'dashboard/login_url': value => $login_url; + 'dashboard/dashboard_url': value => $dashboard_url; + 'database/db_flavor_ref': value => $db_flavor_ref; + 'service_available/cinder': value => $cinder_available; + 'volume-feature-enabled/backup': value => $cinder_backup_available; + 'service_available/glance': value => $glance_available; + 'service_available/heat': value => $heat_available; + 'service_available/ceilometer': value => $ceilometer_available; + 'service_available/aodh': value => $aodh_available; + # https://bugs.launchpad.net/aodh/+bug/1611406 + 'service_available/aodh_plugin': value => $aodh_available; + 'service_available/bgpvpn': value => $neutron_bgpvpn_available; + 'service_available/gnocchi': value => $gnocchi_available; + 'service_available/panko': value => $panko_available; + 'service_available/designate': value => $designate_available; + 'service_available/horizon': value => $horizon_available; + 'service_available/l2gw': value => $neutron_l2gw_available; + 'service_available/neutron': value => $neutron_available; + 'service_available/mistral': value => $mistral_available; + 'service_available/vitrage': value => $vitrage_available; + 'service_available/nova': value => $nova_available; + 'service_available/murano': value => $murano_available; + 'service_available/sahara': value => $sahara_available; + 'service_available/swift': value => $swift_available; + 'service_available/trove': value => $trove_available; + 'service_available/ironic': value => $ironic_available; + 'service_available/zaqar': value => $zaqar_available; + 'service_available/ec2api': value => $ec2api_available; + 'service_available/congress': value => $congress_available; + 'service_available/octavia': value => $octavia_available; + 'whitebox/db_uri': value => $whitebox_db_uri; + 'cli/cli_dir': value => $cli_dir; + 'scenario/img_dir': value => $img_dir; + 'scenario/img_file': value => $img_file; + 'service_broker/run_service_broker_tests': value => $run_service_broker_tests; + 'dns/nameservers': value => $designate_nameservers; + 'compute-feature-enabled/attach_encrypted_volume': value => $attach_encrypted_volume; + } + + oslo::concurrency { 'tempest_config': + lock_path => $lock_path, + require => Exec['tempest-workspace'], + } + + oslo::log { 'tempest_config': + debug => $debug, + log_file => $log_file, + use_stderr => $use_stderr, + use_syslog => $use_syslog, + logging_context_format_string => $logging_context_format_string + } + + if $manage_tests_packages { + if $aodh_available and $::tempest::params::python_aodh_tests { + package { 'python-aodh-tests': + ensure => present, + name => $::tempest::params::python_aodh_tests, + tag => ['openstack', 'tempest-package'], + } + } + if $ceilometer_available and $::tempest::params::python_ceilometer_tests { + package { 'python-ceilometer-tests': + ensure => present, + name => $::tempest::params::python_ceilometer_tests, + tag => ['openstack', 'tempest-package'], + } + } + if $cinder_available and $::tempest::params::python_cinder_tests { + package { 'python-cinder-tests': + ensure => present, + name => $::tempest::params::python_cinder_tests, + tag => ['openstack', 'tempest-package'], + } + } + if $glance_available and $::tempest::params::python_glance_tests { + package { 'python-glance-tests': + ensure => present, + name => $::tempest::params::python_glance_tests, + tag => ['openstack', 'tempest-package'], + } + } + if $gnocchi_available and $::tempest::params::python_gnocchi_tests { + package { 'python-gnocchi-tests': + ensure => present, + name => $::tempest::params::python_gnocchi_tests, + tag => ['openstack', 'tempest-package'], + } + } + if $panko_available and $::tempest::params::python_panko_tests { + package { 'python-panko-tests': + ensure => present, + name => $::tempest::params::python_panko_tests, + tag => ['openstack', 'tempest-package'], + } + } + if $heat_available and $::tempest::params::python_heat_tests { + package { 'python-heat-tests': + ensure => present, + name => $::tempest::params::python_heat_tests, + tag => ['openstack', 'tempest-package'], + } + } + if $ironic_available and $::tempest::params::python_ironic_tests { + package { 'python-ironic-tests': + ensure => present, + name => $::tempest::params::python_ironic_tests, + tag => ['openstack', 'tempest-package'], + } + } + if $::tempest::params::python_keystone_tests { + package { 'python-keystone-tests': + ensure => present, + name => $::tempest::params::python_keystone_tests, + tag => ['openstack', 'tempest-package'], + } + } + if $murano_available and $::tempest::params::python_murano_tests { + package { 'python-murano-tests': + ensure => present, + name => $::tempest::params::python_murano_tests, + tag => ['openstack', 'tempest-package'], + } + } + if $neutron_available and $::tempest::params::python_neutron_tests { + package { 'python-neutron-tests': + ensure => present, + name => $::tempest::params::python_neutron_tests, + tag => ['openstack', 'tempest-package'], + } + if $neutron_bgpvpn_available and $::tempest::params::python_bgpvpn_tests { + package { 'python-networking-bgpvpn-tests': + ensure => present, + name => $::tempest::params::python_bgpvpn_tests, + tag => ['openstack', 'tempest-package'], + } + } + if $neutron_fwaas_available { + package { 'python-neutron-fwaas-tests': + ensure => present, + name => $::tempest::params::python_fwaas_tests, + tag => ['openstack', 'tempest-package'], + } + } + if $neutron_lbaas_available { + package { 'python-neutron-lbaas-tests': + ensure => present, + name => $::tempest::params::python_lbaas_tests, + tag => ['openstack', 'tempest-package'], + } + } + if $neutron_l2gw_available and $::tempest::params::python_l2gw_tests { + package { 'python-networking-l2gw-tests': + ensure => present, + name => $::tempest::params::python_l2gw_tests, + tag => ['openstack', 'tempest-package'], + } + } + if $neutron_vpnaas_available { + package { 'python-neutron-vpnaas-tests': + ensure => present, + name => $::tempest::params::python_vpnaas_tests, + tag => ['openstack', 'tempest-package'], + } + } + } + if $nova_available and $::tempest::params::python_nova_tests { + package { 'python-nova-tests': + ensure => present, + name => $::tempest::params::python_nova_tests, + tag => ['openstack', 'tempest-package'], + } + } + if $sahara_available and $::tempest::params::python_sahara_tests { + package { 'python-sahara-tests-tempest': + ensure => present, + name => $::tempest::params::python_sahara_tests, + tag => ['openstack', 'tempest-package'], + } + } + if $swift_available and $::tempest::params::python_swift_tests { + package { 'python-swift-tests': + ensure => present, + name => $::tempest::params::python_swift_tests, + tag => ['openstack', 'tempest-package'], + } + } + if $trove_available and $::tempest::params::python_trove_tests { + package { 'python-trove-tests': + ensure => present, + name => $::tempest::params::python_trove_tests, + tag => ['openstack', 'tempest-package'], + } + } + if $watcher_available and $::tempest::params::python_watcher_tests { + package { 'python-watcher-tests-tempest': + ensure => present, + name => $::tempest::params::python_watcher_tests, + tag => ['openstack', 'tempest-package'], + } + } + if $zaqar_available and $::tempest::params::python_zaqar_tests { + package { 'python-zaqar-tests': + ensure => present, + name => $::tempest::params::python_zaqar_tests, + tag => ['openstack', 'tempest-package'], + } + } + if $congress_available and $::tempest::params::congress_congress_tests { + package { 'python-congress-tests': + ensure => present, + name => $::tempest::params::python_congress_tests, + tag => ['openstack', 'tempest-package'], + } + } + if $mistral_available and $::tempest::params::python_mistral_tests { + package { 'python-mistral-tests': + ensure => present, + name => $::tempest::params::python_mistral_tests, + tag => ['openstack', 'tempest-package'], + } + } + if $vitrage_available and $::tempest::params::python_vitrage_tests { + package { 'python-vitrage-tests': + ensure => present, + name => $::tempest::params::python_vitrage_tests, + tag => ['openstack', 'tempest-package'], + } + } + if $designate_available and $::tempest::params::python_designate_tests { + package { 'python-designate-tests': + ensure => present, + name => $::tempest::params::python_designate_tests, + tag => ['openstack', 'tempest-package'], + } + } + if $horizon_available and $::tempest::params::python_horizon_tests { + package { 'python-horizon-tests': + ensure => present, + name => $::tempest::params::python_horizon_tests, + tag => ['openstack', 'tempest-package'], + } + } + if $octavia_available and $::tempest::params::python_octavia_tests { + package { 'python-octavia-tests': + ensure => present, + name => $::tempest::params::python_octavia_tests, + tag => ['openstack', 'tempest-package'], + } + } + if $ec2api_available and $::tempest::params::python_ec2api_tests { + package { 'python-ec2-api-tests': + ensure => present, + name => $::tempest::params::python_ec2api_tests, + tag => ['openstack', 'tempest-package'], + } + } + } + + if $configure_images { + if ! $image_ref and $image_name { + # If the image id was not provided, look it up via the image name + # and set the value in the conf file. + tempest_glance_id_setter { 'image_ref': + ensure => present, + tempest_conf_path => $tempest_conf, + image_name => $image_name, + } + Glance_image<||> -> Tempest_glance_id_setter['image_ref'] + Tempest_config<||> -> Tempest_glance_id_setter['image_ref'] + Keystone_user_role<||> -> Tempest_glance_id_setter['image_ref'] + } elsif ($image_name and $image_ref) or (! $image_name and ! $image_ref) { + fail('A value for either image_name or image_ref must be provided.') + } + if ! $image_ref_alt and $image_name_alt { + tempest_glance_id_setter { 'image_ref_alt': + ensure => present, + tempest_conf_path => $tempest_conf, + image_name => $image_name_alt, + } + Glance_image<||> -> Tempest_glance_id_setter['image_ref_alt'] + Tempest_config<||> -> Tempest_glance_id_setter['image_ref_alt'] + Keystone_user_role<||> -> Tempest_glance_id_setter['image_ref_alt'] + } elsif ($image_name_alt and $image_ref_alt) or (! $image_name_alt and ! $image_ref_alt) { + fail('A value for either image_name_alt or image_ref_alt must \ +be provided.') + } + } + + if $neutron_available and $configure_networks { + if ! $public_network_id and $public_network_name { + tempest_neutron_net_id_setter { 'public_network_id': + ensure => present, + tempest_conf_path => $tempest_conf, + network_name => $public_network_name, + } + Neutron_network<||> -> Tempest_neutron_net_id_setter['public_network_id'] + Tempest_config<||> -> Tempest_neutron_net_id_setter['public_network_id'] + Keystone_user_role<||> -> Tempest_neutron_net_id_setter['public_network_id'] + } elsif ($public_network_name and $public_network_id) or (! $public_network_name and ! $public_network_id) { + fail('A value for either public_network_id or public_network_name \ + must be provided.') + } + } + + if $sahara_available { + tempest_config { + 'data-processing-feature-enabled/plugins': value => $sahara_plugins, + } + } + + if $ec2api_available { + tempest_config { + 'aws/instance_type': value => $flavor_ref; + 'aws/instance_type_alt': value => $flavor_ref_alt; + } + keystone_user { 'ec2api-tester' : + ensure => present, + enabled => true, + } + keystone_user_role { 'ec2api-tester@openstack' : + ensure => present, + roles => ['Member'], + } + tempest_ec2_credentials { 'ec2_test_creds': + ensure => present, + tempest_conf_path => $tempest_conf, + user => 'ec2api-tester', + project => 'openstack', + } + Tempest_config<||> -> Tempest_ec2_credentials['ec2_test_creds'] + Keystone_user_role<||> -> Tempest_ec2_credentials['ec2_test_creds'] + } + +} diff --git a/deployment_scripts/puppet/modules/tempest/manifests/params.pp b/deployment_scripts/puppet/modules/tempest/manifests/params.pp new file mode 100644 index 0000000..b038358 --- /dev/null +++ b/deployment_scripts/puppet/modules/tempest/manifests/params.pp @@ -0,0 +1,90 @@ +# +class tempest::params { + include ::openstacklib::defaults + case $::osfamily { + 'RedHat': { + $dev_packages = [ + 'python-devel', + 'libxslt-devel', + 'libxml2-devel', + 'openssl-devel', + 'libffi-devel', + 'patch', + 'gcc' + ] + $python_aodh_tests = 'python-aodh-tests' + $python_bgpvpn_tests = 'python-networking-bgpvpn-tests' + $python_ceilometer_tests = 'python-ceilometer-tests' + $python_cinder_tests = 'python-cinder-tests' + $python_designate_tests = 'python-designate-tests-tempest' + $python_glance_tests = 'python-glance-tests' + $python_gnocchi_tests = 'python-gnocchi-tests' + $python_heat_tests = 'python-heat-tests' + $python_horizon_tests = 'python-horizon-tests-tempest' + $python_ironic_tests = 'python-ironic-tests' + $python_keystone_tests = 'python-keystone-tests' + $python_mistral_tests = 'python-mistral-tests' + $python_vitrage_tests = 'python-vitrage-tests' + $python_murano_tests = 'python-murano-tests' + $python_neutron_tests = 'python-neutron-tests' + $python_fwaas_tests = 'python-neutron-fwaas-tests' + $python_lbaas_tests = 'python-neutron-lbaas-tests' + $python_l2gw_tests = 'python-networking-l2gw-tests' + $python_vpnaas_tests = 'python-neutron-vpnaas-tests' + $python_nova_tests = 'python-nova-tests' + $python_sahara_tests = 'python-sahara-tests-tempest' + $python_swift_tests = 'python-swift-tests' + $python_trove_tests = 'python-trove-tests' + $python_watcher_tests = 'python-watcher-tests-tempest' + $python_zaqar_tests = 'python-zaqar-tests' + $python_congress_tests = 'python-congress-tests' + $python_panko_tests = 'python-panko-tests' + $python_octavia_tests = 'python-octavia-tests' + $python_ec2api_tests = 'python-ec2-api-tests' + $package_name = 'virtualenv-tempest' + } + 'Debian': { + $dev_packages = [ + 'python-dev', + 'libxslt1-dev', + 'libxml2-dev', + 'libssl-dev', + 'libffi-dev', + 'patch', + 'gcc', + 'python-virtualenv', + ] + $python_aodh_tests = false + $python_bgpvpn_tests = false + $python_ceilometer_tests = false + $python_cinder_tests = false + $python_designate_tests = false + $python_glance_tests = false + $python_gnocchi_tests = false + $python_heat_tests = false + $python_horizon_tests = false + $python_ironic_tests = false + $python_keystone_tests = false + $python_l2gw_tests = false + $python_mistral_tests = false + $python_vitrage_tests = false + $python_murano_tests = false + $python_neutron_tests = false + $python_nova_tests = false + $python_sahara_tests = false + $python_swift_tests = false + $python_trove_tests = false + $python_watcher_tests = false + $python_zaqar_tests = false + $python_congress_tests = false + $python_panko_tests = false + $python_octavia_tests = false + $python_ec2api_tests = false + $package_name = 'virtualenv-tempest' + } + default: { + fail("Unsupported osfamily: ${::osfamily} operatingsystem: ${::operatingsystem}, \ +module ${module_name} only support osfamily RedHat and Debian") + } + } +} diff --git a/deployment_scripts/puppet/modules/tempest/metadata.json b/deployment_scripts/puppet/modules/tempest/metadata.json new file mode 100644 index 0000000..9c91a8e --- /dev/null +++ b/deployment_scripts/puppet/modules/tempest/metadata.json @@ -0,0 +1,69 @@ +{ + "author": "OpenStack Contributors", + "dependencies": [ + { + "name": "puppetlabs/inifile", + "version_requirement": ">=1.0.0 <2.0.0" + }, + { + "name": "puppetlabs/stdlib", + "version_requirement": ">=4.0.0 <5.0.0" + }, + { + "name": "puppetlabs/vcsrepo", + "version_requirement": ">=0.1.2 <2.0.0" + }, + { + "name": "openstack/openstacklib", + "version_requirement": ">=11.1.0 <12.0.0" + }, + { + "name": "openstack/oslo", + "version_requirement": ">=11.1.0 <12.0.0" + } + ], + "description": "Installs and configures OpenStack Tempest (Quality Assurance).", + "issues_url": "https://bugs.launchpad.net/puppet-tempest", + "license": "Apache-2.0", + "name": "openstack-tempest", + "operatingsystem_support": [ + { + "operatingsystem": "Debian", + "operatingsystemrelease": [ + "8" + ] + }, + { + "operatingsystem": "Fedora", + "operatingsystemrelease": [ + "24" + ] + }, + { + "operatingsystem": "RedHat", + "operatingsystemrelease": [ + "7" + ] + }, + { + "operatingsystem": "Ubuntu", + "operatingsystemrelease": [ + "16.04" + ] + } + ], + "project_page": "https://launchpad.net/puppet-tempest", + "requirements": [ + { + "name": "pe", + "version_requirement": "4.x" + }, + { + "name": "puppet", + "version_requirement": "4.x" + } + ], + "source": "git://github.com/openstack/puppet-tempest.git", + "summary": "Puppet module for OpenStack Tempest", + "version": "11.1.0-dev" +} \ No newline at end of file diff --git a/deployment_scripts/puppet/modules/tempest/releasenotes/notes/add-bgpvpn-support-d08ba23ce786a46a.yaml b/deployment_scripts/puppet/modules/tempest/releasenotes/notes/add-bgpvpn-support-d08ba23ce786a46a.yaml new file mode 100644 index 0000000..9596007 --- /dev/null +++ b/deployment_scripts/puppet/modules/tempest/releasenotes/notes/add-bgpvpn-support-d08ba23ce786a46a.yaml @@ -0,0 +1,3 @@ +--- +features: + - Add BGPVPN Tempest plugin support diff --git a/deployment_scripts/puppet/modules/tempest/releasenotes/notes/add-l2gw-driver-dea71457310f31bd.yaml b/deployment_scripts/puppet/modules/tempest/releasenotes/notes/add-l2gw-driver-dea71457310f31bd.yaml new file mode 100644 index 0000000..b3c6599 --- /dev/null +++ b/deployment_scripts/puppet/modules/tempest/releasenotes/notes/add-l2gw-driver-dea71457310f31bd.yaml @@ -0,0 +1,3 @@ +--- +features: + - Add L2GW Tempest plugin support diff --git a/deployment_scripts/puppet/modules/tempest/releasenotes/notes/add-octavia-support-9fb2e93e7ce38be7.yaml b/deployment_scripts/puppet/modules/tempest/releasenotes/notes/add-octavia-support-9fb2e93e7ce38be7.yaml new file mode 100644 index 0000000..131d9fa --- /dev/null +++ b/deployment_scripts/puppet/modules/tempest/releasenotes/notes/add-octavia-support-9fb2e93e7ce38be7.yaml @@ -0,0 +1,3 @@ +--- +features: + - Add Octavia Tempest plugin support. diff --git a/deployment_scripts/puppet/modules/tempest/releasenotes/notes/add_congress-879513a345de563f.yaml b/deployment_scripts/puppet/modules/tempest/releasenotes/notes/add_congress-879513a345de563f.yaml new file mode 100644 index 0000000..21c679a --- /dev/null +++ b/deployment_scripts/puppet/modules/tempest/releasenotes/notes/add_congress-879513a345de563f.yaml @@ -0,0 +1,3 @@ +--- +features: + - Add support for Congress tests. diff --git a/deployment_scripts/puppet/modules/tempest/releasenotes/notes/add_gnocchi-f8b3d64466d021ce.yaml b/deployment_scripts/puppet/modules/tempest/releasenotes/notes/add_gnocchi-f8b3d64466d021ce.yaml new file mode 100644 index 0000000..5743bde --- /dev/null +++ b/deployment_scripts/puppet/modules/tempest/releasenotes/notes/add_gnocchi-f8b3d64466d021ce.yaml @@ -0,0 +1,3 @@ +--- +features: + - Add support for Gnocchi tests. diff --git a/deployment_scripts/puppet/modules/tempest/releasenotes/notes/add_watcher-2f24b0881c28cd82.yaml b/deployment_scripts/puppet/modules/tempest/releasenotes/notes/add_watcher-2f24b0881c28cd82.yaml new file mode 100644 index 0000000..78fa5f7 --- /dev/null +++ b/deployment_scripts/puppet/modules/tempest/releasenotes/notes/add_watcher-2f24b0881c28cd82.yaml @@ -0,0 +1,3 @@ +--- +features: + - Add support for Watcher tests. diff --git a/deployment_scripts/puppet/modules/tempest/releasenotes/notes/deprecate_ensure_package_parameter-9a39a2831316791f.yaml b/deployment_scripts/puppet/modules/tempest/releasenotes/notes/deprecate_ensure_package_parameter-9a39a2831316791f.yaml new file mode 100644 index 0000000..33c21b0 --- /dev/null +++ b/deployment_scripts/puppet/modules/tempest/releasenotes/notes/deprecate_ensure_package_parameter-9a39a2831316791f.yaml @@ -0,0 +1,4 @@ +--- +deprecations: + - tempest::ensure_package is now deprecated and will be removed in the + future release. Please use tempest::package_ensure instead. diff --git a/deployment_scripts/puppet/modules/tempest/releasenotes/notes/designate-e22d3f4ebe2e9a19.yaml b/deployment_scripts/puppet/modules/tempest/releasenotes/notes/designate-e22d3f4ebe2e9a19.yaml new file mode 100644 index 0000000..e7d5239 --- /dev/null +++ b/deployment_scripts/puppet/modules/tempest/releasenotes/notes/designate-e22d3f4ebe2e9a19.yaml @@ -0,0 +1,3 @@ +--- +features: + - Add support to test Designate. diff --git a/deployment_scripts/puppet/modules/tempest/releasenotes/notes/ec2api-package-db30bb668b138b03.yaml b/deployment_scripts/puppet/modules/tempest/releasenotes/notes/ec2api-package-db30bb668b138b03.yaml new file mode 100644 index 0000000..dfd0888 --- /dev/null +++ b/deployment_scripts/puppet/modules/tempest/releasenotes/notes/ec2api-package-db30bb668b138b03.yaml @@ -0,0 +1,3 @@ +--- +features: + - When ec2api is enabled, install the tests packages from RDO. diff --git a/deployment_scripts/puppet/modules/tempest/releasenotes/notes/expose-neutron-api-extensions-b5ae613fa6ea32f9.yaml b/deployment_scripts/puppet/modules/tempest/releasenotes/notes/expose-neutron-api-extensions-b5ae613fa6ea32f9.yaml new file mode 100644 index 0000000..01cd522 --- /dev/null +++ b/deployment_scripts/puppet/modules/tempest/releasenotes/notes/expose-neutron-api-extensions-b5ae613fa6ea32f9.yaml @@ -0,0 +1,6 @@ +--- +features: + - | + The new ``neutron_api_extensions`` parameter allows to configure + ``tempest`` to execute only tests that don't rely on anything beyond the + list of API extensions specified by the parameter. diff --git a/deployment_scripts/puppet/modules/tempest/releasenotes/notes/manifests-to-install-tempest-from-package-dbf74b77aced0ec4.yaml b/deployment_scripts/puppet/modules/tempest/releasenotes/notes/manifests-to-install-tempest-from-package-dbf74b77aced0ec4.yaml new file mode 100644 index 0000000..a15c7ab --- /dev/null +++ b/deployment_scripts/puppet/modules/tempest/releasenotes/notes/manifests-to-install-tempest-from-package-dbf74b77aced0ec4.yaml @@ -0,0 +1,3 @@ +--- +features: + - Added manifests to install tempest from package diff --git a/deployment_scripts/puppet/modules/tempest/releasenotes/notes/mitaka_features-985958b8632659c0.yaml b/deployment_scripts/puppet/modules/tempest/releasenotes/notes/mitaka_features-985958b8632659c0.yaml new file mode 100644 index 0000000..ff36619 --- /dev/null +++ b/deployment_scripts/puppet/modules/tempest/releasenotes/notes/mitaka_features-985958b8632659c0.yaml @@ -0,0 +1,7 @@ +--- +features: + - Add support for Tempest plugin packages. + - Add new services support for Sahara, Zaqar, Ironic, Murano. + - Add parameters needed when running SSL deployments. + - Allow to run puppet-tempest on standalone, by switching id setters + to openstackclient instead of catalog resource indirections. diff --git a/deployment_scripts/puppet/modules/tempest/releasenotes/notes/osclient-fccb30722f2d46a0.yaml b/deployment_scripts/puppet/modules/tempest/releasenotes/notes/osclient-fccb30722f2d46a0.yaml new file mode 100644 index 0000000..8aed534 --- /dev/null +++ b/deployment_scripts/puppet/modules/tempest/releasenotes/notes/osclient-fccb30722f2d46a0.yaml @@ -0,0 +1,5 @@ +--- +features: + - Installation of python-openstackclient by default and make sure the + package is installed before executing our providers that use OpenStack + APIs. diff --git a/deployment_scripts/puppet/modules/tempest/releasenotes/notes/panko-80f401254e26f83c.yaml b/deployment_scripts/puppet/modules/tempest/releasenotes/notes/panko-80f401254e26f83c.yaml new file mode 100644 index 0000000..7216512 --- /dev/null +++ b/deployment_scripts/puppet/modules/tempest/releasenotes/notes/panko-80f401254e26f83c.yaml @@ -0,0 +1,3 @@ +--- +features: + - Add Panko Tempest plugin support. diff --git a/deployment_scripts/puppet/modules/tempest/releasenotes/notes/remove_verbose-712eaabc11a60423.yaml b/deployment_scripts/puppet/modules/tempest/releasenotes/notes/remove_verbose-712eaabc11a60423.yaml new file mode 100644 index 0000000..9a865cd --- /dev/null +++ b/deployment_scripts/puppet/modules/tempest/releasenotes/notes/remove_verbose-712eaabc11a60423.yaml @@ -0,0 +1,4 @@ +--- +other: + - The verbose option was marked to be removed in Ocata, + in Newton the option was deprecated. diff --git a/deployment_scripts/puppet/modules/tempest/releasenotes/notes/rename-deprecated-options-fdc3761398ee88ed.yaml b/deployment_scripts/puppet/modules/tempest/releasenotes/notes/rename-deprecated-options-fdc3761398ee88ed.yaml new file mode 100644 index 0000000..5036b1a --- /dev/null +++ b/deployment_scripts/puppet/modules/tempest/releasenotes/notes/rename-deprecated-options-fdc3761398ee88ed.yaml @@ -0,0 +1,4 @@ +--- +deprecations: + - Rename deprecated configuration options including the + "tenant" term. diff --git a/deployment_scripts/puppet/modules/tempest/releasenotes/notes/switch_to_oslo-524aee1c79d121a4.yaml b/deployment_scripts/puppet/modules/tempest/releasenotes/notes/switch_to_oslo-524aee1c79d121a4.yaml new file mode 100644 index 0000000..fc6923a --- /dev/null +++ b/deployment_scripts/puppet/modules/tempest/releasenotes/notes/switch_to_oslo-524aee1c79d121a4.yaml @@ -0,0 +1,4 @@ +--- +features: + - Switch to puppet-oslo resource usage (instead of + manual configuration file editing). diff --git a/deployment_scripts/puppet/modules/tempest/releasenotes/notes/use-reno-1caaec4ba5aa4285.yaml b/deployment_scripts/puppet/modules/tempest/releasenotes/notes/use-reno-1caaec4ba5aa4285.yaml new file mode 100644 index 0000000..41cef2f --- /dev/null +++ b/deployment_scripts/puppet/modules/tempest/releasenotes/notes/use-reno-1caaec4ba5aa4285.yaml @@ -0,0 +1,4 @@ +--- +features: + - Release notes are no longer maintained by hand, we now use the reno tool to + manage them. diff --git a/deployment_scripts/puppet/modules/tempest/releasenotes/notes/verbose_deprecated-199b555f384fb0fc.yaml b/deployment_scripts/puppet/modules/tempest/releasenotes/notes/verbose_deprecated-199b555f384fb0fc.yaml new file mode 100644 index 0000000..9819bae --- /dev/null +++ b/deployment_scripts/puppet/modules/tempest/releasenotes/notes/verbose_deprecated-199b555f384fb0fc.yaml @@ -0,0 +1,4 @@ +--- +deprecations: + - verbose parameter is deprecated and does nothing. It will be removed + after Newton cycle. diff --git a/deployment_scripts/puppet/modules/tempest/releasenotes/source/_static/.placeholder b/deployment_scripts/puppet/modules/tempest/releasenotes/source/_static/.placeholder new file mode 100644 index 0000000..e69de29 diff --git a/deployment_scripts/puppet/modules/tempest/releasenotes/source/conf.py b/deployment_scripts/puppet/modules/tempest/releasenotes/source/conf.py new file mode 100644 index 0000000..cbd3fe7 --- /dev/null +++ b/deployment_scripts/puppet/modules/tempest/releasenotes/source/conf.py @@ -0,0 +1,261 @@ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# If extensions (or modules to document with autodoc) are in another directory, +# add these directories to sys.path here. If the directory is relative to the +# documentation root, use os.path.abspath to make it absolute, like shown here. +#sys.path.insert(0, os.path.abspath('.')) + +# -- General configuration ------------------------------------------------ + +# If your documentation needs a minimal Sphinx version, state it here. +#needs_sphinx = '1.0' + +# Add any Sphinx extension module names here, as strings. They can be +# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom +# ones. +extensions = [ + 'oslosphinx', + 'reno.sphinxext', +] + +# Add any paths that contain templates here, relative to this directory. +templates_path = ['_templates'] + +# The suffix of source filenames. +source_suffix = '.rst' + +# The encoding of source files. +#source_encoding = 'utf-8-sig' + +# The master toctree document. +master_doc = 'index' + +# General information about the project. +project = u'puppet-tempest Release Notes' +copyright = u'2017, Puppet OpenStack Developers' + +# The version info for the project you're documenting, acts as replacement for +# |version| and |release|, also used in various other places throughout the +# built documents. +# +# The short X.Y version. +version = '11.1.0' +# The full version, including alpha/beta/rc tags. +release = '11.1.0-dev' + +# The language for content autogenerated by Sphinx. Refer to documentation +# for a list of supported languages. +#language = None + +# There are two options for replacing |today|: either, you set today to some +# non-false value, then it is used: +#today = '' +# Else, today_fmt is used as the format for a strftime call. +#today_fmt = '%B %d, %Y' + +# List of patterns, relative to source directory, that match files and +# directories to ignore when looking for source files. +exclude_patterns = [] + +# The reST default role (used for this markup: `text`) to use for all +# documents. +#default_role = None + +# If true, '()' will be appended to :func: etc. cross-reference text. +#add_function_parentheses = True + +# If true, the current module name will be prepended to all description +# unit titles (such as .. function::). +#add_module_names = True + +# If true, sectionauthor and moduleauthor directives will be shown in the +# output. They are ignored by default. +#show_authors = False + +# The name of the Pygments (syntax highlighting) style to use. +pygments_style = 'sphinx' + +# A list of ignored prefixes for module index sorting. +#modindex_common_prefix = [] + +# If true, keep warnings as "system message" paragraphs in the built documents. +#keep_warnings = False + + +# -- Options for HTML output ---------------------------------------------- + +# The theme to use for HTML and HTML Help pages. See the documentation for +# a list of builtin themes. +html_theme = 'default' + +# Theme options are theme-specific and customize the look and feel of a theme +# further. For a list of options available for each theme, see the +# documentation. +#html_theme_options = {} + +# Add any paths that contain custom themes here, relative to this directory. +#html_theme_path = [] + +# The name for this set of Sphinx documents. If None, it defaults to +# " v documentation". +#html_title = None + +# A shorter title for the navigation bar. Default is the same as html_title. +#html_short_title = None + +# The name of an image file (relative to this directory) to place at the top +# of the sidebar. +#html_logo = None + +# The name of an image file (within the static path) to use as favicon of the +# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 +# pixels large. +#html_favicon = None + +# Add any paths that contain custom static files (such as style sheets) here, +# relative to this directory. They are copied after the builtin static files, +# so a file named "default.css" will overwrite the builtin "default.css". +html_static_path = ['_static'] + +# Add any extra paths that contain custom files (such as robots.txt or +# .htaccess) here, relative to this directory. These files are copied +# directly to the root of the documentation. +#html_extra_path = [] + +# If not '', a 'Last updated on:' timestamp is inserted at every page bottom, +# using the given strftime format. +#html_last_updated_fmt = '%b %d, %Y' + +# If true, SmartyPants will be used to convert quotes and dashes to +# typographically correct entities. +#html_use_smartypants = True + +# Custom sidebar templates, maps document names to template names. +#html_sidebars = {} + +# Additional templates that should be rendered to pages, maps page names to +# template names. +#html_additional_pages = {} + +# If false, no module index is generated. +#html_domain_indices = True + +# If false, no index is generated. +#html_use_index = True + +# If true, the index is split into individual pages for each letter. +#html_split_index = False + +# If true, links to the reST sources are added to the pages. +#html_show_sourcelink = True + +# If true, "Created using Sphinx" is shown in the HTML footer. Default is True. +#html_show_sphinx = True + +# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. +#html_show_copyright = True + +# If true, an OpenSearch description file will be output, and all pages will +# contain a tag referring to it. The value of this option must be the +# base URL from which the finished HTML is served. +#html_use_opensearch = '' + +# This is the file name suffix for HTML files (e.g. ".xhtml"). +#html_file_suffix = None + +# Output file base name for HTML help builder. +htmlhelp_basename = 'puppet-tempestReleaseNotesdoc' + + +# -- Options for LaTeX output --------------------------------------------- + +latex_elements = { +# The paper size ('letterpaper' or 'a4paper'). +#'papersize': 'letterpaper', + +# The font size ('10pt', '11pt' or '12pt'). +#'pointsize': '10pt', + +# Additional stuff for the LaTeX preamble. +#'preamble': '', +} + +# Grouping the document tree into LaTeX files. List of tuples +# (source start file, target name, title, +# author, documentclass [howto, manual, or own class]). +latex_documents = [ + ('index', 'puppet-tempestReleaseNotes.tex', u'puppet-tempest Release Notes Documentation', + u'2017, Puppet OpenStack Developers', 'manual'), +] + +# The name of an image file (relative to this directory) to place at the top of +# the title page. +#latex_logo = None + +# For "manual" documents, if this is true, then toplevel headings are parts, +# not chapters. +#latex_use_parts = False + +# If true, show page references after internal links. +#latex_show_pagerefs = False + +# If true, show URL addresses after external links. +#latex_show_urls = False + +# Documents to append as an appendix to all manuals. +#latex_appendices = [] + +# If false, no module index is generated. +#latex_domain_indices = True + + +# -- Options for manual page output --------------------------------------- + +# One entry per manual page. List of tuples +# (source start file, name, description, authors, manual section). +man_pages = [ + ('index', 'puppet-tempestreleasenotes', u'puppet-tempest Release Notes Documentation', + [u'2017, Puppet OpenStack Developers'], 1) +] + +# If true, show URL addresses after external links. +#man_show_urls = False + + +# -- Options for Texinfo output ------------------------------------------- + +# Grouping the document tree into Texinfo files. List of tuples +# (source start file, target name, title, author, +# dir menu entry, description, category) +texinfo_documents = [ + ('index', 'puppet-tempestReleaseNotes', u'puppet-tempest Release Notes Documentation', + u'2017, Puppet OpenStack Developers', 'puppet-tempestReleaseNotes', 'One line description of project.', + 'Miscellaneous'), +] + +# Documents to append as an appendix to all manuals. +#texinfo_appendices = [] + +# If false, no module index is generated. +#texinfo_domain_indices = True + +# How to display URL addresses: 'footnote', 'no', or 'inline'. +#texinfo_show_urls = 'footnote' + +# If true, do not generate a @detailmenu in the "Top" node's menu. +#texinfo_no_detailmenu = False + +# -- Options for Internationalization output ------------------------------ +locale_dirs = ['locale/'] diff --git a/deployment_scripts/puppet/modules/tempest/releasenotes/source/index.rst b/deployment_scripts/puppet/modules/tempest/releasenotes/source/index.rst new file mode 100644 index 0000000..b7afcd3 --- /dev/null +++ b/deployment_scripts/puppet/modules/tempest/releasenotes/source/index.rst @@ -0,0 +1,21 @@ +======================================== +Welcome to puppet-tempest Release Notes! +======================================== + +Contents +======== + +.. toctree:: + :maxdepth: 2 + + unreleased + ocata + newton + mitaka + + +Indices and tables +================== + +* :ref:`genindex` +* :ref:`search` diff --git a/deployment_scripts/puppet/modules/tempest/releasenotes/source/mitaka.rst b/deployment_scripts/puppet/modules/tempest/releasenotes/source/mitaka.rst new file mode 100644 index 0000000..97ab8d1 --- /dev/null +++ b/deployment_scripts/puppet/modules/tempest/releasenotes/source/mitaka.rst @@ -0,0 +1,6 @@ +============================ + Mitaka Series Release Notes +============================ + +.. release-notes:: + :branch: origin/stable/mitaka diff --git a/deployment_scripts/puppet/modules/tempest/releasenotes/source/newton.rst b/deployment_scripts/puppet/modules/tempest/releasenotes/source/newton.rst new file mode 100644 index 0000000..97036ed --- /dev/null +++ b/deployment_scripts/puppet/modules/tempest/releasenotes/source/newton.rst @@ -0,0 +1,6 @@ +=================================== + Newton Series Release Notes +=================================== + +.. release-notes:: + :branch: origin/stable/newton diff --git a/deployment_scripts/puppet/modules/tempest/releasenotes/source/ocata.rst b/deployment_scripts/puppet/modules/tempest/releasenotes/source/ocata.rst new file mode 100644 index 0000000..ebe62f4 --- /dev/null +++ b/deployment_scripts/puppet/modules/tempest/releasenotes/source/ocata.rst @@ -0,0 +1,6 @@ +=================================== + Ocata Series Release Notes +=================================== + +.. release-notes:: + :branch: origin/stable/ocata diff --git a/deployment_scripts/puppet/modules/tempest/releasenotes/source/unreleased.rst b/deployment_scripts/puppet/modules/tempest/releasenotes/source/unreleased.rst new file mode 100644 index 0000000..2334dd5 --- /dev/null +++ b/deployment_scripts/puppet/modules/tempest/releasenotes/source/unreleased.rst @@ -0,0 +1,5 @@ +============================== + Current Series Release Notes +============================== + + .. release-notes:: diff --git a/deployment_scripts/puppet/modules/tempest/setup.cfg b/deployment_scripts/puppet/modules/tempest/setup.cfg new file mode 100644 index 0000000..d1ae399 --- /dev/null +++ b/deployment_scripts/puppet/modules/tempest/setup.cfg @@ -0,0 +1,13 @@ +[metadata] +name = puppet-tempest +summary = Puppet module for OpenStack Tempest +description-file = + README.md +author = Puppet Labs and OpenStack Contributors +author-email = openstack-dev@lists.openstack.org +home-page = http://docs.openstack.org/developer/puppet-openstack-guide +classifier = + Intended Audience :: Developers + Intended Audience :: System Administrators + License :: OSI Approved :: Apache Software License + Operating System :: POSIX :: Linux diff --git a/deployment_scripts/puppet/modules/tempest/setup.py b/deployment_scripts/puppet/modules/tempest/setup.py new file mode 100644 index 0000000..70c2b3f --- /dev/null +++ b/deployment_scripts/puppet/modules/tempest/setup.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python +# Copyright (c) 2013 Hewlett-Packard Development Company, L.P. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# THIS FILE IS MANAGED BY THE GLOBAL REQUIREMENTS REPO - DO NOT EDIT +import setuptools + +setuptools.setup( + setup_requires=['pbr'], + pbr=True) diff --git a/deployment_scripts/puppet/modules/tempest/spec/acceptance/basic_tempest_spec.rb b/deployment_scripts/puppet/modules/tempest/spec/acceptance/basic_tempest_spec.rb new file mode 100644 index 0000000..26975da --- /dev/null +++ b/deployment_scripts/puppet/modules/tempest/spec/acceptance/basic_tempest_spec.rb @@ -0,0 +1,27 @@ +require 'spec_helper_acceptance' + +describe 'basic tempest' do + + context 'default parameters' do + + it 'should work with no errors' do + pp= <<-EOS + include ::openstack_integration + include ::openstack_integration::repos + + class { '::tempest': + setup_venv => true, + configure_images => false, + configure_networks => false, + manage_tests_packages => true, + } + EOS + + + # Run it twice and test for idempotency + apply_manifest(pp, :catch_failures => true) + apply_manifest(pp, :catch_changes => true) + end + + end +end diff --git a/deployment_scripts/puppet/modules/tempest/spec/acceptance/nodesets/centos-70-x64.yml b/deployment_scripts/puppet/modules/tempest/spec/acceptance/nodesets/centos-70-x64.yml new file mode 100644 index 0000000..5f097e9 --- /dev/null +++ b/deployment_scripts/puppet/modules/tempest/spec/acceptance/nodesets/centos-70-x64.yml @@ -0,0 +1,11 @@ +HOSTS: + centos-server-70-x64: + roles: + - master + platform: el-7-x86_64 + box: puppetlabs/centos-7.0-64-nocm + box_url: https://vagrantcloud.com/puppetlabs/centos-7.0-64-nocm + hypervisor: vagrant +CONFIG: + log_level: debug + type: foss diff --git a/deployment_scripts/puppet/modules/tempest/spec/acceptance/nodesets/default.yml b/deployment_scripts/puppet/modules/tempest/spec/acceptance/nodesets/default.yml new file mode 100644 index 0000000..486b6a3 --- /dev/null +++ b/deployment_scripts/puppet/modules/tempest/spec/acceptance/nodesets/default.yml @@ -0,0 +1,10 @@ +HOSTS: + ubuntu-server-14.04-amd64: + roles: + - master + platform: ubuntu-14.04-amd64 + box: puppetlabs/ubuntu-14.04-64-nocm + box_url: https://vagrantcloud.com/puppetlabs/ubuntu-14.04-64-nocm + hypervisor: vagrant +CONFIG: + type: foss diff --git a/deployment_scripts/puppet/modules/tempest/spec/acceptance/nodesets/nodepool-centos7.yml b/deployment_scripts/puppet/modules/tempest/spec/acceptance/nodesets/nodepool-centos7.yml new file mode 100644 index 0000000..c552874 --- /dev/null +++ b/deployment_scripts/puppet/modules/tempest/spec/acceptance/nodesets/nodepool-centos7.yml @@ -0,0 +1,10 @@ +HOSTS: + centos-70-x64: + roles: + - master + platform: el-7-x86_64 + hypervisor: none + ip: 127.0.0.1 +CONFIG: + type: foss + set_env: false diff --git a/deployment_scripts/puppet/modules/tempest/spec/acceptance/nodesets/nodepool-trusty.yml b/deployment_scripts/puppet/modules/tempest/spec/acceptance/nodesets/nodepool-trusty.yml new file mode 100644 index 0000000..9fc624e --- /dev/null +++ b/deployment_scripts/puppet/modules/tempest/spec/acceptance/nodesets/nodepool-trusty.yml @@ -0,0 +1,10 @@ +HOSTS: + ubuntu-14.04-amd64: + roles: + - master + platform: ubuntu-14.04-amd64 + hypervisor: none + ip: 127.0.0.1 +CONFIG: + type: foss + set_env: false diff --git a/deployment_scripts/puppet/modules/tempest/spec/acceptance/nodesets/nodepool-xenial.yml b/deployment_scripts/puppet/modules/tempest/spec/acceptance/nodesets/nodepool-xenial.yml new file mode 100644 index 0000000..99dd318 --- /dev/null +++ b/deployment_scripts/puppet/modules/tempest/spec/acceptance/nodesets/nodepool-xenial.yml @@ -0,0 +1,10 @@ +HOSTS: + ubuntu-16.04-amd64: + roles: + - master + platform: ubuntu-16.04-amd64 + hypervisor: none + ip: 127.0.0.1 +CONFIG: + type: foss + set_env: false diff --git a/deployment_scripts/puppet/modules/tempest/spec/acceptance/nodesets/ubuntu-server-1404-x64.yml b/deployment_scripts/puppet/modules/tempest/spec/acceptance/nodesets/ubuntu-server-1404-x64.yml new file mode 100644 index 0000000..8001929 --- /dev/null +++ b/deployment_scripts/puppet/modules/tempest/spec/acceptance/nodesets/ubuntu-server-1404-x64.yml @@ -0,0 +1,11 @@ +HOSTS: + ubuntu-server-14.04-amd64: + roles: + - master + platform: ubuntu-14.04-amd64 + box: puppetlabs/ubuntu-14.04-64-nocm + box_url: https://vagrantcloud.com/puppetlabs/ubuntu-14.04-64-nocm + hypervisor: vagrant +CONFIG: + log_level: debug + type: foss diff --git a/deployment_scripts/puppet/modules/tempest/spec/classes/tempest_config_spec.rb b/deployment_scripts/puppet/modules/tempest/spec/classes/tempest_config_spec.rb new file mode 100644 index 0000000..3deeee0 --- /dev/null +++ b/deployment_scripts/puppet/modules/tempest/spec/classes/tempest_config_spec.rb @@ -0,0 +1,20 @@ +require 'spec_helper' + +describe 'tempest::config' do + + let :params do + { :tempest_config => { + 'DEFAULT/foo' => { 'value' => 'fooValue' }, + 'DEFAULT/bar' => { 'value' => 'barValue' }, + 'DEFAULT/baz' => { 'ensure' => 'absent' } + } + } + end + + it 'configures arbitrary tempest configurations' do + is_expected.to contain_tempest_config('DEFAULT/foo').with_value('fooValue') + is_expected.to contain_tempest_config('DEFAULT/bar').with_value('barValue') + is_expected.to contain_tempest_config('DEFAULT/baz').with_ensure('absent') + end + +end diff --git a/deployment_scripts/puppet/modules/tempest/spec/classes/tempest_init_spec.rb b/deployment_scripts/puppet/modules/tempest/spec/classes/tempest_init_spec.rb new file mode 100644 index 0000000..51a5470 --- /dev/null +++ b/deployment_scripts/puppet/modules/tempest/spec/classes/tempest_init_spec.rb @@ -0,0 +1,450 @@ +require 'spec_helper' + +describe 'tempest' do + shared_examples 'tempest' do + + let :pre_condition do + "include ::glance + class { 'neutron': rabbit_password => 'passw0rd' }" + end + + context 'without parameters' do + describe "should raise error" do + it { expect { is_expected.to contain_class('tempest::params') }.to raise_error(Puppet::Error, /A value for either image_name or image_ref/) } + end + end + + context 'with image_name parameters' do + let :params do + { :image_name => 'image_name' } + end + + describe "should raise error" do + it { expect { is_expected.to contain_class('tempest::params') }.to raise_error(Puppet::Error, /A value for either image_name_alt or image_ref_alt/) } + end + end + + context 'with image_ref parameters' do + let :params do + { :image_ref => 'image-uuid-1', + :image_ref_alt => 'image-uuid-2' } + end + + it 'configures image_ref' do + is_expected.to contain_tempest_config('compute/image_ref').with_value('image-uuid-1') + end + end + + context 'with image_name' do + let :params do + { :image_name => 'cirros', + :image_name_alt => 'cirros' } + end + + it 'uses a resource to configure image_ref from image_name' do + is_expected.to contain_tempest_glance_id_setter('image_ref').with_image_name('cirros') + end + end + + context 'with image_ref and image_name parameters' do + let :params do + { :image_name => 'cirros', + :image_name_alt => 'cirros', + :image_ref => 'image-uuid-1', + :image_ref_alt => 'image-uuid-2' } + end + + it_raises 'a Puppet::Error', /either image_name or image_ref/ + end + + context 'with public_network_id parameter' do + let :params do + { :neutron_available => true, + :configure_images => false, + :public_network_id => 'net-uuid' } + end + + it 'configures public_network_id' do + is_expected.to contain_tempest_config('network/public_network_id').with_value('net-uuid') + end + end + + context 'with public_network_name parameter' do + let :params do + { :neutron_available => true, + :configure_images => false, + :public_network_name => 'public' } + end + + it 'uses a resource to configure public_network_id from public_network_name' do + is_expected.to contain_tempest_neutron_net_id_setter('public_network_id').with_network_name('public') + end + end + + context 'with public_network_id and public_network_name' do + let :params do + { :neutron_available => true, + :configure_images => false, + :public_network_name => 'public', + :public_network_id => 'net-uuid' } + end + + it_raises 'a Puppet::Error', /either public_network_id or public_network_name/ + end + + context 'without configures images and neutron_available' do + let :params do + { :configure_images => false, + :neutron_available => true } + end + + describe "should raise error" do + it { expect { is_expected.to contain_class('tempest::params') }.to raise_error(Puppet::Error, /A value for either public_network_id or public_network_name/) } + end + end + + context 'with sahara_plugins' do + let :params do + { :configure_images => false, + :sahara_available => true, + :sahara_plugins => ['vanilla'] } + end + + it 'properly configures Sahara plugins in tempest.conf' do + is_expected.to contain_tempest_config('data-processing-feature-enabled/plugins').with_value(['vanilla']) + end + end + + context 'with tempest_roles' do + let :params do + { :configure_images => false, + :tempest_roles => ['Member', 'creator'], } + end + + it 'properly sets tempest_roles in tempest.conf' do + is_expected.to contain_tempest_config('auth/tempest_roles').with_value('Member,creator') + end + end + + context 'with ec2api_available parameter' do + let :params do + { :ec2api_available => true, + :configure_images => false, + } + end + + it 'creates ec2 credentials' do + is_expected.to contain_tempest_ec2_credentials('ec2_test_creds').with( + :ensure => 'present', + :tempest_conf_path => '/var/lib/tempest/etc/tempest.conf', + :user => 'ec2api-tester', + :project => 'openstack' + ) + end + + end + + context 'with parameters' do + let :params do + { :configure_images => true, + :image_name => 'image name', + :image_name_alt => 'image name alt', + :public_network_name => 'network name', + :neutron_available => true, + :install_from_source => true, + :setup_venv => true + } + end + + describe "should install tempest" do + it 'installs packages' do + + is_expected.to contain_package('git') + is_expected.to contain_package('python-setuptools') + + platform_params[:dev_packages].each do |package| + is_expected.to contain_package("#{package}") + end + + is_expected.to contain_class('tempest::params') + + is_expected.to contain_exec('install-pip').with( + :command => 'easy_install pip', + :unless => 'which pip', + :path => ['/bin', '/usr/bin', '/usr/local/bin'], + :require => 'Package[python-setuptools]' + ) + + is_expected.to contain_exec('install-tox').with( + :command => 'pip install -U tox', + :unless => 'which tox', + :path => ['/bin', '/usr/bin', '/usr/local/bin'], + :require => 'Exec[install-pip]' + ) + + is_expected.to contain_vcsrepo('/var/lib/tempest').with( + :ensure => 'present', + :source => 'git://github.com/openstack/tempest.git', + :revision => nil, + :provider => 'git', + :require => 'Package[git]', + :user => 'root' + ) + end + + it 'installs python-openstackclient package' do + is_expected.to contain_package('python-openstackclient').with( + :tag => 'openstack' + ) + end + + it 'configure tempest config' do + is_expected.to contain_tempest_config('auth/admin_domain_name').with(:value => nil) + is_expected.to contain_tempest_config('auth/admin_password').with_secret( true ) + is_expected.to contain_tempest_config('auth/admin_project_name').with(:value => nil) + is_expected.to contain_tempest_config('auth/admin_username').with(:value => nil) + is_expected.to contain_tempest_config('auth/tempest_roles').with(:value => '') + is_expected.to contain_tempest_config('auth/use_dynamic_credentials').with(:value => nil) + is_expected.to contain_tempest_config('dns/nameservers').with(:value => nil) + is_expected.to contain_tempest_config('compute/change_password_available').with(:value => nil) + is_expected.to contain_tempest_config('compute/flavor_ref').with(:value => nil) + is_expected.to contain_tempest_config('compute/flavor_ref_alt').with(:value => nil) + is_expected.to contain_tempest_config('compute/image_alt_ssh_user').with(:value => nil) + is_expected.to contain_tempest_config('compute/image_ref').with(:value => nil) + is_expected.to contain_tempest_config('compute/image_ref_alt').with(:value => nil) + is_expected.to contain_tempest_config('compute/resize_available').with(:value => nil) + is_expected.to contain_tempest_config('compute/build_interval').with(:value => nil) + is_expected.to contain_tempest_config('compute-feature-enabled/attach_encrypted_volume').with(:value => false) + is_expected.to contain_tempest_config('validation/image_ssh_user').with(:value => nil) + is_expected.to contain_tempest_config('validation/run_validation').with(:value => false) + is_expected.to contain_tempest_config('identity/admin_role').with(:value => nil) + is_expected.to contain_tempest_config('identity/auth_version').with(:value => 'v2') + is_expected.to contain_tempest_config('identity/alt_password').with(:value => nil) + is_expected.to contain_tempest_config('identity/alt_password').with_secret( true ) + is_expected.to contain_tempest_config('identity/alt_project_name').with(:value => nil) + is_expected.to contain_tempest_config('identity/alt_username').with(:value => nil) + is_expected.to contain_tempest_config('identity/password').with(:value => nil) + is_expected.to contain_tempest_config('identity/password').with_secret( true ) + is_expected.to contain_tempest_config('identity/project_name').with(:value => nil) + is_expected.to contain_tempest_config('identity/uri').with(:value => nil) + is_expected.to contain_tempest_config('identity/uri_v3').with(:value => nil) + is_expected.to contain_tempest_config('identity/username').with(:value => nil) + is_expected.to contain_tempest_config('identity/ca_certificates_file').with(:value => nil) + is_expected.to contain_tempest_config('identity/disable_ssl_certificate_validation').with(:value => nil) + is_expected.to contain_tempest_config('identity-feature-enabled/api_v2').with(:value => true) + is_expected.to contain_tempest_config('identity-feature-enabled/api_v3').with(:value => true) + is_expected.to contain_tempest_config('image-feature-enabled/api_v1').with(:value => true) + is_expected.to contain_tempest_config('image-feature-enabled/api_v2').with(:value => true) + is_expected.to contain_tempest_config('network-feature-enabled/api_extensions').with(:value => nil) + is_expected.to contain_tempest_config('network/public_network_id').with(:value => nil) + is_expected.to contain_tempest_config('network/public_router_id').with(:value => '') + is_expected.to contain_tempest_config('dashboard/login_url').with(:value => nil) + is_expected.to contain_tempest_config('dashboard/dashboard_url').with(:value => nil) + is_expected.to contain_tempest_config('database/db_flavor_ref').with_value('') + is_expected.to contain_tempest_config('service_available/cinder').with(:value => true) + is_expected.to contain_tempest_config('volume-feature-enabled/backup').with(:value => false) + is_expected.to contain_tempest_config('service_available/glance').with(:value => true) + is_expected.to contain_tempest_config('service_available/heat').with(:value => false) + is_expected.to contain_tempest_config('service_available/ceilometer').with(:value => false) + is_expected.to contain_tempest_config('service_available/aodh').with(:value => false) + is_expected.to contain_tempest_config('service_available/aodh_plugin').with(:value => false) + is_expected.to contain_tempest_config('service_available/bgpvpn').with(:value => false) + is_expected.to contain_tempest_config('service_available/gnocchi').with(:value => false) + is_expected.to contain_tempest_config('service_available/panko').with(:value => false) + is_expected.to contain_tempest_config('service_available/horizon').with(:value => true) + is_expected.to contain_tempest_config('service_available/l2gw').with(:value => false) + is_expected.to contain_tempest_config('service_available/neutron').with(:value => true) + is_expected.to contain_tempest_config('service_available/mistral').with(:value => false) + is_expected.to contain_tempest_config('service_available/vitrage').with(:value => false) + is_expected.to contain_tempest_config('service_available/nova').with(:value => true) + is_expected.to contain_tempest_config('service_available/sahara').with(:value => false) + is_expected.to contain_tempest_config('service_available/murano').with(:value => false) + is_expected.to contain_tempest_config('service_available/swift').with(:value => false) + is_expected.to contain_tempest_config('service_available/trove').with(:value => false) + is_expected.to contain_tempest_config('service_available/ironic').with(:value => false) + is_expected.to contain_tempest_config('service_available/watcher').with(:value => false) + is_expected.to contain_tempest_config('service_available/zaqar').with(:value => false) + is_expected.to contain_tempest_config('service_available/congress').with(:value => false) + is_expected.to contain_tempest_config('service_available/designate').with(:value => false) + is_expected.to contain_tempest_config('service_available/octavia').with(:value => false) + is_expected.to contain_tempest_config('whitebox/db_uri').with(:value => nil) + is_expected.to contain_tempest_config('cli/cli_dir').with(:value => nil) + is_expected.to contain_tempest_config('oslo_concurrency/lock_path').with(:value => '/var/lib/tempest') + is_expected.to contain_tempest_config('DEFAULT/debug').with(:value => false) + is_expected.to contain_tempest_config('DEFAULT/log_file').with_value('') + is_expected.to contain_tempest_config('DEFAULT/use_stderr').with(:value => true) + is_expected.to contain_tempest_config('DEFAULT/use_syslog').with(:value => false) + is_expected.to contain_tempest_config('DEFAULT/logging_context_format_string').with_value('') + is_expected.to contain_tempest_config('scenario/img_dir').with(:value => '/var/lib/tempest') + is_expected.to contain_tempest_config('scenario/img_file').with(:value => 'cirros-0.3.4-x86_64-disk.img') + is_expected.to contain_tempest_config('service_broker/run_service_broker_tests').with(:value => false) + end + + it 'set glance id' do + is_expected.to contain_tempest_glance_id_setter('image_ref').with( + :ensure => 'present', + :tempest_conf_path => '/var/lib/tempest/etc/tempest.conf', + :image_name => 'image name', + ) + + is_expected.to contain_tempest_glance_id_setter('image_ref_alt').with( + :ensure => 'present', + :tempest_conf_path => '/var/lib/tempest/etc/tempest.conf', + :image_name => 'image name alt', + ) + end + + it 'neutron net id' do + is_expected.to contain_tempest_neutron_net_id_setter('public_network_id').with( + :ensure => 'present', + :tempest_conf_path => '/var/lib/tempest/etc/tempest.conf', + :network_name => 'network name', + ) + end + + it 'sets up virtualenv for tempest' do + is_expected.to contain_exec('setup-venv').with( + :command => 'virtualenv /var/lib/tempest/.venv && /var/lib/tempest/.venv/bin/pip install -U -r requirements.txt', + :cwd => '/var/lib/tempest', + :unless => 'test -d /var/lib/tempest/.venv', + :path => ['/bin', '/usr/bin', '/usr/local/bin'] + ) + end + end + end + + context 'install Tempest from package' do + let :params do + {:install_from_source => false, + :image_name => 'image name', + :image_name_alt => 'image name alt'} + end + + it 'checks for tempest package' do + is_expected.to contain_package('tempest').with( + :ensure => 'present', + :name => platform_params[:package_name], + :tag => ['openstack', 'tempest-package'], + ) + end + it 'creates tempest workspace' do + is_expected.to contain_exec('tempest-workspace').with( + :command => 'tempest init /var/lib/tempest', + :path => ['/bin', '/usr/bin'], + :refreshonly => true, + :require => 'Package[tempest]' + ) + end + end + + context 'tempest workspace customization' do + let :params do + {:tempest_workspace => '/tmp/tempest', + :image_name => 'image name', + :image_name_alt => 'image name alt', + :install_from_source => false} + end + + it 'supports customizes tempest workspace' do + is_expected.to contain_exec('tempest-workspace').with( + :command => 'tempest init /tmp/tempest', + ) + end + end + end + + shared_examples 'tempest with plugins packages' do + let :pre_condition do + "include ::glance + class { 'neutron': rabbit_password => 'passw0rd' }" + end + + context 'with when managing tests packages for keystone (required service)' do + let :params do + { :manage_tests_packages => true } + end + + describe "should install keystone tests package" do + it { expect { is_expected.to contain_package('python-keystone-tests') } } + it { expect { is_expected.to_not contain_package('python-aodh-tests') } } + end + end + + context 'with when managing tests packages for aodh (optional service)' do + let :params do + { :manage_tests_packages => true, + :aodh_available => true } + end + + describe "should install aodh tests package" do + it { expect { is_expected.to contain_package('python-aodh-tests') } } + end + end + + context 'with when managing tests packages for sahara (optional service)' do + let :params do + { :manage_tests_packages => true, + :sahara_available => true } + end + + describe "should install sahara tests package" do + it { expect { is_expected.to contain_package('python-sahara-tests-tempest') } } + end + end + + context 'with when managing tests packages for neutron (optional service)' do + let :params do + { :manage_tests_packages => true, + :neutron_available => true } + end + + describe "should install neutron and *aas tests packages" do + it { expect { is_expected.to contain_package('python-neutron-tests') } } + it { expect { is_expected.to contain_package('python-neutron-fwaas-tests') } } + it { expect { is_expected.to contain_package('python-neutron-lbaas-tests') } } + it { expect { is_expected.to contain_package('python-neutron-vpnaas-tests') } } + it { expect { is_expected.to contain_package('python-networking-bgpvpn-tests') } } + it { expect { is_expected.to contain_package('python-networking-l2gw-tests') } } + it { expect { is_expected.to contain_package('python-horizon-tests-tempest') } } + end + end + end + + on_supported_os({ + :supported_os => OSDefaults.get_supported_os + }).each do |os,facts| + context "on #{os}" do + let (:facts) do + facts.merge!(OSDefaults.get_facts({ + :concat_basedir => '/var/lib/puppet/concat', + })) + end + let(:platform_params) do + case facts[:osfamily] + when 'Debian' + { :dev_packages => ['python-dev', + 'libxslt1-dev', + 'libxml2-dev', + 'libssl-dev', + 'libffi-dev', + 'patch', + 'gcc', + 'python-virtualenv' ], + :package_name => 'tempest'} + when 'RedHat' + { :dev_packages => ['python-devel', + 'libxslt-devel', + 'libxml2-devel', + 'openssl-devel', + 'libffi-devel', + 'patch', + 'gcc'], + :package_name => 'openstack-tempest'} + end + end + + it_behaves_like 'tempest' + it_behaves_like 'tempest with plugins packages' + end + end +end diff --git a/deployment_scripts/puppet/modules/tempest/spec/shared_examples.rb b/deployment_scripts/puppet/modules/tempest/spec/shared_examples.rb new file mode 100644 index 0000000..fec0eac --- /dev/null +++ b/deployment_scripts/puppet/modules/tempest/spec/shared_examples.rb @@ -0,0 +1,5 @@ +shared_examples_for "a Puppet::Error" do |description| + it "with message matching #{description.inspect}" do + expect { is_expected.to have_class_count(1) }.to raise_error(Puppet::Error, description) + end +end diff --git a/deployment_scripts/puppet/modules/tempest/spec/spec_helper.rb b/deployment_scripts/puppet/modules/tempest/spec/spec_helper.rb new file mode 100644 index 0000000..cad00b1 --- /dev/null +++ b/deployment_scripts/puppet/modules/tempest/spec/spec_helper.rb @@ -0,0 +1,10 @@ +require 'puppetlabs_spec_helper/module_spec_helper' +require 'shared_examples' +require 'puppet-openstack_spec_helper/facts' + +RSpec.configure do |c| + c.alias_it_should_behave_like_to :it_configures, 'configures' + c.alias_it_should_behave_like_to :it_raises, 'raises' +end + +at_exit { RSpec::Puppet::Coverage.report! } diff --git a/deployment_scripts/puppet/modules/tempest/spec/spec_helper_acceptance.rb b/deployment_scripts/puppet/modules/tempest/spec/spec_helper_acceptance.rb new file mode 100644 index 0000000..9196bc9 --- /dev/null +++ b/deployment_scripts/puppet/modules/tempest/spec/spec_helper_acceptance.rb @@ -0,0 +1 @@ +require 'puppet-openstack_spec_helper/beaker_spec_helper' diff --git a/deployment_scripts/puppet/modules/tempest/spec/unit/provider/tempest_config/ini_setting_spec.rb b/deployment_scripts/puppet/modules/tempest/spec/unit/provider/tempest_config/ini_setting_spec.rb new file mode 100644 index 0000000..1bb1554 --- /dev/null +++ b/deployment_scripts/puppet/modules/tempest/spec/unit/provider/tempest_config/ini_setting_spec.rb @@ -0,0 +1,65 @@ +$LOAD_PATH.push( + File.join( + File.dirname(__FILE__), + '..', + '..', + '..', + 'fixtures', + 'modules', + 'inifile', + 'lib') +) +$LOAD_PATH.push( + File.join( + File.dirname(__FILE__), + '..', + '..', + '..', + 'fixtures', + 'modules', + 'openstacklib', + 'lib') +) + +require 'spec_helper' + +provider_class = Puppet::Type.type(:tempest_config).provider(:ini_setting) +describe provider_class do + + it 'should default to the default setting when no other one is specified' do + resource = Puppet::Type::Tempest_config.new( + {:name => 'DEFAULT/foo', :value => 'bar'} + ) + provider = provider_class.new(resource) + expect(provider.section).to eq('DEFAULT') + expect(provider.setting).to eq('foo') + end + + it 'should allow setting to be set explicitly' do + resource = Puppet::Type::Tempest_config.new( + {:name => 'dude/foo', :value => 'bar'} + ) + provider = provider_class.new(resource) + expect(provider.section).to eq('dude') + expect(provider.setting).to eq('foo') + end + + it 'should ensure absent when is specified as a value' do + resource = Puppet::Type::Tempest_config.new( + {:name => 'dude/foo', :value => '', :path => '/tmp/tempest.conf' } + ) + provider = provider_class.new(resource) + provider.exists? + expect(resource[:ensure]).to eq :absent + end + + it 'should ensure absent when value matches ensure_absent_val' do + resource = Puppet::Type::Tempest_config.new( + {:name => 'dude/foo', :value => 'foo', :ensure_absent_val => 'foo', :path => '/tmp/tempest.conf' } + ) + provider = provider_class.new(resource) + provider.exists? + expect(resource[:ensure]).to eq :absent + end + +end diff --git a/deployment_scripts/puppet/modules/tempest/spec/unit/puppet/provider/ruby_spec.rb b/deployment_scripts/puppet/modules/tempest/spec/unit/puppet/provider/ruby_spec.rb new file mode 100644 index 0000000..9f07e4f --- /dev/null +++ b/deployment_scripts/puppet/modules/tempest/spec/unit/puppet/provider/ruby_spec.rb @@ -0,0 +1,144 @@ +require 'spec_helper' +require 'puppet' + +describe 'Providers' do + glance_provider_class = + Puppet::Type.type(:tempest_glance_id_setter).provider(:openstack) + network_provider_class = + Puppet::Type.type(:tempest_neutron_net_id_setter).provider(:openstack) + + include PuppetlabsSpec::Files + let(:tmpfile) { tmpfilename('ini_setting_test') } + + context 'When getting image or network name' do + before :each do + File.open(tmpfile, 'w') do |fh| + fh.write(orig_content) + end + end + + def validate_file(expected_content, file = tmpfile) + expect(File.read(file)).to eq(expected_content) + end + + let(:glance_params) do + { + title: 'image_ref', + image_name: 'cirros', + tempest_conf_path: tmpfile + } + end + + let(:neutron_params) do + { + title: 'public_network_id', + network_name: 'public', + tempest_conf_path: tmpfile + } + end + + context 'With an existing tempest conf' do + let(:orig_content) do + <<-EOS +# This is a comment +[compute] +; This is also a comment +foo=foovalue +bar = barvalue +master = true +[network] +foo= foovalue2 +[blah] + +EOS + end + + describe glance_provider_class do + it 'should put the glance entry in the right place' do + resource = Puppet::Type::Tempest_glance_id_setter.new(glance_params) + provider = glance_provider_class.new(resource) + provider.instance_variable_set(:'@image_id', 'abcdef') + provider.create + validate_file(<<-EOS +# This is a comment +[compute] +image_ref = abcdef +; This is also a comment +foo=foovalue +bar = barvalue +master = true +[network] +foo= foovalue2 +[blah] + +EOS + ) + end + end + describe network_provider_class do + it 'should put the neutron entry in the right place' do + resource = + Puppet::Type::Tempest_neutron_net_id_setter.new(neutron_params) + provider = network_provider_class.new(resource) + provider.instance_variable_set(:'@network_id', 'abcdef') + provider.create + validate_file(<<-EOS +# This is a comment +[compute] +; This is also a comment +foo=foovalue +bar = barvalue +master = true +[network] +public_network_id = abcdef +foo= foovalue2 +[blah] + +EOS + ) + end + + context 'With an empty tempest conf' do + let(:orig_content) do + <<-EOS +# This is a comment + +EOS + end + + describe glance_provider_class do + it 'should put the glance entry in the right place' do + resource = Puppet::Type::Tempest_glance_id_setter.new(glance_params) + provider = glance_provider_class.new(resource) + provider.instance_variable_set(:'@image_id', 'abcdef') + provider.create + validate_file(<<-EOS +# This is a comment + +[compute] +image_ref = abcdef +EOS + ) + end + end + describe network_provider_class do + it 'should put the neutron entry in the right place' do + resource = + Puppet::Type::Tempest_neutron_net_id_setter.new(neutron_params) + provider = network_provider_class.new(resource) + provider.instance_variable_set(:'@network_id', 'abcdef') + provider.create + validate_file(<<-EOS +# This is a comment + +[network] +public_network_id = abcdef +EOS + ) + end + end + end + end + end + end +end diff --git a/deployment_scripts/puppet/modules/tempest/spec/unit/type/tempest_config_spec.rb b/deployment_scripts/puppet/modules/tempest/spec/unit/type/tempest_config_spec.rb new file mode 100644 index 0000000..88c8f5e --- /dev/null +++ b/deployment_scripts/puppet/modules/tempest/spec/unit/type/tempest_config_spec.rb @@ -0,0 +1,63 @@ +require 'puppet' +require 'puppet/type/tempest_config' + +describe 'Puppet::Type.type(:tempest_config)' do + before :each do + @tempest_config = Puppet::Type.type(:tempest_config).new(:name => 'DEFAULT/foo', :value => 'bar') + end + + it 'should require a name' do + expect { + Puppet::Type.type(:tempest_config).new({}) + }.to raise_error(Puppet::Error, 'Title or name must be provided') + end + + it 'should not expect a name with whitespace' do + expect { + Puppet::Type.type(:tempest_config).new(:name => 'f oo') + }.to raise_error(Puppet::Error, /Invalid value "f oo"/) + end + + it 'should fail when there is no section' do + expect { + Puppet::Type.type(:tempest_config).new(:name => 'foo') + }.to raise_error(Puppet::Error, /Invalid value "foo"/) + end + + it 'should not require a value when ensure is absent' do + Puppet::Type.type(:tempest_config).new(:name => 'DEFAULT/foo', :ensure => :absent) + end + + it 'should accept a valid value' do + @tempest_config[:value] = 'bar' + expect(@tempest_config[:value]).to eq('bar') + end + + it 'should not accept a value with whitespace' do + @tempest_config[:value] = 'b ar' + expect(@tempest_config[:value]).to eq('b ar') + end + + it 'should accept valid ensure values' do + @tempest_config[:ensure] = :present + expect(@tempest_config[:ensure]).to eq(:present) + @tempest_config[:ensure] = :absent + expect(@tempest_config[:ensure]).to eq(:absent) + end + + it 'should not accept invalid ensure values' do + expect { + @tempest_config[:ensure] = :latest + }.to raise_error(Puppet::Error, /Invalid value/) + end + + it 'should autorequire the package that install the file' do + catalog = Puppet::Resource::Catalog.new + package = Puppet::Type.type(:package).new(:name => 'tempest') + catalog.add_resource package, @tempest_config + dependency = @tempest_config.autorequire + expect(dependency.size).to eq(1) + expect(dependency[0].target).to eq(@tempest_config) + expect(dependency[0].source).to eq(package) + end +end diff --git a/deployment_scripts/puppet/modules/tempest/spec/unit/type/tempest_glance_id_setter_spec.rb b/deployment_scripts/puppet/modules/tempest/spec/unit/type/tempest_glance_id_setter_spec.rb new file mode 100644 index 0000000..dd8480e --- /dev/null +++ b/deployment_scripts/puppet/modules/tempest/spec/unit/type/tempest_glance_id_setter_spec.rb @@ -0,0 +1,31 @@ +require 'puppet' +require 'puppet/type/tempest_glance_id_setter' + +describe 'Puppet::Type.type(:tempest_glance_id_setter)' do + it 'should require a name' do + expect { + Puppet::Type.type(:tempest_glance_id_setter).new({}) + }.to raise_error(Puppet::Error, 'Title or name must be provided') + end + + before :each do + @tempest_glance_id_setter = Puppet::Type.type(:tempest_glance_id_setter).new( + :name => 'foo', + :tempest_conf_path => '/tmp/tempest.conf', + :image_name => 'image') + + end + + it 'should accept valid ensure values' do + @tempest_glance_id_setter[:ensure] = :present + expect(@tempest_glance_id_setter[:ensure]).to eq(:present) + @tempest_glance_id_setter[:ensure] = :absent + expect(@tempest_glance_id_setter[:ensure]).to eq(:absent) + end + + it 'should not accept invalid ensure values' do + expect { + @tempest_glance_id_setter[:ensure] = :installed + }.to raise_error(Puppet::Error, /Invalid value/) + end +end diff --git a/deployment_scripts/puppet/modules/tempest/spec/unit/type/tempest_neutron_net_id_setter_spec.rb b/deployment_scripts/puppet/modules/tempest/spec/unit/type/tempest_neutron_net_id_setter_spec.rb new file mode 100644 index 0000000..4bf5da6 --- /dev/null +++ b/deployment_scripts/puppet/modules/tempest/spec/unit/type/tempest_neutron_net_id_setter_spec.rb @@ -0,0 +1,31 @@ +require 'puppet' +require 'puppet/type/tempest_neutron_net_id_setter' + +describe 'Puppet::Type.type(:tempest_neutron_net_id_setter)' do + it 'should require a name' do + expect { + Puppet::Type.type(:tempest_neutron_net_id_setter).new({}) + }.to raise_error(Puppet::Error, 'Title or name must be provided') + end + + before :each do + @tempest_neutron_net_id_setter = Puppet::Type.type(:tempest_neutron_net_id_setter).new( + :name => 'foo', + :tempest_conf_path => '/tmp/tempest.conf', + :network_name => 'image') + + end + + it 'should accept valid ensure values' do + @tempest_neutron_net_id_setter[:ensure] = :present + expect(@tempest_neutron_net_id_setter[:ensure]).to eq(:present) + @tempest_neutron_net_id_setter[:ensure] = :absent + expect(@tempest_neutron_net_id_setter[:ensure]).to eq(:absent) + end + + it 'should not accept invalid ensure values' do + expect { + @tempest_neutron_net_id_setter[:ensure] = :installed + }.to raise_error(Puppet::Error, /Invalid value/) + end +end diff --git a/deployment_scripts/puppet/modules/tempest/test-requirements.txt b/deployment_scripts/puppet/modules/tempest/test-requirements.txt new file mode 100644 index 0000000..1ea50a8 --- /dev/null +++ b/deployment_scripts/puppet/modules/tempest/test-requirements.txt @@ -0,0 +1,7 @@ +# This is required for the docs build jobs +sphinx>=1.5.1 # BSD +oslosphinx>=4.7.0 # Apache-2.0 + +# This is required for the releasenotes build jobs +# FIXME: reno is manually pinned to !=2.0.0 because of bug #1651995 +reno>=1.8.0,!=2.0.0 # Apache-2.0 diff --git a/deployment_scripts/puppet/modules/tempest/tests/init.pp b/deployment_scripts/puppet/modules/tempest/tests/init.pp new file mode 100644 index 0000000..578eb0f --- /dev/null +++ b/deployment_scripts/puppet/modules/tempest/tests/init.pp @@ -0,0 +1,12 @@ +# The baseline for module testing used by Puppet Labs is that each manifest +# should have a corresponding test manifest that declares that class or defined +# type. +# +# Tests are then run by using puppet apply --noop (to check for compilation +# errors and view a log of events) or by fully applying the test in a virtual +# environment (to compare the resulting system state to the desired state). +# +# Learn more about module testing here: +# http://docs.puppetlabs.com/guides/tests_smoke.html +# +include ::tempest diff --git a/deployment_scripts/puppet/modules/tempest/tox.ini b/deployment_scripts/puppet/modules/tempest/tox.ini new file mode 100644 index 0000000..aea06c8 --- /dev/null +++ b/deployment_scripts/puppet/modules/tempest/tox.ini @@ -0,0 +1,8 @@ +[tox] +minversion = 1.6 +skipsdist = True +envlist = releasenotes + +[testenv:releasenotes] +deps = -rtest-requirements.txt +commands = sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html diff --git a/deployment_tasks.yaml b/deployment_tasks.yaml new file mode 100644 index 0000000..d59cc1a --- /dev/null +++ b/deployment_tasks.yaml @@ -0,0 +1,21 @@ +- id: fp-tempest-install + type: puppet + version: 2.0.0 + role: [tempest] + required_for: [post_deployment_end] + requires: [post_deployment_start] + parameters: + puppet_manifest: puppet/manifests/tempest_install.pp + puppet_modules: puppet/modules:/etc/puppet/modules + timeout: 120 + +- id: fp-tempest-run + type: puppet + version: 2.0.0 + role: [tempest] + required_for: [post_deployment_end] + requires: [fp-tempest-install] + parameters: + puppet_manifest: puppet/manifests/tempest_run.pp + puppet_modules: /etc/puppet/modules + timeout: 3600 diff --git a/environment_config.yaml b/environment_config.yaml new file mode 100644 index 0000000..2de2bc2 --- /dev/null +++ b/environment_config.yaml @@ -0,0 +1,37 @@ +attributes: + metadata: + group: 'other' + run_tests: + label: "Run tests" + description: "If checked, test run will be part of deploy process. If not, plugin will simply install virtualenv-tempest deb on the node." + type: checkbox + value: true + weight: 10 + image_name: + label: "Glance image name" + description: "What glance image to use for tests." + type: text + value: "TestVM" + weight: 20 + run_script: + label: "Test run script" + description: "Bash commands to run tests with." + type: textarea + value: | + # you should limit testing scope by providing a regexp to tempest run + # for example: + # tempest run --workspace default -r TestSchedulerAwareConsolidation + # or + # tempest run --workspace default -r AZAdminV2TestJSON.test_get_availability_zone_list_detail + # `default` workspace is created by blugin, it's config is filled with deployment facts. + # it is located in /var/lib/tempest/default. + # + # More documentation and examples as: + # https://docs.openstack.org/developer/tempest/run.html + # + # This text field will be inlined in bash file and executed by puppet. + # Place tempest run commands (or any others) one on each line, right after this one: + weight: 30 + restrictions: + - condition: "settings:tempest.run_tests.value == false" + action: "hide" diff --git a/metadata.yaml b/metadata.yaml new file mode 100644 index 0000000..3579b56 --- /dev/null +++ b/metadata.yaml @@ -0,0 +1,35 @@ +# Plugin name +name: tempest +# Human-readable name +title: The OpenStack Tempest Plugin +# Plugin version +version: '1.0.11' +# Description +description: Deploy openstack tempest in python virtualenv and run it after deployment. +# Required fuel version +fuel_version: ['9.0'] +# Specify license of your plugin +licenses: ['Apache License Version 2.0'] +# Specify author or company name +authors: + - Ivan Zinoviev +# A link to the plugin's page +homepage: 'https://github.com/openstack/fuel-plugin-tempest' +# Specify a group which your plugin implements, possible options: +# network, storage, storage::cinder, storage::glance, hypervisor, +# equipment +groups: [] +# Change `false` to `true` if the plugin can be installed in the environment +# after the deployment. +is_hotpluggable: true + +# The plugin is compatible with releases in the list +releases: + - os: ubuntu + version: mitaka-9.0 + mode: ['ha'] + deployment_scripts_path: deployment_scripts/ + repository_path: repositories/ubuntu + +# Version of plugin package +package_version: '4.0.0' diff --git a/node_roles.yaml b/node_roles.yaml new file mode 100644 index 0000000..b047358 --- /dev/null +++ b/node_roles.yaml @@ -0,0 +1,9 @@ +tempest: + name: 'Tempest' + description: 'Install Tempest virtualenv' + has_primary: false + public_up_required: false + weight: 100 + limits: + max: 1 + recommended: 1 diff --git a/pre_build_hook b/pre_build_hook new file mode 100755 index 0000000..d1466d8 --- /dev/null +++ b/pre_build_hook @@ -0,0 +1,7 @@ +#!/bin/bash -eux + +TEMPEST_DEB="virtualenv-tempest.deb" +TEMPEST_DEB_URL="http://jenkins.example.net/job/virtualenv-tempest/lastSuccessfulBuild/artifact/$TEMPEST_DEB" + +mkdir -p repositories/ubuntu +wget -qO "repositories/ubuntu/$TEMPEST_DEB" "${TEMPEST_DEB_URL}"