summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmilien Macchi <emilien@redhat.com>2016-01-05 16:31:24 -0500
committerEmilien Macchi <emilien@redhat.com>2016-01-05 16:31:24 -0500
commitd54150a1ad61034cb73c6160fb57956d30f2b2d9 (patch)
treed08b05ec8e4495173692cf7c08e1a5a0aaed27d3
parentcb68e4142ed17ab220cde667cd409eb8fa49b4c0 (diff)
Retire openstack/puppet-tuskarHEADmaster
Tuskar is not maintained anymore. Further maintenance should be done in stable branches, but master is no longer supported. Change-Id: I957ef8dc587086f32c918676a66dd8e247e50280
Notes
Notes (review): Code-Review+1: James Slagle <jslagle@redhat.com> Code-Review+2: Yanis Guenane <yguenane@redhat.com> Code-Review+2: Sebastien Badia <seb@sebian.fr> Workflow+1: Sebastien Badia <seb@sebian.fr> Verified+2: Jenkins Submitted-by: Jenkins Submitted-at: Wed, 06 Jan 2016 11:46:50 +0000 Reviewed-on: https://review.openstack.org/263919 Project: openstack/puppet-tuskar Branch: refs/heads/master
-rw-r--r--.gitignore11
-rw-r--r--CHANGELOG.md28
-rw-r--r--Gemfile37
-rw-r--r--LICENSE176
-rw-r--r--README.md82
-rw-r--r--Rakefile85
-rw-r--r--examples/site.pp27
-rw-r--r--lib/puppet/provider/tuskar.rb113
-rw-r--r--lib/puppet/provider/tuskar_config/ini_setting.rb10
-rw-r--r--lib/puppet/type/tuskar_config.rb53
-rw-r--r--manifests/api.pp143
-rw-r--r--manifests/client.pp40
-rw-r--r--manifests/config.pp30
-rw-r--r--manifests/db.pp104
-rw-r--r--manifests/db/mysql.pp83
-rw-r--r--manifests/db/postgresql.pp47
-rw-r--r--manifests/db/sync.pp27
-rw-r--r--manifests/generic_service.pp93
-rw-r--r--manifests/init.pp68
-rw-r--r--manifests/keystone/auth.pp213
-rw-r--r--manifests/logging.pp155
-rw-r--r--manifests/params.pp29
-rw-r--r--manifests/ui.pp53
-rw-r--r--metadata.json39
-rw-r--r--spec/acceptance/nodesets/centos-70-x64.yml11
-rw-r--r--spec/acceptance/nodesets/default.yml10
-rw-r--r--spec/acceptance/nodesets/nodepool-centos7.yml10
-rw-r--r--spec/acceptance/nodesets/nodepool-trusty.yml10
-rw-r--r--spec/acceptance/nodesets/ubuntu-server-1404-x64.yml11
-rw-r--r--spec/classes/tuskar_api_spec.rb91
-rw-r--r--spec/classes/tuskar_client_spec.rb38
-rw-r--r--spec/classes/tuskar_config_spec.rb20
-rw-r--r--spec/classes/tuskar_db_mysql_spec.rb95
-rw-r--r--spec/classes/tuskar_db_postgresql_spec.rb58
-rw-r--r--spec/classes/tuskar_db_spec.rb128
-rw-r--r--spec/classes/tuskar_init_spec.rb30
-rw-r--r--spec/classes/tuskar_keystone_auth_spec.rb114
-rw-r--r--spec/classes/tuskar_logging_spec.rb146
-rw-r--r--spec/classes/tuskar_ui_spec.rb79
-rw-r--r--spec/shared_examples.rb60
-rw-r--r--spec/spec_helper.rb13
-rw-r--r--spec/spec_helper_acceptance.rb56
-rw-r--r--spec/unit/provider/tuskar_config/ini_setting_spec.rb66
-rw-r--r--spec/unit/type/tuskar_config_spec.rb63
44 files changed, 2 insertions, 2853 deletions
diff --git a/.gitignore b/.gitignore
deleted file mode 100644
index 15c55ef..0000000
--- a/.gitignore
+++ /dev/null
@@ -1,11 +0,0 @@
1pkg/
2Gemfile.lock
3vendor/
4spec/fixtures/
5.vagrant/
6.bundle/
7coverage/
8.idea/
9*.swp
10*.iml
11openstack/
diff --git a/CHANGELOG.md b/CHANGELOG.md
deleted file mode 100644
index e99154f..0000000
--- a/CHANGELOG.md
+++ /dev/null
@@ -1,28 +0,0 @@
1##2015-11-25 - 7.0.0
2###Summary
3
4This is a backwards-compatible major release for OpenStack Liberty.
5
6####Features
7- keystone/auth: make service description configurable
8- add tag to package and service resources
9- add tuskar::config class
10- reflect provider change in puppet-openstacklib
11- put all the logging related parameters to the logging class
12- introduce tuskar::db class
13- switch Tuskar to $::os_service_default
14- db: use postgresql lib class for psycopg package
15
16####Bugfixes
17- rely on autorequire for config resource ordering
18
19####Maintenance
20- initial msync run for all Puppet OpenStack modules
21- try to use zuul-cloner to prepare fixtures
22- remove class_parameter_defaults puppet-lint check
23- fix rspec 3.x syntax
24
25##2015-07-08 - 6.0.0
26###Summary
27
28- Initial release of the puppet-tuskar module
diff --git a/Gemfile b/Gemfile
deleted file mode 100644
index fc22143..0000000
--- a/Gemfile
+++ /dev/null
@@ -1,37 +0,0 @@
1source ENV['GEM_SOURCE'] || "https://rubygems.org"
2
3group :development, :test do
4 gem 'puppetlabs_spec_helper', :require => 'false'
5 gem 'rspec-puppet', '~> 2.2.0', :require => 'false'
6 gem 'metadata-json-lint', :require => 'false'
7 gem 'puppet-lint-param-docs', :require => 'false'
8 gem 'puppet-lint-absolute_classname-check', :require => 'false'
9 gem 'puppet-lint-absolute_template_path', :require => 'false'
10 gem 'puppet-lint-trailing_newline-check', :require => 'false'
11 gem 'puppet-lint-unquoted_string-check', :require => 'false'
12 gem 'puppet-lint-leading_zero-check', :require => 'false'
13 gem 'puppet-lint-variable_contains_upcase', :require => 'false'
14 gem 'puppet-lint-numericvariable', :require => 'false'
15 gem 'json', :require => 'false'
16 gem 'webmock', :require => 'false'
17end
18
19group :system_tests do
20 gem 'beaker-rspec', :require => 'false'
21 gem 'beaker-puppet_install_helper', :require => 'false'
22 gem 'r10k', :require => 'false'
23end
24
25if facterversion = ENV['FACTER_GEM_VERSION']
26 gem 'facter', facterversion, :require => false
27else
28 gem 'facter', :require => false
29end
30
31if puppetversion = ENV['PUPPET_GEM_VERSION']
32 gem 'puppet', puppetversion, :require => false
33else
34 gem 'puppet', :require => false
35end
36
37# vim:ft=ruby
diff --git a/LICENSE b/LICENSE
deleted file mode 100644
index 68c771a..0000000
--- a/LICENSE
+++ /dev/null
@@ -1,176 +0,0 @@
1
2 Apache License
3 Version 2.0, January 2004
4 http://www.apache.org/licenses/
5
6 TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
8 1. Definitions.
9
10 "License" shall mean the terms and conditions for use, reproduction,
11 and distribution as defined by Sections 1 through 9 of this document.
12
13 "Licensor" shall mean the copyright owner or entity authorized by
14 the copyright owner that is granting the License.
15
16 "Legal Entity" shall mean the union of the acting entity and all
17 other entities that control, are controlled by, or are under common
18 control with that entity. For the purposes of this definition,
19 "control" means (i) the power, direct or indirect, to cause the
20 direction or management of such entity, whether by contract or
21 otherwise, or (ii) ownership of fifty percent (50%) or more of the
22 outstanding shares, or (iii) beneficial ownership of such entity.
23
24 "You" (or "Your") shall mean an individual or Legal Entity
25 exercising permissions granted by this License.
26
27 "Source" form shall mean the preferred form for making modifications,
28 including but not limited to software source code, documentation
29 source, and configuration files.
30
31 "Object" form shall mean any form resulting from mechanical
32 transformation or translation of a Source form, including but
33 not limited to compiled object code, generated documentation,
34 and conversions to other media types.
35
36 "Work" shall mean the work of authorship, whether in Source or
37 Object form, made available under the License, as indicated by a
38 copyright notice that is included in or attached to the work
39 (an example is provided in the Appendix below).
40
41 "Derivative Works" shall mean any work, whether in Source or Object
42 form, that is based on (or derived from) the Work and for which the
43 editorial revisions, annotations, elaborations, or other modifications
44 represent, as a whole, an original work of authorship. For the purposes
45 of this License, Derivative Works shall not include works that remain
46 separable from, or merely link (or bind by name) to the interfaces of,
47 the Work and Derivative Works thereof.
48
49 "Contribution" shall mean any work of authorship, including
50 the original version of the Work and any modifications or additions
51 to that Work or Derivative Works thereof, that is intentionally
52 submitted to Licensor for inclusion in the Work by the copyright owner
53 or by an individual or Legal Entity authorized to submit on behalf of
54 the copyright owner. For the purposes of this definition, "submitted"
55 means any form of electronic, verbal, or written communication sent
56 to the Licensor or its representatives, including but not limited to
57 communication on electronic mailing lists, source code control systems,
58 and issue tracking systems that are managed by, or on behalf of, the
59 Licensor for the purpose of discussing and improving the Work, but
60 excluding communication that is conspicuously marked or otherwise
61 designated in writing by the copyright owner as "Not a Contribution."
62
63 "Contributor" shall mean Licensor and any individual or Legal Entity
64 on behalf of whom a Contribution has been received by Licensor and
65 subsequently incorporated within the Work.
66
67 2. Grant of Copyright License. Subject to the terms and conditions of
68 this License, each Contributor hereby grants to You a perpetual,
69 worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70 copyright license to reproduce, prepare Derivative Works of,
71 publicly display, publicly perform, sublicense, and distribute the
72 Work and such Derivative Works in Source or Object form.
73
74 3. Grant of Patent License. Subject to the terms and conditions of
75 this License, each Contributor hereby grants to You a perpetual,
76 worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77 (except as stated in this section) patent license to make, have made,
78 use, offer to sell, sell, import, and otherwise transfer the Work,
79 where such license applies only to those patent claims licensable
80 by such Contributor that are necessarily infringed by their
81 Contribution(s) alone or by combination of their Contribution(s)
82 with the Work to which such Contribution(s) was submitted. If You
83 institute patent litigation against any entity (including a
84 cross-claim or counterclaim in a lawsuit) alleging that the Work
85 or a Contribution incorporated within the Work constitutes direct
86 or contributory patent infringement, then any patent licenses
87 granted to You under this License for that Work shall terminate
88 as of the date such litigation is filed.
89
90 4. Redistribution. You may reproduce and distribute copies of the
91 Work or Derivative Works thereof in any medium, with or without
92 modifications, and in Source or Object form, provided that You
93 meet the following conditions:
94
95 (a) You must give any other recipients of the Work or
96 Derivative Works a copy of this License; and
97
98 (b) You must cause any modified files to carry prominent notices
99 stating that You changed the files; and
100
101 (c) You must retain, in the Source form of any Derivative Works
102 that You distribute, all copyright, patent, trademark, and
103 attribution notices from the Source form of the Work,
104 excluding those notices that do not pertain to any part of
105 the Derivative Works; and
106
107 (d) If the Work includes a "NOTICE" text file as part of its
108 distribution, then any Derivative Works that You distribute must
109 include a readable copy of the attribution notices contained
110 within such NOTICE file, excluding those notices that do not
111 pertain to any part of the Derivative Works, in at least one
112 of the following places: within a NOTICE text file distributed
113 as part of the Derivative Works; within the Source form or
114 documentation, if provided along with the Derivative Works; or,
115 within a display generated by the Derivative Works, if and
116 wherever such third-party notices normally appear. The contents
117 of the NOTICE file are for informational purposes only and
118 do not modify the License. You may add Your own attribution
119 notices within Derivative Works that You distribute, alongside
120 or as an addendum to the NOTICE text from the Work, provided
121 that such additional attribution notices cannot be construed
122 as modifying the License.
123
124 You may add Your own copyright statement to Your modifications and
125 may provide additional or different license terms and conditions
126 for use, reproduction, or distribution of Your modifications, or
127 for any such Derivative Works as a whole, provided Your use,
128 reproduction, and distribution of the Work otherwise complies with
129 the conditions stated in this License.
130
131 5. Submission of Contributions. Unless You explicitly state otherwise,
132 any Contribution intentionally submitted for inclusion in the Work
133 by You to the Licensor shall be under the terms and conditions of
134 this License, without any additional terms or conditions.
135 Notwithstanding the above, nothing herein shall supersede or modify
136 the terms of any separate license agreement you may have executed
137 with Licensor regarding such Contributions.
138
139 6. Trademarks. This License does not grant permission to use the trade
140 names, trademarks, service marks, or product names of the Licensor,
141 except as required for reasonable and customary use in describing the
142 origin of the Work and reproducing the content of the NOTICE file.
143
144 7. Disclaimer of Warranty. Unless required by applicable law or
145 agreed to in writing, Licensor provides the Work (and each
146 Contributor provides its Contributions) on an "AS IS" BASIS,
147 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148 implied, including, without limitation, any warranties or conditions
149 of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150 PARTICULAR PURPOSE. You are solely responsible for determining the
151 appropriateness of using or redistributing the Work and assume any
152 risks associated with Your exercise of permissions under this License.
153
154 8. Limitation of Liability. In no event and under no legal theory,
155 whether in tort (including negligence), contract, or otherwise,
156 unless required by applicable law (such as deliberate and grossly
157 negligent acts) or agreed to in writing, shall any Contributor be
158 liable to You for damages, including any direct, indirect, special,
159 incidental, or consequential damages of any character arising as a
160 result of this License or out of the use or inability to use the
161 Work (including but not limited to damages for loss of goodwill,
162 work stoppage, computer failure or malfunction, or any and all
163 other commercial damages or losses), even if such Contributor
164 has been advised of the possibility of such damages.
165
166 9. Accepting Warranty or Additional Liability. While redistributing
167 the Work or Derivative Works thereof, You may choose to offer,
168 and charge a fee for, acceptance of support, warranty, indemnity,
169 or other liability obligations and/or rights consistent with this
170 License. However, in accepting such obligations, You may act only
171 on Your own behalf and on Your sole responsibility, not on behalf
172 of any other Contributor, and only if You agree to indemnify,
173 defend, and hold each Contributor harmless for any liability
174 incurred by, or claims asserted against, such Contributor by reason
175 of your accepting any such warranty or additional liability.
176
diff --git a/README.md b/README.md
index ae0df82..6e1d363 100644
--- a/README.md
+++ b/README.md
@@ -1,81 +1,3 @@
1puppet-tuskar 1This project is no longer maintained.
2=============
3 2
47.0.0 - 2015.2 - Liberty 3The contents of this repository are still available in the Git source code management system. To see the contents of this repository before it reached its end of life, please check out the previous commit with "git checkout HEAD^1".
5
6#### Table of Contents
7
81. [Overview - What is the tuskar module?](#overview)
92. [Module Description - What does the module do?](#module-description)
103. [Setup - The basics of getting started with tuskar](#setup)
114. [Implementation - An under-the-hood peek at what the module is doing](#implementation)
125. [Limitations - OS compatibility, etc.](#limitations)
136. [Development - Guide for contributing to the module](#development)
147. [Contributors - Those with commits](#contributors)
15
16Overview
17--------
18
19The tuskar 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 as part of the core software. The module itself is used to flexibly configure and manage the management service for Openstack.
20
21Module Description
22------------------
23
24Setup
25-----
26
27**What the tuskar module affects:**
28
29* tuskar, the management service for Openstack.
30
31Implementation
32--------------
33
34### tuskar
35
36tuskar is a combination of Puppet manifest and ruby code to delivery configuration and extra functionality through types and providers.
37
38### Types
39
40#### tuskar_config
41
42The `tuskar_config` provider is a children of the ini_setting provider. It allows one to write an entry in the `/etc/tuskar/tuskar.conf` file.
43
44```puppet
45tuskar_config { 'DEFAULT/verbose' :
46 value => true,
47}
48```
49
50This will write `verbose=true` in the `[DEFAULT]` section.
51
52##### name
53
54Section/setting name to manage from `tuskar.conf`
55
56##### value
57
58The value of the setting to be defined.
59
60##### secret
61
62Whether to hide the value from Puppet logs. Defaults to `false`.
63
64##### ensure_absent_val
65
66If value is equal to ensure_absent_val then the resource will behave as if `ensure => absent` was specified. Defaults to `<SERVICE DEFAULT>`
67
68Limitations
69-----------
70
71Development
72-----------
73
74Developer documentation for the entire puppet-openstack project.
75
76* https://wiki.openstack.org/wiki/Puppet-openstack#Developer_documentation
77
78Contributors
79------------
80
81* https://github.com/openstack/puppet-tuskar/graphs/contributors
diff --git a/Rakefile b/Rakefile
deleted file mode 100644
index ed79bea..0000000
--- a/Rakefile
+++ /dev/null
@@ -1,85 +0,0 @@
1require 'puppetlabs_spec_helper/rake_tasks'
2require 'puppet-lint/tasks/puppet-lint'
3require 'puppet-syntax/tasks/puppet-syntax'
4require 'json'
5
6modname = JSON.parse(open('metadata.json').read)['name'].split('-')[1]
7
8PuppetSyntax.exclude_paths ||= []
9PuppetSyntax.exclude_paths << "spec/fixtures/**/*"
10PuppetSyntax.exclude_paths << "pkg/**/*"
11PuppetSyntax.exclude_paths << "vendor/**/*"
12
13Rake::Task[:lint].clear
14PuppetLint::RakeTask.new :lint do |config|
15 config.ignore_paths = ["spec/**/*.pp", "vendor/**/*.pp"]
16 config.fail_on_warnings = true
17 config.log_format = '%{path}:%{linenumber}:%{KIND}: %{message}'
18 config.disable_checks = ["80chars", "class_inherits_from_params_class", "only_variable_string"]
19end
20
21desc "Run acceptance tests"
22RSpec::Core::RakeTask.new(:acceptance) do |t|
23 t.pattern = 'spec/acceptance'
24end
25
26Rake::Task[:spec_prep].clear
27desc 'Create the fixtures directory'
28task :spec_prep do
29 # Allow to test the module with custom dependencies
30 # like you could do with .fixtures file
31 if ENV['PUPPETFILE']
32 puppetfile = ENV['PUPPETFILE']
33 if ENV['GEM_HOME']
34 gem_home = ENV['GEM_HOME']
35 gem_bin_dir = "#{gem_home}" + '/bin/'
36 else
37 gem_bin_dir = ''
38 end
39 r10k = ['env']
40 r10k += ["PUPPETFILE=#{puppetfile}"]
41 r10k += ["PUPPETFILE_DIR=#{Dir.pwd}/spec/fixtures/modules"]
42 r10k += ["#{gem_bin_dir}r10k"]
43 r10k += ['puppetfile', 'install', '-v']
44 sh(*r10k)
45 else
46 # otherwise, use official OpenStack Puppetfile
47 zuul_ref = ENV['ZUUL_REF']
48 zuul_branch = ENV['ZUUL_BRANCH']
49 zuul_url = ENV['ZUUL_URL']
50 repo = 'openstack/puppet-openstack-integration'
51 rm_rf(repo)
52 if File.exists?('/usr/zuul-env/bin/zuul-cloner')
53 zuul_clone_cmd = ['/usr/zuul-env/bin/zuul-cloner']
54 zuul_clone_cmd += ['--cache-dir', '/opt/git']
55 zuul_clone_cmd += ['--zuul-ref', "#{zuul_ref}"]
56 zuul_clone_cmd += ['--zuul-branch', "#{zuul_branch}"]
57 zuul_clone_cmd += ['--zuul-url', "#{zuul_url}"]
58 zuul_clone_cmd += ['git://git.openstack.org', "#{repo}"]
59 sh(*zuul_clone_cmd)
60 else
61 sh("git clone https://git.openstack.org/#{repo} #{repo}")
62 end
63 script = ['env']
64 script += ["PUPPETFILE_DIR=#{Dir.pwd}/spec/fixtures/modules"]
65 script += ["ZUUL_REF=#{zuul_ref}"]
66 script += ["ZUUL_BRANCH=#{zuul_branch}"]
67 script += ["ZUUL_URL=#{zuul_url}"]
68 script += ['bash', "#{repo}/install_modules_unit.sh"]
69 sh(*script)
70 end
71 rm_rf("spec/fixtures/modules/#{modname}")
72 ln_s(Dir.pwd, "spec/fixtures/modules/#{modname}")
73 mkdir_p('spec/fixtures/manifests')
74 touch('spec/fixtures/manifests/site.pp')
75end
76
77Rake::Task[:spec_clean].clear
78desc 'Clean up the fixtures directory'
79task :spec_clean do
80 rm_rf('spec/fixtures/modules')
81 rm_rf('openstack')
82 if File.zero?('spec/fixtures/manifests/site.pp')
83 rm_f('spec/fixtures/manifests/site.pp')
84 end
85end
diff --git a/examples/site.pp b/examples/site.pp
deleted file mode 100644
index 416b07b..0000000
--- a/examples/site.pp
+++ /dev/null
@@ -1,27 +0,0 @@
1# This is an example of site.pp to deploy Tuskar
2
3class { '::tuskar::client': }
4
5class { '::tuskar::keystone::auth':
6 admin_address => '10.0.0.1',
7 internal_address => '10.0.0.1',
8 public_address => '10.0.0.1',
9 password => 'verysecrete',
10 region => 'OpenStack'
11}
12
13class { '::tuskar::db::mysql':
14 password => 'dbpass',
15 host => '10.0.0.1',
16 allowed_hosts => '10.0.0.1'
17}
18
19class { '::tuskar':
20 database_connection => 'mysql://tuskar:secrete@10.0.0.1/tuskar?charset=utf8',
21}
22
23class { '::tuskar::api':
24 bind_host => '10.0.0.1',
25 identity_uri => 'https://identity.openstack.org:35357',
26 keystone_password => 'verysecrete'
27}
diff --git a/lib/puppet/provider/tuskar.rb b/lib/puppet/provider/tuskar.rb
deleted file mode 100644
index 63c9d7d..0000000
--- a/lib/puppet/provider/tuskar.rb
+++ /dev/null
@@ -1,113 +0,0 @@
1require 'json'
2require 'puppet/util/inifile'
3
4class Puppet::Provider::Tuskar < Puppet::Provider
5
6 def self.conf_filename
7 '/etc/tuskar/tuskar.conf'
8 end
9
10 def self.withenv(hash, &block)
11 saved = ENV.to_hash
12 hash.each do |name, val|
13 ENV[name.to_s] = val
14 end
15
16 yield
17 ensure
18 ENV.clear
19 saved.each do |name, val|
20 ENV[name] = val
21 end
22 end
23
24 def self.tuskar_credentials
25 @tuskar_credentials ||= get_tuskar_credentials
26 end
27
28 def self.get_tuskar_credentials
29 auth_keys = ['auth_host', 'auth_port', 'auth_protocol',
30 'admin_tenant_name', 'admin_user', 'admin_password']
31 conf = tuskar_conf
32 if conf and conf['keystone_authtoken'] and
33 auth_keys.all?{|k| !conf['keystone_authtoken'][k].nil?}
34 return Hash[ auth_keys.map \
35 { |k| [k, conf['keystone_authtoken'][k].strip] } ]
36 else
37 raise(Puppet::Error, "File: #{conf_filename} does not contain all \
38required sections. Tuskar types will not work if tuskar is not \
39correctly configured.")
40 end
41 end
42
43 def tuskar_credentials
44 self.class.tuskar_credentials
45 end
46
47 def self.auth_endpoint
48 @auth_endpoint ||= get_auth_endpoint
49 end
50
51 def self.get_auth_endpoint
52 q = tuskar_credentials
53 "#{q['auth_protocol']}://#{q['auth_host']}:#{q['auth_port']}/v2.0/"
54 end
55
56 def self.tuskar_conf
57 return @tuskar_conf if @tuskar_conf
58 @tuskar_conf = Puppet::Util::IniConfig::File.new
59 @tuskar_conf.read(conf_filename)
60 @tuskar_conf
61 end
62
63 def self.auth_tuskar(*args)
64 q = tuskar_credentials
65 authenv = {
66 :OS_AUTH_URL => self.auth_endpoint,
67 :OS_USERNAME => q['admin_user'],
68 :OS_TENANT_NAME => q['admin_tenant_name'],
69 :OS_PASSWORD => q['admin_password']
70 }
71 begin
72 withenv authenv do
73 tuskar(args)
74 end
75 rescue Exception => e
76 if (e.message =~ /\[Errno 111\] Connection refused/) or
77 (e.message =~ /\(HTTP 400\)/)
78 sleep 10
79 withenv authenv do
80 tuskar(args)
81 end
82 else
83 raise(e)
84 end
85 end
86 end
87
88 def auth_tuskar(*args)
89 self.class.auth_tuskar(args)
90 end
91
92 def tuskar_manage(*args)
93 cmd = args.join(" ")
94 output = `#{cmd}`
95 $?.exitstatus
96 end
97
98 def self.reset
99 @tuskar_conf = nil
100 @tuskar_credentials = nil
101 end
102
103 def self.list_tuskar_resources(type, *args)
104 json = auth_tuskar("--json", "#{type}-list", *args)
105 return JSON.parse(json)
106 end
107
108 def self.get_tuskar_resource_attrs(type, id)
109 json = auth_tuskar("--json", "#{type}-show", id)
110 return JSON.parse(json)
111 end
112
113end
diff --git a/lib/puppet/provider/tuskar_config/ini_setting.rb b/lib/puppet/provider/tuskar_config/ini_setting.rb
deleted file mode 100644
index a1d59c1..0000000
--- a/lib/puppet/provider/tuskar_config/ini_setting.rb
+++ /dev/null
@@ -1,10 +0,0 @@
1Puppet::Type.type(:tuskar_config).provide(
2 :ini_setting,
3 :parent => Puppet::Type.type(:openstack_config).provider(:ini_setting)
4) do
5
6 def self.file_path
7 '/etc/tuskar/tuskar.conf'
8 end
9
10end
diff --git a/lib/puppet/type/tuskar_config.rb b/lib/puppet/type/tuskar_config.rb
deleted file mode 100644
index ecf36c3..0000000
--- a/lib/puppet/type/tuskar_config.rb
+++ /dev/null
@@ -1,53 +0,0 @@
1Puppet::Type.newtype(:tuskar_config) do
2
3 ensurable
4
5 newparam(:name, :namevar => true) do
6 desc 'Section/setting name to manage from /etc/tuskar/tuskar.conf'
7 newvalues(/\S+\/\S+/)
8 end
9
10 newproperty(:value) do
11 desc 'The value of the setting to be defined.'
12 munge do |value|
13 value = value.to_s.strip
14 value.capitalize! if value =~ /^(true|false)$/i
15 value
16 end
17 newvalues(/^[\S ]*$/)
18
19 def is_to_s( currentvalue )
20 if resource.secret?
21 return '[old secret redacted]'
22 else
23 return currentvalue
24 end
25 end
26
27 def should_to_s( newvalue )
28 if resource.secret?
29 return '[new secret redacted]'
30 else
31 return newvalue
32 end
33 end
34 end
35
36 newparam(:secret, :boolean => true) do
37 desc 'Whether to hide the value from Puppet logs. Defaults to `false`.'
38
39 newvalues(:true, :false)
40
41 defaultto false
42 end
43
44 newparam(:ensure_absent_val) do
45 desc 'A value that is specified as the value property will behave as if ensure => absent was specified'
46 defaultto('<SERVICE DEFAULT>')
47 end
48
49 autorequire(:package) do
50 'tuskar-api'
51 end
52
53end
diff --git a/manifests/api.pp b/manifests/api.pp
deleted file mode 100644
index 5a8fd3c..0000000
--- a/manifests/api.pp
+++ /dev/null
@@ -1,143 +0,0 @@
1#
2# Copyright (C) 2014 eNovance SAS <licensing@enovance.com>
3#
4# Author: Emilien Macchi <emilien.macchi@enovance.com>
5#
6# Licensed under the Apache License, Version 2.0 (the "License"); you may
7# not use this file except in compliance with the License. You may obtain
8# a copy of the License at
9#
10# http://www.apache.org/licenses/LICENSE-2.0
11#
12# Unless required by applicable law or agreed to in writing, software
13# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
14# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
15# License for the specific language governing permissions and limitations
16# under the License.
17#
18# == Class tuskar::api
19#
20# Configure API service in tuskar
21#
22# == Parameters
23#
24# [*manage_service*]
25# (optional) Whether to start/stop the service
26# Defaults to true
27#
28# [*package_ensure*]
29# (optional) Whether the tuskar api package will be installed
30# Defaults to 'present'
31#
32# [*keystone_password*]
33# (required) Password used to authentication.
34#
35# [*verbose*]
36# (optional) Rather to log the tuskar api service at verbose level.
37# Default: undef
38#
39# [*debug*]
40# (optional) Rather to log the tuskar api service at debug level.
41# Default: undef
42#
43# [*bind_host*]
44# (optional) The address of the host to bind to.
45# Default: $::os_service_default
46#
47# [*bind_port*]
48# (optional) The port the server should bind to.
49# Default: $::os_service_default
50#
51# [*log_file*]
52# (optional) The path of file used for logging
53# If set to boolean false, it will not log to any file.
54# Default: undef
55#
56# [*log_dir*]
57# (optional) directory to which tuskar logs are sent.
58# If set to boolean false, it will not log to any directory.
59# Defaults to undef
60#
61# [*keystone_tenant*]
62# (optional) Tenant to authenticate to.
63# Defaults to services.
64#
65# [*keystone_user*]
66# (optional) User to authenticate as with keystone.
67# Defaults to 'tuskar'.
68
69# [*enabled*]
70# (optional) Whether to enable services.
71# Defaults to true.
72#
73# [*use_syslog*]
74# (optional) Use syslog for logging.
75# Defaults to undef.
76#
77# [*use_stderr*]
78# (optional) Use stderr for logging
79# Defaults to undef
80#
81# [*log_facility*]
82# (optional) Syslog facility to receive log lines.
83# Defaults to undef.
84#
85# [*purge_config*]
86# (optional) Whether to set only the specified config options
87# in the api config.
88# Defaults to false.
89#
90# [*identity_uri*]
91# (optional) Complete admin Identity API endpoint.
92# Defaults to 'http://127.0.0.1:35357'.
93#
94class tuskar::api(
95 $keystone_password,
96 $verbose = undef,
97 $debug = undef,
98 $use_syslog = undef,
99 $log_facility = undef,
100 $log_dir = undef,
101 $use_stderr = undef,
102 $log_file = undef,
103 $bind_host = $::os_service_default,
104 $bind_port = $::os_service_default,
105 $keystone_tenant = 'services',
106 $keystone_user = 'tuskar',
107 $identity_uri = 'http://127.0.0.1:35357',
108 $enabled = true,
109 $purge_config = false,
110 $manage_service = true,
111 $package_ensure = 'present',
112) inherits tuskar {
113
114 require ::keystone::python
115 include ::tuskar::logging
116 include ::tuskar::db
117 include ::tuskar::params
118
119 Tuskar_config<||> ~> Exec['post-tuskar_config']
120 Tuskar_config<||> ~> Service['tuskar-api']
121
122 # basic service config
123 tuskar_config {
124 'DEFAULT/tuskar_api_bind_ip': value => $bind_host;
125 'DEFAULT/tuskar_api_port': value => $bind_port;
126 'keystone_authtoken/identity_uri': value => $identity_uri;
127 'keystone_authtoken/admin_user': value => $keystone_user;
128 'keystone_authtoken/admin_password': value => $keystone_password, secret => true;
129 'keystone_authtoken/admin_tenant_name': value => $keystone_tenant;
130 }
131
132 resources { 'tuskar_config':
133 purge => $purge_config,
134 }
135
136 tuskar::generic_service { 'api':
137 enabled => $enabled,
138 manage_service => $manage_service,
139 package_ensure => $package_ensure,
140 package_name => $::tuskar::params::api_package_name,
141 service_name => $::tuskar::params::api_service_name,
142 }
143}
diff --git a/manifests/client.pp b/manifests/client.pp
deleted file mode 100644
index ebbcf10..0000000
--- a/manifests/client.pp
+++ /dev/null
@@ -1,40 +0,0 @@
1#
2# Copyright (C) 2014 eNovance SAS <licensing@enovance.com>
3#
4# Author: Emilien Macchi <emilien.macchi@enovance.com>
5#
6# Licensed under the Apache License, Version 2.0 (the "License"); you may
7# not use this file except in compliance with the License. You may obtain
8# a copy of the License at
9#
10# http://www.apache.org/licenses/LICENSE-2.0
11#
12# Unless required by applicable law or agreed to in writing, software
13# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
14# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
15# License for the specific language governing permissions and limitations
16# under the License.
17
18# tuskar::client
19#
20# Manages the tuskar client package on systems
21#
22# === Parameters:
23#
24# [*package_ensure*]
25# (optional) The state of the package
26# Defaults to present
27#
28#
29class tuskar::client (
30 $package_ensure = present
31) {
32
33 include ::tuskar::params
34
35 package { 'python-tuskarclient':
36 ensure => $package_ensure,
37 name => $::tuskar::params::client_package_name,
38 }
39
40}
diff --git a/manifests/config.pp b/manifests/config.pp
deleted file mode 100644
index 582064c..0000000
--- a/manifests/config.pp
+++ /dev/null
@@ -1,30 +0,0 @@
1# == Class: tuskar::config
2#
3# This class is used to manage arbitrary Tuskar configurations.
4#
5# === Parameters
6#
7# [*tuskar_config*]
8# (optional) Allow configuration of arbitrary Tuskar configurations.
9# The value is an hash of tuskar_config resources. Example:
10# { 'DEFAULT/foo' => { value => 'fooValue'},
11# 'DEFAULT/bar' => { value => 'barValue'}
12# }
13# In yaml format, Example:
14# tuskar_config:
15# DEFAULT/foo:
16# value: fooValue
17# DEFAULT/bar:
18# value: barValue
19#
20# NOTE: The configuration MUST NOT be already handled by this module
21# or Puppet catalog compilation will fail with duplicate resources.
22#
23class tuskar::config (
24 $tuskar_config = {},
25) {
26
27 validate_hash($tuskar_config)
28
29 create_resources('tuskar_config', $tuskar_config)
30}
diff --git a/manifests/db.pp b/manifests/db.pp
deleted file mode 100644
index 319b148..0000000
--- a/manifests/db.pp
+++ /dev/null
@@ -1,104 +0,0 @@
1# == Class: tuskar::db
2#
3# Configure the Neutron database
4#
5# === Parameters
6#
7# [*database_connection*]
8# Url used to connect to database.
9# (Optional) Defaults to 'sqlite:////var/lib/tuskar/tuskar.sqlite'.
10#
11# [*database_idle_timeout*]
12# Timeout when db connections should be reaped.
13# (Optional) Defaults to $::os_service_default.
14#
15# [*database_min_pool_size*]
16# Minimum number of SQL connections to keep open in a pool.
17# (Optional) Defaults to $::os_service_default.
18#
19# [*database_max_pool_size*]
20# Maximum number of SQL connections to keep open in a pool.
21# (Optional) Defaults to $::os_service_default.
22#
23# [*database_max_retries*]
24# Maximum db connection retries during startup.
25# Setting -1 implies an infinite retry count.
26# (Optional) Defaults to $::os_service_default.
27#
28# [*database_retry_interval*]
29# Interval between retries of opening a sql connection.
30# (Optional) Defaults to $::os_service_default.
31#
32# [*database_max_overflow*]
33# If set, use this value for max_overflow with sqlalchemy.
34# (Optional) Defaults to $::os_service_default.
35#
36class tuskar::db (
37 $database_connection = 'sqlite:////var/lib/tuskar/tuskar.sqlite',
38 $database_idle_timeout = $::os_service_default,
39 $database_min_pool_size = $::os_service_default,
40 $database_max_pool_size = $::os_service_default,
41 $database_max_retries = $::os_service_default,
42 $database_retry_interval = $::os_service_default,
43 $database_max_overflow = $::os_service_default,
44) {
45
46 include ::tuskar::params
47
48 # NOTE(spredzy): In order to keep backward compatibility we rely on the pick function
49 # to use tuskar::<myparam> if tuskar::db::<myparam> isn't specified.
50 $database_connection_real = pick($::tuskar::database_connection, $database_connection)
51 $database_idle_timeout_real = pick($::tuskar::database_idle_timeout, $database_idle_timeout)
52 $database_min_pool_size_real = pick($::tuskar::database_min_pool_size, $database_min_pool_size)
53 $database_max_pool_size_real = pick($::tuskar::database_max_pool_size, $database_max_pool_size)
54 $database_max_retries_real = pick($::tuskar::database_max_retries, $database_max_retries)
55 $database_retry_interval_real = pick($::tuskar::database_retry_interval, $database_retry_interval)
56 $database_max_overflow_real = pick($::tuskar::database_max_overflow, $database_max_overflow)
57
58 validate_re($database_connection_real,
59 '^(sqlite|mysql(\+pymysql)?|postgresql):\/\/(\S+:\S+@\S+\/\S+)?')
60
61 if $database_connection_real {
62 case $database_connection_real {
63 /^mysql(\+pymysql)?:\/\//: {
64 require 'mysql::bindings'
65 require 'mysql::bindings::python'
66 if $database_connection_real =~ /^mysql\+pymysql/ {
67 $backend_package = $::tuskar::params::pymysql_package_name
68 } else {
69 $backend_package = false
70 }
71 }
72 /^postgresql:\/\//: {
73 $backend_package = false
74 require 'postgresql::lib::python'
75 }
76 /^sqlite:\/\//: {
77 $backend_package = $::tuskar::params::sqlite_package_name
78 }
79 default: {
80 fail('Unsupported backend configured')
81 }
82 }
83
84 if $backend_package and !defined(Package[$backend_package]) {
85 package {'tuskar-backend-package':
86 ensure => present,
87 name => $backend_package,
88 tag => 'openstack',
89 }
90 }
91
92 tuskar_config {
93 'database/connection': value => $database_connection_real, secret => true;
94 'database/idle_timeout': value => $database_idle_timeout_real;
95 'database/min_pool_size': value => $database_min_pool_size_real;
96 'database/max_retries': value => $database_max_retries_real;
97 'database/retry_interval': value => $database_retry_interval_real;
98 'database/max_pool_size': value => $database_max_pool_size_real;
99 'database/max_overflow': value => $database_max_overflow_real;
100 }
101
102 }
103
104}
diff --git a/manifests/db/mysql.pp b/manifests/db/mysql.pp
deleted file mode 100644
index f13530a..0000000
--- a/manifests/db/mysql.pp
+++ /dev/null
@@ -1,83 +0,0 @@
1#
2# Copyright (C) 2014 eNovance SAS <licensing@enovance.com>
3#
4# Author: Emilien Macchi <emilien.macchi@enovance.com>
5#
6# Licensed under the Apache License, Version 2.0 (the "License"); you may
7# not use this file except in compliance with the License. You may obtain
8# a copy of the License at
9#
10# http://www.apache.org/licenses/LICENSE-2.0
11#
12# Unless required by applicable law or agreed to in writing, software
13# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
14# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
15# License for the specific language governing permissions and limitations
16# under the License.
17#
18# == Class: tuskar::db::mysql
19#
20# The tuskar::db::mysql class creates a MySQL database for tuskar.
21# It must be used on the MySQL server
22#
23# === Parameters
24#
25# [*password*]
26# (required) Password that will be used for the tuskar db user.
27#
28# [*dbname*]
29# (optional) Name of tuskar database.
30# Defaults to tuskar
31#
32# [*user*]
33# (optional) Name of tuskar user.
34# Defaults to tuskar
35#
36# [*host*]
37# (optional) Host where user should be allowed all privileges for database.
38# Defaults to 127.0.0.1
39#
40# [*allowed_hosts*]
41# (optional) Hosts allowed to use the database
42# Defaults to undef.
43#
44# [*charset*]
45# (optional) Charset of tuskar database
46# Defaults 'utf8'.
47#
48# [*collate*]
49# (optional) Charset collate of tuskar database
50# Defaults 'utf8_general_ci'.
51#
52# [*mysql_module*]
53# (optional) Deprecated. Does nothing
54#
55class tuskar::db::mysql(
56 $password,
57 $dbname = 'tuskar',
58 $user = 'tuskar',
59 $host = '127.0.0.1',
60 $allowed_hosts = undef,
61 $charset = 'utf8',
62 $collate = 'utf8_general_ci',
63 $mysql_module = undef,
64) {
65
66 if $mysql_module {
67 warning('The mysql_module parameter is deprecated. The latest 2.x mysql module will be used.')
68 }
69
70 validate_string($password)
71
72 ::openstacklib::db::mysql { 'tuskar':
73 user => $user,
74 password_hash => mysql_password($password),
75 dbname => $dbname,
76 host => $host,
77 charset => $charset,
78 collate => $collate,
79 allowed_hosts => $allowed_hosts,
80 }
81
82 ::Openstacklib::Db::Mysql['tuskar'] ~> Exec<| title == 'tuskar-dbsync' |>
83}
diff --git a/manifests/db/postgresql.pp b/manifests/db/postgresql.pp
deleted file mode 100644
index 48f6ece..0000000
--- a/manifests/db/postgresql.pp
+++ /dev/null
@@ -1,47 +0,0 @@
1# == Class: tuskar::db::postgresql
2#
3# Class that configures postgresql for tuskar
4# Requires the Puppetlabs postgresql module.
5#
6# === Parameters:
7#
8# [*password*]
9# (Required) Password to connect to the database.
10#
11# [*dbname*]
12# (Optional) Name of the database.
13# Defaults to 'tuskar'.
14#
15# [*user*]
16# (Optional) User to connect to the database.
17# Defaults to 'tuskar'.
18#
19# [*encoding*]
20# (Optional) The charset to use for the database.
21# Default to undef.
22#
23# [*privileges*]
24# (Optional) Privileges given to the database user.
25# Default to 'ALL'
26#
27class tuskar::db::postgresql(
28 $password,
29 $dbname = 'tuskar',
30 $user = 'tuskar',
31 $encoding = undef,
32 $privileges = 'ALL',
33) {
34
35 Class['tuskar::db::postgresql'] -> Service<| title == 'tuskar' |>
36
37 ::openstacklib::db::postgresql { 'tuskar':
38 password_hash => postgresql_password($user, $password),
39 dbname => $dbname,
40 user => $user,
41 encoding => $encoding,
42 privileges => $privileges,
43 }
44
45 ::Openstacklib::Db::Postgresql['tuskar'] ~> Exec<| title == 'tuskar-dbsync' |>
46
47}
diff --git a/manifests/db/sync.pp b/manifests/db/sync.pp
deleted file mode 100644
index 631d578..0000000
--- a/manifests/db/sync.pp
+++ /dev/null
@@ -1,27 +0,0 @@
1#
2# Copyright (C) 2014 eNovance SAS <licensing@enovance.com>
3#
4# Author: Emilien Macchi <emilien.macchi@enovance.com>
5#
6# Licensed under the Apache License, Version 2.0 (the "License"); you may
7# not use this file except in compliance with the License. You may obtain
8# a copy of the License at
9#
10# http://www.apache.org/licenses/LICENSE-2.0
11#
12# Unless required by applicable law or agreed to in writing, software
13# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
14# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
15# License for the specific language governing permissions and limitations
16# under the License.
17#
18# Class to execute "tuskar-dbsync"
19#
20class tuskar::db::sync {
21 exec { 'tuskar-dbsync':
22 path => '/usr/bin',
23 user => 'tuskar',
24 refreshonly => true,
25 subscribe => [Package['tuskar-api'], Tuskar_config['database/connection']],
26 }
27}
diff --git a/manifests/generic_service.pp b/manifests/generic_service.pp
deleted file mode 100644
index 5deb8bf..0000000
--- a/manifests/generic_service.pp
+++ /dev/null
@@ -1,93 +0,0 @@
1#
2# Copyright (C) 2014 eNovance SAS <licensing@enovance.com>
3#
4# Author: Emilien Macchi <emilien.macchi@enovance.com>
5#
6# Licensed under the Apache License, Version 2.0 (the "License"); you may
7# not use this file except in compliance with the License. You may obtain
8# a copy of the License at
9#
10# http://www.apache.org/licenses/LICENSE-2.0
11#
12# Unless required by applicable law or agreed to in writing, software
13# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
14# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
15# License for the specific language governing permissions and limitations
16# under the License.
17#
18# == Define: tuskar::generic_service
19#
20# This defined type implements basic tuskar services.
21# It is introduced to attempt to consolidate
22# common code.
23#
24# It also allows users to specify ad-hoc services
25# as needed
26#
27# This define creates a service resource with title tuskar-${name} and
28# conditionally creates a package resource with title tuskar-${name}
29#
30# === Parameters:
31#
32# [*package_name*]
33# (mandatory) The package name (for the generic_service)
34#
35# [*service_name*]
36# (mandatory) The service name (for the generic_service)
37#
38# [*enabled*]
39# (optional) Define if the service must be enabled or not
40# Defaults to false.
41#
42# [*manage_service*]
43# (optional) Manage or not the service (if a service_name is provided).
44# Defaults to true.
45#
46# [*package_ensure*]
47# (optional) Control the ensure parameter for the package ressource.
48# Defaults to 'present'.
49#
50define tuskar::generic_service(
51 $package_name,
52 $service_name,
53 $enabled = false,
54 $manage_service = true,
55 $package_ensure = 'present'
56) {
57
58 include ::tuskar::params
59 include ::tuskar::db::sync
60
61 $tuskar_title = "tuskar-${name}"
62 Exec['post-tuskar_config'] ~> Service<| title == $tuskar_title |>
63 Exec<| title == 'tuskar-dbsync' |> ~> Service<| title == $tuskar_title |>
64
65 if ($package_name) {
66 if !defined(Package[$package_name]) {
67 package { $tuskar_title:
68 ensure => $package_ensure,
69 name => $package_name,
70 notify => Service[$tuskar_title],
71 tag => ['openstack', 'tuskar-package'],
72 }
73 }
74 }
75
76 if $service_name {
77 if $manage_service {
78 if $enabled {
79 $service_ensure = 'running'
80 } else {
81 $service_ensure = 'stopped'
82 }
83 }
84
85 service { $tuskar_title:
86 ensure => $service_ensure,
87 name => $service_name,
88 enable => $enabled,
89 hasstatus => true,
90 tag => 'tuskar-service',
91 }
92 }
93}
diff --git a/manifests/init.pp b/manifests/init.pp
deleted file mode 100644
index b0d5f67..0000000
--- a/manifests/init.pp
+++ /dev/null
@@ -1,68 +0,0 @@
1#
2# Copyright (C) 2014 eNovance SAS <licensing@enovance.com>
3#
4# Author: Emilien Macchi <emilien.macchi@enovance.com>
5#
6# Licensed under the Apache License, Version 2.0 (the "License"); you may
7# not use this file except in compliance with the License. You may obtain
8# a copy of the License at
9#
10# http://www.apache.org/licenses/LICENSE-2.0
11#
12# Unless required by applicable law or agreed to in writing, software
13# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
14# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
15# License for the specific language governing permissions and limitations
16# under the License.
17
18# == Class: tuskar
19#
20# Tuskar base config
21#
22# == Parameters
23#
24# [*database_connection*]
25# (optional) Connection url for the heat database.
26# Defaults to undef.
27#
28# [*database_max_retries*]
29# (optional) Maximum database connection retries during startup.
30# Defaults to undef.
31#
32# [*database_idle_timeout*]
33# (optional) Timeout before idle database connections are reaped.
34# Defaults to undef.
35#
36# [*database_retry_interval*]
37# (optional) Interval between retries of opening a database connection.
38# Defaults to undef.
39#
40# [*database_min_pool_size*]
41# (optional) Minimum number of SQL connections to keep open in a pool.
42# Defaults to undef.
43#
44# [*database_max_pool_size*]
45# (optional) Maximum number of SQL connections to keep open in a pool.
46# Defaults to undef.
47#
48# [*database_max_overflow*]
49# (optional) If set, use this value for max_overflow with sqlalchemy.
50# Defaults to: undef.
51#
52class tuskar(
53 $database_connection = undef,
54 $database_max_retries = undef,
55 $database_idle_timeout = undef,
56 $database_retry_interval = undef,
57 $database_min_pool_size = undef,
58 $database_max_pool_size = undef,
59 $database_max_overflow = undef,
60) {
61 include ::tuskar::params
62
63 exec { 'post-tuskar_config':
64 command => '/bin/echo "Tuskar config has changed"',
65 refreshonly => true,
66 }
67
68}
diff --git a/manifests/keystone/auth.pp b/manifests/keystone/auth.pp
deleted file mode 100644
index b631cd9..0000000
--- a/manifests/keystone/auth.pp
+++ /dev/null
@@ -1,213 +0,0 @@
1#
2# Copyright (C) 2014 eNovance SAS <licensing@enovance.com>
3#
4# Author: Emilien Macchi <emilien.macchi@enovance.com>
5#
6# Licensed under the Apache License, Version 2.0 (the "License"); you may
7# not use this file except in compliance with the License. You may obtain
8# a copy of the License at
9#
10# http://www.apache.org/licenses/LICENSE-2.0
11#
12# Unless required by applicable law or agreed to in writing, software
13# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
14# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
15# License for the specific language governing permissions and limitations
16# under the License.
17#
18# tuskar::keystone::auth
19#
20# Configures Tuskar user, service and endpoint in Keystone.
21#
22# === Parameters
23#
24# [*password*]
25# (required) Password for Tuskar user.
26#
27# [*auth_name*]
28# Username for Tuskar service. Defaults to 'tuskar'.
29#
30# [*email*]
31# Email for Tuskar user. Defaults to 'tuskar@localhost'.
32#
33# [*tenant*]
34# Tenant for Tuskar user. Defaults to 'services'.
35#
36# [*configure_endpoint*]
37# Should Tuskar endpoint be configured? Defaults to 'true'.
38#
39# [*configure_user*]
40# (Optional) Should the service user be configured?
41# Defaults to 'true'.
42#
43# [*configure_user_role*]
44# (Optional) Should the admin role be configured for the service user?
45# Defaults to 'true'.
46#
47# [*service_name*]
48# (Optional) Name of the service.
49# Defaults to the value of auth_name, but must differ from the value.
50#
51# [*service_type*]
52# Type of service. Defaults to 'management'.
53#
54# [*service_description*]
55# Description for keystone service. Optional. Defaults to 'Tuskar Management Service'.
56#
57# [*public_protocol*]
58# (optional) DEPRECATED: Use public_url instead.
59# Protocol for public endpoint. Defaults to 'http'.
60#
61# [*public_address*]
62# (optional) DEPRECATED: Use public_url instead.
63# Public address for endpoint. Defaults to '127.0.0.1'.
64#
65# [*admin_protocol*]
66# (optional) DEPRECATED: Use admin_url instead.
67# Protocol for admin endpoint. Defaults to 'http'.
68#
69# [*admin_address*]
70# (optional) DEPRECATED: Use admin_url instead.
71# Admin address for endpoint. Defaults to '127.0.0.1'.
72#
73# [*internal_protocol*]
74# (optional) DEPRECATED: Use internal_url instead.
75# Protocol for internal endpoint. Defaults to 'http'.
76#
77# [*internal_address*]
78# (optional) DEPRECATED: Use internal_url instead.
79# Internal address for endpoint. Defaults to '127.0.0.1'.
80#
81# [*port*]
82# (optional) DEPRECATED: Use public_url, internal_url and admin_url instead.
83# Port for endpoint. Defaults to '8585'.
84#
85# [*public_port*]
86# (optional) DEPRECATED: Use public_url instead.
87# Port for public endpoint. Defaults to $port.
88#
89# [*region*]
90# Region for endpoint. Defaults to 'RegionOne'.
91#
92# [*public_url*]
93# (optional) The endpoint's public url. (Defaults to 'http://127.0.0.1:8585')
94# This url should *not* contain any trailing '/'.
95#
96# [*admin_url*]
97# (optional) The endpoint's admin url. (Defaults to 'http://127.0.0.1:8585')
98# This url should *not* contain any trailing '/'.
99#
100# [*internal_url*]
101# (optional) The endpoint's internal url. (Defaults to 'http://127.0.0.1:8585')
102# This url should *not* contain any trailing '/'.
103#
104class tuskar::keystone::auth (
105 $password,
106 $auth_name = 'tuskar',
107 $email = 'tuskar@localhost',
108 $tenant = 'services',
109 $configure_endpoint = true,
110 $configure_user = true,
111 $configure_user_role = true,
112 $service_name = undef,
113 $service_type = 'management',
114 $service_description = 'Tuskar Management Service',
115 $region = 'RegionOne',
116 $public_url = 'http://127.0.0.1:8585',
117 $admin_url = 'http://127.0.0.1:8585',
118 $internal_url = 'http://127.0.0.1:8585',
119 # DEPRECATED
120 $port = undef,
121 $public_protocol = undef,
122 $public_address = undef,
123 $admin_protocol = undef,
124 $admin_address = undef,
125 $internal_protocol = undef,
126 $internal_address = undef,
127 $public_port = undef,
128) {
129
130 if $port {
131 warning('The port parameter is deprecated, use public_url, internal_url and admin_url instead.')
132 }
133
134 if $public_port {
135 warning('The public_port parameter is deprecated, use public_url instead.')
136 }
137
138 if $public_protocol {
139 warning('The public_protocol parameter is deprecated, use public_url instead.')
140 }
141
142 if $public_address {
143 warning('The public_address parameter is deprecated, use public_url instead.')
144 }
145
146 if $internal_protocol {
147 warning('The internal_protocol parameter is deprecated, use internal_url instead.')
148 }
149
150 if $internal_address {
151 warning('The internal_address parameter is deprecated, use internal_url instead.')
152 }
153
154 if $admin_address {
155 warning('The admin_address parameter is deprecated, use admin_url instead.')
156 }
157
158 if $admin_protocol {
159 warning('The admin_protocol parameter is deprecated, use admin_url instead.')
160 }
161
162 if ($public_protocol or $public_address or $port or $public_port) {
163 $public_url_real = sprintf('%s://%s:%s',
164 pick($public_protocol, 'http'),
165 pick($public_address, '127.0.0.1'),
166 pick($public_port, $port, '8585'))
167 } else {
168 $public_url_real = $public_url
169 }
170
171 if ($admin_protocol or $admin_address or $port) {
172 $admin_url_real = sprintf('%s://%s:%s',
173 pick($admin_protocol, 'http'),
174 pick($admin_address, '127.0.0.1'),
175 pick($port, '8585'))
176 } else {
177 $admin_url_real = $admin_url
178 }
179
180 if ($internal_protocol or $internal_address or $port) {
181 $internal_url_real = sprintf('%s://%s:%s',
182 pick($internal_protocol, 'http'),
183 pick($internal_address, '127.0.0.1'),
184 pick($port, '8585'))
185 } else {
186 $internal_url_real = $internal_url
187 }
188
189 $real_service_name = pick($service_name, $auth_name)
190
191 if $configure_user_role {
192 Keystone_user_role["${auth_name}@${tenant}"] ~> Service <| name == 'tuskar-api' |>
193 }
194
195 Keystone_endpoint["${region}/${auth_name}::${service_type}"] ~> Service <| name == 'tuskar-api' |>
196
197 keystone::resource::service_identity { $auth_name:
198 configure_user => $configure_user,
199 configure_user_role => $configure_user_role,
200 configure_endpoint => $configure_endpoint,
201 service_name => $real_service_name,
202 service_type => $service_type,
203 service_description => $service_description,
204 region => $region,
205 password => $password,
206 email => $email,
207 tenant => $tenant,
208 public_url => $public_url_real,
209 internal_url => $internal_url_real,
210 admin_url => $admin_url_real,
211 }
212
213}
diff --git a/manifests/logging.pp b/manifests/logging.pp
deleted file mode 100644
index a860414..0000000
--- a/manifests/logging.pp
+++ /dev/null
@@ -1,155 +0,0 @@
1# Class tuskar::logging
2#
3# tuskar logging configuration
4#
5# == parameters
6#
7# [*verbose*]
8# (Optional) Should the daemons log verbose messages
9# Defaults to $::os_service_default.
10#
11# [*debug*]
12# (Optional) Should the daemons log debug messages
13# Defaults to $::os_service_default.
14#
15# [*use_syslog*]
16# (Optional) Use syslog for logging.
17# Defaults to $::os_service_default.
18#
19# [*use_stderr*]
20# (optional) Use stderr for logging
21# Defaults to $::os_service_default.
22#
23# [*log_facility*]
24# (Optional) Syslog facility to receive log lines.
25# Defaults to $::os_service_default.
26#
27# [*log_dir*]
28# (optional) Directory where logs should be stored.
29# If set to boolean false, it will not log to any directory.
30# Defaults to '/var/log/tuskar'
31#
32# [*log_file*]
33# (optional) The path of file used for logging
34# If set to boolean false, it will not log to any file.
35# Default to '/var/log/tuskar/tuskar-api.log'
36#
37# [*logging_context_format_string*]
38# (optional) Format string to use for log messages with context.
39# Defaults to $::os_service_default.
40# Example: '%(asctime)s.%(msecs)03d %(process)d %(levelname)s %(name)s\
41# [%(request_id)s %(user_identity)s] %(instance)s%(message)s'
42#
43# [*logging_default_format_string*]
44# (optional) Format string to use for log messages without context.
45# Defaults to $::os_service_default.
46# Example: '%(asctime)s.%(msecs)03d %(process)d %(levelname)s %(name)s\
47# [-] %(instance)s%(message)s'
48#
49# [*logging_debug_format_suffix*]
50# (optional) Formatted data to append to log format when level is DEBUG.
51# Defaults to $::os_service_default.
52# Example: '%(funcName)s %(pathname)s:%(lineno)d'
53#
54# [*logging_exception_prefix*]
55# (optional) Prefix each line of exception output with this format.
56# Defaults to $::os_service_default.
57# Example: '%(asctime)s.%(msecs)03d %(process)d TRACE %(name)s %(instance)s'
58#
59# [*log_config_append*]
60# The name of an additional logging configuration file.
61# Defaults to $::os_service_default.
62# See https://docs.python.org/2/howto/logging.html
63#
64# [*default_log_levels*]
65# (optional) Hash of logger (keys) and level (values) pairs.
66# Defaults to $::os_service_default.
67# Example:
68# { 'amqp' => 'WARN', 'amqplib' => 'WARN', 'boto' => 'WARN',
69# 'qpid' => 'WARN', 'sqlalchemy' => 'WARN', 'suds' => 'INFO',
70# 'iso8601' => 'WARN',
71# 'requests.packages.urllib3.connectionpool' => 'WARN' }
72#
73# [*publish_errors*]
74# (optional) Publish error events (boolean value).
75# Defaults to $::os_service_default (false if unconfigured).
76#
77# [*fatal_deprecations*]
78# (optional) Make deprecations fatal (boolean value)
79# Defaults to $::os_service_default (false if unconfigured).
80#
81# [*instance_format*]
82# (optional) If an instance is passed with the log message, format it
83# like this (string value).
84# Defaults to $::os_service_default.
85# Example: '[instance: %(uuid)s] '
86#
87# [*instance_uuid_format*]
88# (optional) If an instance UUID is passed with the log message, format
89# it like this (string value).
90# Defaults to $::os_service_default.
91# Example: instance_uuid_format='[instance: %(uuid)s] '
92
93# [*log_date_format*]
94# (optional) Format string for %%(asctime)s in log records.
95# Defaults to $::os_service_default,.
96# Example: 'Y-%m-%d %H:%M:%S'
97
98class tuskar::logging(
99 $use_syslog = $::os_service_default,
100 $use_stderr = $::os_service_default,
101 $log_facility = $::os_service_default,
102 $log_dir = '/var/log/tuskar',
103 $log_file = '/var/log/tuskar/tuskar-api.log',
104 $verbose = $::os_service_default,
105 $debug = $::os_service_default,
106 $logging_context_format_string = $::os_service_default,
107 $logging_default_format_string = $::os_service_default,
108 $logging_debug_format_suffix = $::os_service_default,
109 $logging_exception_prefix = $::os_service_default,
110 $log_config_append = $::os_service_default,
111 $default_log_levels = $::os_service_default,
112 $publish_errors = $::os_service_default,
113 $fatal_deprecations = $::os_service_default,
114 $instance_format = $::os_service_default,
115 $instance_uuid_format = $::os_service_default,
116 $log_date_format = $::os_service_default,
117) {
118
119 # NOTE(spredzy): In order to keep backward compatibility we rely on the pick function
120 # to use tuskar::<myparam> first then tuskar::logging::<myparam>.
121 $use_syslog_real = pick($::tuskar::api::use_syslog,$use_syslog)
122 $use_stderr_real = pick($::tuskar::api::use_stderr,$use_stderr)
123 $log_facility_real = pick($::tuskar::api::log_facility,$log_facility)
124 $log_dir_real = pick($::tuskar::api::log_dir,$log_dir)
125 $log_file_real = pick($::tuskar::api::log_file,$log_file)
126 $verbose_real = pick($::tuskar::api::verbose,$verbose)
127 $debug_real = pick($::tuskar::api::debug,$debug)
128
129 if is_service_default($default_log_levels) {
130 $default_log_levels_real = $default_log_levels
131 } else {
132 $default_log_levels_real = join(sort(join_keys_to_values($default_log_levels, '=')), ',')
133 }
134
135 tuskar_config {
136 'DEFAULT/debug': value => $debug_real;
137 'DEFAULT/verbose': value => $verbose_real;
138 'DEFAULT/use_stderr': value => $use_stderr_real;
139 'DEFAULT/use_syslog': value => $use_syslog_real;
140 'DEFAULT/log_dir': value => $log_dir_real;
141 'DEFAULT/log_file': value => $log_file_real;
142 'DEFAULT/syslog_log_facility': value => $log_facility_real;
143 'DEFAULT/logging_context_format_string': value => $logging_context_format_string;
144 'DEFAULT/logging_default_format_string': value => $logging_default_format_string;
145 'DEFAULT/logging_debug_format_suffix': value => $logging_debug_format_suffix;
146 'DEFAULT/logging_exception_prefix': value => $logging_exception_prefix;
147 'DEFAULT/log_config_append': value => $log_config_append;
148 'DEFAULT/default_log_levels': value => $default_log_levels_real;
149 'DEFAULT/publish_errors': value => $publish_errors;
150 'DEFAULT/fatal_deprecations': value => $fatal_deprecations;
151 'DEFAULT/instance_format': value => $instance_format;
152 'DEFAULT/instance_uuid_format': value => $instance_uuid_format;
153 'DEFAULT/log_date_format': value => $log_date_format;
154 }
155}
diff --git a/manifests/params.pp b/manifests/params.pp
deleted file mode 100644
index 3095bc8..0000000
--- a/manifests/params.pp
+++ /dev/null
@@ -1,29 +0,0 @@
1# Parameters for puppet-tuskar
2#
3class tuskar::params {
4
5 case $::osfamily {
6 'RedHat': {
7 $client_package_name = 'python-tuskarclient'
8 $api_package_name = 'openstack-tuskar'
9 $api_service_name = 'openstack-tuskar-api'
10 $ui_package_name = 'openstack-tuskar-ui'
11 $ui_extras_package_name = 'openstack-tuskar-ui-extras'
12 $sqlite_package_name = undef
13 $pymysql_package_name = undef
14 }
15 'Debian': {
16 $client_package_name = 'python-tuskarclient'
17 $api_package_name = 'tuskar-api'
18 $api_service_name = 'tuskar-api'
19 $ui_package_name = 'tuskar-ui'
20 $ui_extras_package_name = 'tuskar-ui-extras'
21 $sqlite_package_name = 'python-pysqlite2'
22 $pymysql_package_name = 'python-pymysql'
23 }
24 default: {
25 fail("Unsupported osfamily: ${::osfamily} operatingsystem")
26 }
27
28 } # Case $::osfamily
29}
diff --git a/manifests/ui.pp b/manifests/ui.pp
deleted file mode 100644
index aa4498a..0000000
--- a/manifests/ui.pp
+++ /dev/null
@@ -1,53 +0,0 @@
1#
2# Copyright (C) 2015 eNovance SAS <licensing@enovance.com>
3#
4# Author: Emilien Macchi <emilien.macchi@enovance.com>
5#
6# Licensed under the Apache License, Version 2.0 (the "License"); you may
7# not use this file except in compliance with the License. You may obtain
8# a copy of the License at
9#
10# http://www.apache.org/licenses/LICENSE-2.0
11#
12# Unless required by applicable law or agreed to in writing, software
13# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
14# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
15# License for the specific language governing permissions and limitations
16# under the License.
17#
18# tuskar::ui
19#
20# Install UI (and UI extras)
21#
22# === Parameters:
23#
24# [*package_ensure*]
25# (optional) The state of the package
26# Defaults to present
27#
28# [*extras*]
29# (optional) Also install UI extras
30# Defaults to false
31#
32class tuskar::ui (
33 $package_ensure = 'present',
34 $extras = false,
35) {
36
37 include ::tuskar::params
38
39 package { 'tuskar-ui':
40 ensure => $package_ensure,
41 name => $::tuskar::params::ui_package_name,
42 tag => ['openstack', 'tuskar-package'],
43 }
44
45 if $extras {
46 package { 'tuskar-ui-extras':
47 ensure => $package_ensure,
48 name => $::tuskar::params::ui_extras_package_name,
49 tag => ['openstack', 'tuskar-package'],
50 }
51 }
52
53}
diff --git a/metadata.json b/metadata.json
deleted file mode 100644
index 940eb89..0000000
--- a/metadata.json
+++ /dev/null
@@ -1,39 +0,0 @@
1{
2 "name": "openstack-tuskar",
3 "version": "7.0.0",
4 "author": "eNovance and OpenStack Contributors",
5 "summary": "Puppet module for OpenStack Tuskar",
6 "license": "Apache-2.0",
7 "source": "git://github.com/openstack/puppet-tuskar.git",
8 "project_page": "https://launchpad.net/puppet-tuskar",
9 "issues_url": "https://bugs.launchpad.net/puppet-tuskar",
10 "requirements": [
11 { "name": "pe","version_requirement": "3.x" },
12 { "name": "puppet","version_requirement": "3.x" }
13 ],
14 "operatingsystem_support": [
15 {
16 "operatingsystem": "Debian",
17 "operatingsystemrelease": ["8"]
18 },
19 {
20 "operatingsystem": "Fedora",
21 "operatingsystemrelease": ["20"]
22 },
23 {
24 "operatingsystem": "RedHat",
25 "operatingsystemrelease": ["6.5","7"]
26 },
27 {
28 "operatingsystem": "Ubuntu",
29 "operatingsystemrelease": ["14.04"]
30 }
31 ],
32 "description": "Installs and configures OpenStack Tuskar (Management service).",
33 "dependencies": [
34 { "name": "puppetlabs/inifile", "version_requirement": ">=1.0.0 <2.0.0" },
35 { "name": "openstack/keystone", "version_requirement": ">=7.0.0 <8.0.0" },
36 { "name": "puppetlabs/stdlib", "version_requirement": ">=4.0.0 <5.0.0" },
37 { "name": "openstack/openstacklib", "version_requirement": ">=7.0.0 <8.0.0" }
38 ]
39}
diff --git a/spec/acceptance/nodesets/centos-70-x64.yml b/spec/acceptance/nodesets/centos-70-x64.yml
deleted file mode 100644
index 5f097e9..0000000
--- a/spec/acceptance/nodesets/centos-70-x64.yml
+++ /dev/null
@@ -1,11 +0,0 @@
1HOSTS:
2 centos-server-70-x64:
3 roles:
4 - master
5 platform: el-7-x86_64
6 box: puppetlabs/centos-7.0-64-nocm
7 box_url: https://vagrantcloud.com/puppetlabs/centos-7.0-64-nocm
8 hypervisor: vagrant
9CONFIG:
10 log_level: debug
11 type: foss
diff --git a/spec/acceptance/nodesets/default.yml b/spec/acceptance/nodesets/default.yml
deleted file mode 100644
index 486b6a3..0000000
--- a/spec/acceptance/nodesets/default.yml
+++ /dev/null
@@ -1,10 +0,0 @@
1HOSTS:
2 ubuntu-server-14.04-amd64:
3 roles:
4 - master
5 platform: ubuntu-14.04-amd64
6 box: puppetlabs/ubuntu-14.04-64-nocm
7 box_url: https://vagrantcloud.com/puppetlabs/ubuntu-14.04-64-nocm
8 hypervisor: vagrant
9CONFIG:
10 type: foss
diff --git a/spec/acceptance/nodesets/nodepool-centos7.yml b/spec/acceptance/nodesets/nodepool-centos7.yml
deleted file mode 100644
index c552874..0000000
--- a/spec/acceptance/nodesets/nodepool-centos7.yml
+++ /dev/null
@@ -1,10 +0,0 @@
1HOSTS:
2 centos-70-x64:
3 roles:
4 - master
5 platform: el-7-x86_64
6 hypervisor: none
7 ip: 127.0.0.1
8CONFIG:
9 type: foss
10 set_env: false
diff --git a/spec/acceptance/nodesets/nodepool-trusty.yml b/spec/acceptance/nodesets/nodepool-trusty.yml
deleted file mode 100644
index 9fc624e..0000000
--- a/spec/acceptance/nodesets/nodepool-trusty.yml
+++ /dev/null
@@ -1,10 +0,0 @@
1HOSTS:
2 ubuntu-14.04-amd64:
3 roles:
4 - master
5 platform: ubuntu-14.04-amd64
6 hypervisor: none
7 ip: 127.0.0.1
8CONFIG:
9 type: foss
10 set_env: false
diff --git a/spec/acceptance/nodesets/ubuntu-server-1404-x64.yml b/spec/acceptance/nodesets/ubuntu-server-1404-x64.yml
deleted file mode 100644
index 8001929..0000000
--- a/spec/acceptance/nodesets/ubuntu-server-1404-x64.yml
+++ /dev/null
@@ -1,11 +0,0 @@
1HOSTS:
2 ubuntu-server-14.04-amd64:
3 roles:
4 - master
5 platform: ubuntu-14.04-amd64
6 box: puppetlabs/ubuntu-14.04-64-nocm
7 box_url: https://vagrantcloud.com/puppetlabs/ubuntu-14.04-64-nocm
8 hypervisor: vagrant
9CONFIG:
10 log_level: debug
11 type: foss
diff --git a/spec/classes/tuskar_api_spec.rb b/spec/classes/tuskar_api_spec.rb
deleted file mode 100644
index 4ff90f1..0000000
--- a/spec/classes/tuskar_api_spec.rb
+++ /dev/null
@@ -1,91 +0,0 @@
1#
2# Unit tests for tuskar::api
3#
4require 'spec_helper'
5
6describe 'tuskar::api' do
7
8 let :params do
9 { :keystone_password => 'passw0rd',
10 :keystone_user => 'tuskar',
11 :identity_uri => 'https://identity.os.net:5000',
12 :keystone_tenant => '_services_',
13 }
14 end
15
16 shared_examples 'tuskar-api' do
17
18 context 'with default parameters' do
19
20 it 'contains the logging class' do
21 is_expected.to contain_class('tuskar::logging')
22 end
23
24 it 'installs tuskar-api package and service' do
25 is_expected.to contain_service('tuskar-api').with(
26 :name => platform_params[:api_service_name],
27 :ensure => 'running',
28 :hasstatus => true,
29 :enable => true
30 )
31 is_expected.to contain_package('tuskar-api').with(
32 :name => platform_params[:api_package_name],
33 :ensure => 'present',
34 :notify => 'Service[tuskar-api]'
35 )
36 end
37
38 it 'configures tuskar-api with default parameters' do
39 is_expected.to contain_tuskar_config('DEFAULT/tuskar_api_bind_ip').with_value('<SERVICE DEFAULT>')
40 is_expected.to contain_tuskar_config('DEFAULT/tuskar_api_port').with_value('<SERVICE DEFAULT>')
41 is_expected.to contain_tuskar_config('keystone_authtoken/identity_uri').with_value(params[:identity_uri])
42 is_expected.to contain_tuskar_config('keystone_authtoken/admin_tenant_name').with_value(params[:keystone_tenant])
43 is_expected.to contain_tuskar_config('keystone_authtoken/admin_user').with_value(params[:keystone_user])
44 is_expected.to contain_tuskar_config('keystone_authtoken/admin_password').with_value(params[:keystone_password])
45 is_expected.to contain_tuskar_config('keystone_authtoken/admin_password').with_value(params[:keystone_password]).with_secret(true)
46 end
47
48 context 'when using MySQL' do
49 let :pre_condition do
50 "class { 'tuskar':
51 database_connection => 'mysql://tuskar:pass@10.0.0.1/tuskar'}"
52 end
53 it 'configures tuskar-api with RabbitMQ' do
54 is_expected.to contain_tuskar_config('database/connection').with_value('mysql://tuskar:pass@10.0.0.1/tuskar')
55 is_expected.to contain_tuskar_config('database/connection').with_value('mysql://tuskar:pass@10.0.0.1/tuskar').with_secret(true)
56 end
57 end
58 end
59 end
60
61 context 'on Debian platforms' do
62 let :facts do
63 @default_facts.merge({
64 :osfamily => 'Debian'
65 })
66 end
67
68 let :platform_params do
69 { :api_package_name => 'tuskar-api',
70 :api_service_name => 'tuskar-api' }
71 end
72
73 it_configures 'tuskar-api'
74 end
75
76 context 'on RedHat platforms' do
77 let :facts do
78 @default_facts.merge({
79 :osfamily => 'RedHat'
80 })
81 end
82
83 let :platform_params do
84 { :api_package_name => 'openstack-tuskar',
85 :api_service_name => 'openstack-tuskar-api' }
86 end
87
88 it_configures 'tuskar-api'
89 end
90
91end
diff --git a/spec/classes/tuskar_client_spec.rb b/spec/classes/tuskar_client_spec.rb
deleted file mode 100644
index ea2a8c3..0000000
--- a/spec/classes/tuskar_client_spec.rb
+++ /dev/null
@@ -1,38 +0,0 @@
1#
2# Unit tests for tuskar::client
3#
4require 'spec_helper'
5
6describe 'tuskar::client' do
7
8 shared_examples_for 'tuskar client' do
9
10 context 'with default parameters' do
11 it { is_expected.to contain_package('python-tuskarclient').with_ensure('present') }
12 end
13
14 context 'with package_ensure parameter provided' do
15 let :params do
16 { :package_ensure => false }
17 end
18 it { is_expected.to contain_package('python-tuskarclient').with_ensure('false') }
19 end
20
21 end
22
23 context 'on Debian platforms' do
24 let :facts do
25 { :osfamily => 'Debian' }
26 end
27
28 it_configures 'tuskar client'
29 end
30
31 context 'on RedHat platforms' do
32 let :facts do
33 { :osfamily => 'RedHat' }
34 end
35
36 it_configures 'tuskar client'
37 end
38end
diff --git a/spec/classes/tuskar_config_spec.rb b/spec/classes/tuskar_config_spec.rb
deleted file mode 100644
index 3c20848..0000000
--- a/spec/classes/tuskar_config_spec.rb
+++ /dev/null
@@ -1,20 +0,0 @@
1require 'spec_helper'
2
3describe 'tuskar::config' do
4
5 let :params do
6 { :tuskar_config => {
7 'DEFAULT/foo' => { 'value' => 'fooValue' },
8 'DEFAULT/bar' => { 'value' => 'barValue' },
9 'DEFAULT/baz' => { 'ensure' => 'absent' }
10 }
11 }
12 end
13
14 it 'configures arbitrary tuskar configurations' do
15 is_expected.to contain_tuskar_config('DEFAULT/foo').with_value('fooValue')
16 is_expected.to contain_tuskar_config('DEFAULT/bar').with_value('barValue')
17 is_expected.to contain_tuskar_config('DEFAULT/baz').with_ensure('absent')
18 end
19
20end
diff --git a/spec/classes/tuskar_db_mysql_spec.rb b/spec/classes/tuskar_db_mysql_spec.rb
deleted file mode 100644
index b9600ae..0000000
--- a/spec/classes/tuskar_db_mysql_spec.rb
+++ /dev/null
@@ -1,95 +0,0 @@
1#
2# Unit tests for tuskar::db::mysql
3#
4require 'spec_helper'
5
6describe 'tuskar::db::mysql' do
7
8 let :pre_condition do
9 [
10 'include mysql::server',
11 'include tuskar::db::sync'
12 ]
13 end
14
15 let :params do
16 { :dbname => 'tuskar',
17 :password => 's3cr3t',
18 :user => 'tuskar',
19 :charset => 'utf8',
20 :collate => 'utf8_general_ci',
21 :host => '127.0.0.1',
22 }
23 end
24
25 shared_examples_for 'tuskar mysql database' do
26
27 context 'when omiting the required parameter password' do
28 before { params.delete(:password) }
29 it { expect { is_expected.to raise_error(Puppet::Error) } }
30 end
31
32 it 'creates a mysql database' do
33 is_expected.to contain_openstacklib__db__mysql('tuskar').with(
34 :user => params[:user],
35 :dbname => params[:dbname],
36 :password_hash => '*58C036CDA51D8E8BBBBF2F9EA5ABF111ADA444F0',
37 :host => params[:host],
38 :charset => params[:charset]
39 )
40 end
41
42 context 'overriding allowed_hosts param to array' do
43 before :each do
44 params.merge!(
45 :allowed_hosts => ['127.0.0.1','%']
46 )
47 end
48
49 it {
50 is_expected.to contain_openstacklib__db__mysql('tuskar').with(
51 :user => params[:user],
52 :dbname => params[:dbname],
53 :password_hash => '*58C036CDA51D8E8BBBBF2F9EA5ABF111ADA444F0',
54 :host => params[:host],
55 :charset => params[:charset],
56 :allowed_hosts => ['127.0.0.1','%']
57 )}
58 end
59
60 context 'overriding allowed_hosts param to string' do
61 before :each do
62 params.merge!(
63 :allowed_hosts => '192.168.1.1'
64 )
65 end
66
67 it {
68 is_expected.to contain_openstacklib__db__mysql('tuskar').with(
69 :user => params[:user],
70 :dbname => params[:dbname],
71 :password_hash => '*58C036CDA51D8E8BBBBF2F9EA5ABF111ADA444F0',
72 :host => params[:host],
73 :charset => params[:charset],
74 :allowed_hosts => '192.168.1.1'
75 )}
76 end
77
78 end
79
80 context 'on Debian platforms' do
81 let :facts do
82 { :osfamily => 'Debian' }
83 end
84
85 it_configures 'tuskar mysql database'
86 end
87
88 context 'on RedHat platforms' do
89 let :facts do
90 { :osfamily => 'RedHat' }
91 end
92
93 it_configures 'tuskar mysql database'
94 end
95end
diff --git a/spec/classes/tuskar_db_postgresql_spec.rb b/spec/classes/tuskar_db_postgresql_spec.rb
deleted file mode 100644
index 0e87420..0000000
--- a/spec/classes/tuskar_db_postgresql_spec.rb
+++ /dev/null
@@ -1,58 +0,0 @@
1require 'spec_helper'
2
3describe 'tuskar::db::postgresql' do
4
5 let :req_params do
6 { :password => 'pw' }
7 end
8
9 let :pre_condition do
10 'include postgresql::server'
11 end
12
13 context 'on a RedHat osfamily' do
14 let :facts do
15 {
16 :osfamily => 'RedHat',
17 :operatingsystemrelease => '7.0',
18 :concat_basedir => '/var/lib/puppet/concat'
19 }
20 end
21
22 context 'with only required parameters' do
23 let :params do
24 req_params
25 end
26
27 it { is_expected.to contain_postgresql__server__db('tuskar').with(
28 :user => 'tuskar',
29 :password => 'md532cc9d9d42efb508bc9d6267d873d63d'
30 )}
31 end
32
33 end
34
35 context 'on a Debian osfamily' do
36 let :facts do
37 {
38 :operatingsystemrelease => '7.8',
39 :operatingsystem => 'Debian',
40 :osfamily => 'Debian',
41 :concat_basedir => '/var/lib/puppet/concat'
42 }
43 end
44
45 context 'with only required parameters' do
46 let :params do
47 req_params
48 end
49
50 it { is_expected.to contain_postgresql__server__db('tuskar').with(
51 :user => 'tuskar',
52 :password => 'md532cc9d9d42efb508bc9d6267d873d63d'
53 )}
54 end
55
56 end
57
58end
diff --git a/spec/classes/tuskar_db_spec.rb b/spec/classes/tuskar_db_spec.rb
deleted file mode 100644
index ba1a7dc..0000000
--- a/spec/classes/tuskar_db_spec.rb
+++ /dev/null
@@ -1,128 +0,0 @@
1require 'spec_helper'
2
3describe 'tuskar::db' do
4
5 shared_examples 'tuskar::db' do
6
7 context 'with default parameters' do
8
9 it { is_expected.to contain_tuskar_config('database/connection').with_value('sqlite:////var/lib/tuskar/tuskar.sqlite').with_secret(true) }
10 it { is_expected.to contain_tuskar_config('database/idle_timeout').with_value('<SERVICE DEFAULT>') }
11 it { is_expected.to contain_tuskar_config('database/min_pool_size').with_value('<SERVICE DEFAULT>') }
12 it { is_expected.to contain_tuskar_config('database/max_retries').with_value('<SERVICE DEFAULT>') }
13 it { is_expected.to contain_tuskar_config('database/retry_interval').with_value('<SERVICE DEFAULT>') }
14
15 end
16
17 context 'with specific parameters' do
18 let :params do
19 { :database_connection => 'mysql+pymysql://tuskar:tuskar@localhost/tuskar',
20 :database_idle_timeout => '3601',
21 :database_min_pool_size => '2',
22 :database_max_retries => '11',
23 :database_retry_interval => '11', }
24 end
25
26 it { is_expected.to contain_tuskar_config('database/connection').with_value('mysql+pymysql://tuskar:tuskar@localhost/tuskar').with_secret(true) }
27 it { is_expected.to contain_tuskar_config('database/idle_timeout').with_value('3601') }
28 it { is_expected.to contain_tuskar_config('database/min_pool_size').with_value('2') }
29 it { is_expected.to contain_tuskar_config('database/max_retries').with_value('11') }
30 it { is_expected.to contain_tuskar_config('database/retry_interval').with_value('11') }
31 end
32
33 context 'with MySQL-python library as backend package' do
34 let :params do
35 { :database_connection => 'mysql://tuskar:tuskar@localhost/tuskar', }
36 end
37
38 it { is_expected.to contain_package('python-mysqldb').with(:ensure => 'present') }
39 end
40
41 context 'with postgresql backend' do
42 let :params do
43 { :database_connection => 'postgresql://tuskar:tuskar@localhost/tuskar', }
44 end
45
46 it 'install the proper backend package' do
47 is_expected.to contain_package('python-psycopg2').with(:ensure => 'present')
48 end
49
50 end
51
52 context 'with incorrect database_connection string' do
53 let :params do
54 { :database_connection => 'redis://tuskar:tuskar@localhost/tuskar', }
55 end
56
57 it_raises 'a Puppet::Error', /validate_re/
58 end
59
60 context 'with incorrect pymysql database_connection string' do
61 let :params do
62 { :database_connection => 'foo+pymysql://tuskar:tuskar@localhost/tuskar', }
63 end
64
65 it_raises 'a Puppet::Error', /validate_re/
66 end
67
68 end
69
70 context 'on Debian platforms' do
71 let :facts do
72 @default_facts.merge({ :osfamily => 'Debian',
73 :operatingsystem => 'Debian',
74 :operatingsystemrelease => 'jessie',
75 })
76 end
77
78 it_configures 'tuskar::db'
79
80 context 'using pymysql driver' do
81 let :params do
82 { :database_connection => 'mysql+pymysql://tuskar:tuskar@localhost/tuskar', }
83 end
84
85 it 'install the proper backend package' do
86 is_expected.to contain_package('tuskar-backend-package').with(
87 :ensure => 'present',
88 :name => 'python-pymysql',
89 :tag => 'openstack'
90 )
91 end
92 end
93
94 context 'with sqlite backend' do
95 let :params do
96 { :database_connection => 'sqlite:///var/lib/tuskar/tuskar.sqlite', }
97 end
98
99 it 'install the proper backend package' do
100 is_expected.to contain_package('tuskar-backend-package').with(
101 :ensure => 'present',
102 :name => 'python-pysqlite2',
103 :tag => 'openstack'
104 )
105 end
106
107 end
108 end
109
110 context 'on Redhat platforms' do
111 let :facts do
112 @default_facts.merge({ :osfamily => 'RedHat',
113 :operatingsystemrelease => '7.1',
114 })
115 end
116
117 it_configures 'tuskar::db'
118
119 context 'using pymysql driver' do
120 let :params do
121 { :database_connection => 'mysql+pymysql://tuskar:tuskar@localhost/tuskar', }
122 end
123
124 it { is_expected.not_to contain_package('tuskar-backend-package') }
125 end
126 end
127
128end
diff --git a/spec/classes/tuskar_init_spec.rb b/spec/classes/tuskar_init_spec.rb
deleted file mode 100644
index 46f2d83..0000000
--- a/spec/classes/tuskar_init_spec.rb
+++ /dev/null
@@ -1,30 +0,0 @@
1#
2# Unit tests for tuskar::init
3#
4require 'spec_helper'
5
6describe 'tuskar' do
7
8 shared_examples_for 'tuskar' do
9 it {
10 is_expected.to contain_class('tuskar::params')
11 is_expected.to contain_exec('post-tuskar_config')
12 }
13 end
14
15 context 'on Debian platforms' do
16 let :facts do
17 { :osfamily => 'Debian' }
18 end
19
20 it_configures 'tuskar'
21 end
22
23 context 'on RedHat platforms' do
24 let :facts do
25 { :osfamily => 'RedHat' }
26 end
27
28 it_configures 'tuskar'
29 end
30end
diff --git a/spec/classes/tuskar_keystone_auth_spec.rb b/spec/classes/tuskar_keystone_auth_spec.rb
deleted file mode 100644
index 319d546..0000000
--- a/spec/classes/tuskar_keystone_auth_spec.rb
+++ /dev/null
@@ -1,114 +0,0 @@
1#
2# Unit tests for tuskar::keystone::auth
3#
4require 'spec_helper'
5
6describe 'tuskar::keystone::auth' do
7
8 let :facts do
9 { :osfamily => 'Debian' }
10 end
11
12 describe 'with default class parameters' do
13 let :params do
14 { :password => 'tuskar_password',
15 :tenant => 'foobar' }
16 end
17
18 it { is_expected.to contain_keystone_user('tuskar').with(
19 :ensure => 'present',
20 :password => 'tuskar_password',
21 ) }
22
23 it { is_expected.to contain_keystone_user_role('tuskar@foobar').with(
24 :ensure => 'present',
25 :roles => ['admin']
26 )}
27
28 it { is_expected.to contain_keystone_service('tuskar::management').with(
29 :ensure => 'present',
30 :description => 'Tuskar Management Service'
31 ) }
32
33 it { is_expected.to contain_keystone_endpoint('RegionOne/tuskar::management').with(
34 :ensure => 'present',
35 :public_url => "http://127.0.0.1:8585",
36 :admin_url => "http://127.0.0.1:8585",
37 :internal_url => "http://127.0.0.1:8585"
38 ) }
39 end
40
41 describe 'with endpoint parameters' do
42 let :params do
43 { :password => 'tuskar_password',
44 :public_url => 'https://10.0.0.10:8585',
45 :admin_url => 'https://10.0.0.11:8585',
46 :internal_url => 'https://10.0.0.11:8585' }
47 end
48
49 it { is_expected.to contain_keystone_endpoint('RegionOne/tuskar::management').with(
50 :ensure => 'present',
51 :public_url => 'https://10.0.0.10:8585',
52 :admin_url => 'https://10.0.0.11:8585',
53 :internal_url => 'https://10.0.0.11:8585'
54 ) }
55 end
56
57 describe 'when configuring tuskar-server' do
58 let :pre_condition do
59 "class { 'tuskar::server': auth_password => 'test' }"
60 end
61
62 let :params do
63 { :password => 'tuskar_password',
64 :tenant => 'foobar' }
65 end
66 end
67
68 describe 'when overriding public_protocol, public_port and public address' do
69 let :params do
70 { :password => 'tuskar_password',
71 :public_protocol => 'https',
72 :public_port => '80',
73 :public_address => '10.10.10.10',
74 :port => '81',
75 :internal_address => '10.10.10.11',
76 :admin_address => '10.10.10.12' }
77 end
78
79 it { is_expected.to contain_keystone_endpoint('RegionOne/tuskar::management').with(
80 :ensure => 'present',
81 :public_url => "https://10.10.10.10:80",
82 :internal_url => "http://10.10.10.11:81",
83 :admin_url => "http://10.10.10.12:81"
84 ) }
85 end
86
87 describe 'when overriding auth name' do
88 let :params do
89 { :password => 'foo',
90 :auth_name => 'tuskary' }
91 end
92
93 it { is_expected.to contain_keystone_user('tuskary') }
94 it { is_expected.to contain_keystone_user_role('tuskary@services') }
95 it { is_expected.to contain_keystone_service('tuskary::management') }
96 it { is_expected.to contain_keystone_endpoint('RegionOne/tuskary::management') }
97 end
98
99 describe 'when overriding various parameters' do
100 let :params do
101 { :password => 'foo',
102 :service_name => 'mytuskar',
103 :configure_user => false,
104 :configure_user_role => false }
105 end
106
107 it { is_expected.to contain_keystone__resource__service_identity('tuskar').with(
108 :service_name => 'mytuskar',
109 :configure_user => false,
110 :configure_user_role => false,
111 ) }
112 end
113
114end
diff --git a/spec/classes/tuskar_logging_spec.rb b/spec/classes/tuskar_logging_spec.rb
deleted file mode 100644
index ab1fc56..0000000
--- a/spec/classes/tuskar_logging_spec.rb
+++ /dev/null
@@ -1,146 +0,0 @@
1require 'spec_helper'
2
3describe 'tuskar::logging' do
4
5 let :params do
6 {
7 }
8 end
9
10 let :log_params do
11 {
12 :logging_context_format_string => '%(asctime)s.%(msecs)03d %(process)d %(levelname)s %(name)s [%(request_id)s %(user_identity)s] %(instance)s%(message)s',
13 :logging_default_format_string => '%(asctime)s.%(msecs)03d %(process)d %(levelname)s %(name)s [-] %(instance)s%(message)s',
14 :logging_debug_format_suffix => '%(funcName)s %(pathname)s:%(lineno)d',
15 :logging_exception_prefix => '%(asctime)s.%(msecs)03d %(process)d TRACE %(name)s %(instance)s',
16 :log_config_append => '/etc/tuskar/logging.conf',
17 :publish_errors => true,
18 :default_log_levels => {
19 'amqp' => 'WARN', 'amqplib' => 'WARN', 'boto' => 'WARN',
20 'qpid' => 'WARN', 'sqlalchemy' => 'WARN', 'suds' => 'INFO',
21 'iso8601' => 'WARN',
22 'requests.packages.urllib3.connectionpool' => 'WARN' },
23 :fatal_deprecations => true,
24 :instance_format => '[instance: %(uuid)s] ',
25 :instance_uuid_format => '[instance: %(uuid)s] ',
26 :log_date_format => '%Y-%m-%d %H:%M:%S',
27 :use_syslog => true,
28 :use_stderr => false,
29 :log_facility => 'LOG_FOO',
30 :log_dir => '/var/log',
31 :log_file => '/var/log/foo/bar.log',
32 :verbose => true,
33 :debug => true,
34 }
35 end
36
37 shared_examples_for 'tuskar-logging' do
38
39 context 'with basic logging options and default settings' do
40 it_configures 'basic default logging settings'
41 end
42
43 context 'with basic logging options and non-default settings' do
44 before { params.merge!( log_params ) }
45 it_configures 'basic non-default logging settings'
46 end
47
48 context 'with extended logging options' do
49 before { params.merge!( log_params ) }
50 it_configures 'logging params set'
51 end
52
53 context 'without extended logging options' do
54 it_configures 'logging params unset'
55 end
56
57 end
58
59 shared_examples 'basic default logging settings' do
60 it 'configures tuskar logging settins with default values' do
61 is_expected.to contain_tuskar_config('DEFAULT/use_syslog').with(:value => '<SERVICE DEFAULT>')
62 is_expected.to contain_tuskar_config('DEFAULT/use_stderr').with(:value => '<SERVICE DEFAULT>')
63 is_expected.to contain_tuskar_config('DEFAULT/log_dir').with(:value => '/var/log/tuskar')
64 is_expected.to contain_tuskar_config('DEFAULT/log_file').with(:value => '/var/log/tuskar/tuskar-api.log')
65 is_expected.to contain_tuskar_config('DEFAULT/verbose').with(:value => '<SERVICE DEFAULT>')
66 is_expected.to contain_tuskar_config('DEFAULT/debug').with(:value => '<SERVICE DEFAULT>')
67 end
68 end
69
70 shared_examples 'basic non-default logging settings' do
71 it 'configures tuskar logging settins with non-default values' do
72 is_expected.to contain_tuskar_config('DEFAULT/use_syslog').with(:value => 'true')
73 is_expected.to contain_tuskar_config('DEFAULT/use_stderr').with(:value => 'false')
74 is_expected.to contain_tuskar_config('DEFAULT/syslog_log_facility').with(:value => 'LOG_FOO')
75 is_expected.to contain_tuskar_config('DEFAULT/log_dir').with(:value => '/var/log')
76 is_expected.to contain_tuskar_config('DEFAULT/log_file').with(:value => '/var/log/foo/bar.log')
77 is_expected.to contain_tuskar_config('DEFAULT/verbose').with(:value => 'true')
78 is_expected.to contain_tuskar_config('DEFAULT/debug').with(:value => 'true')
79 end
80 end
81
82 shared_examples_for 'logging params set' do
83 it 'enables logging params' do
84 is_expected.to contain_tuskar_config('DEFAULT/logging_context_format_string').with_value(
85 '%(asctime)s.%(msecs)03d %(process)d %(levelname)s %(name)s [%(request_id)s %(user_identity)s] %(instance)s%(message)s')
86
87 is_expected.to contain_tuskar_config('DEFAULT/logging_default_format_string').with_value(
88 '%(asctime)s.%(msecs)03d %(process)d %(levelname)s %(name)s [-] %(instance)s%(message)s')
89
90 is_expected.to contain_tuskar_config('DEFAULT/logging_debug_format_suffix').with_value(
91 '%(funcName)s %(pathname)s:%(lineno)d')
92
93 is_expected.to contain_tuskar_config('DEFAULT/logging_exception_prefix').with_value(
94 '%(asctime)s.%(msecs)03d %(process)d TRACE %(name)s %(instance)s')
95
96 is_expected.to contain_tuskar_config('DEFAULT/log_config_append').with_value(
97 '/etc/tuskar/logging.conf')
98 is_expected.to contain_tuskar_config('DEFAULT/publish_errors').with_value(
99 true)
100
101 is_expected.to contain_tuskar_config('DEFAULT/default_log_levels').with_value(
102 'amqp=WARN,amqplib=WARN,boto=WARN,iso8601=WARN,qpid=WARN,requests.packages.urllib3.connectionpool=WARN,sqlalchemy=WARN,suds=INFO')
103
104 is_expected.to contain_tuskar_config('DEFAULT/fatal_deprecations').with_value(
105 true)
106
107 is_expected.to contain_tuskar_config('DEFAULT/instance_format').with_value(
108 '[instance: %(uuid)s] ')
109
110 is_expected.to contain_tuskar_config('DEFAULT/instance_uuid_format').with_value(
111 '[instance: %(uuid)s] ')
112
113 is_expected.to contain_tuskar_config('DEFAULT/log_date_format').with_value(
114 '%Y-%m-%d %H:%M:%S')
115 end
116 end
117
118
119 shared_examples_for 'logging params unset' do
120 [ :logging_context_format_string, :logging_default_format_string,
121 :logging_debug_format_suffix, :logging_exception_prefix,
122 :log_config_append, :publish_errors,
123 :default_log_levels, :fatal_deprecations,
124 :instance_format, :instance_uuid_format,
125 :log_date_format, ].each { |param|
126 it { is_expected.to contain_tuskar_config("DEFAULT/#{param}").with_value('<SERVICE DEFAULT>') }
127 }
128 end
129
130 context 'on Debian platforms' do
131 let :facts do
132 @default_facts.merge({ :osfamily => 'Debian' })
133 end
134
135 it_configures 'tuskar-logging'
136 end
137
138 context 'on RedHat platforms' do
139 let :facts do
140 @default_facts.merge({ :osfamily => 'RedHat' })
141 end
142
143 it_configures 'tuskar-logging'
144 end
145
146end
diff --git a/spec/classes/tuskar_ui_spec.rb b/spec/classes/tuskar_ui_spec.rb
deleted file mode 100644
index 7566ccd..0000000
--- a/spec/classes/tuskar_ui_spec.rb
+++ /dev/null
@@ -1,79 +0,0 @@
1#
2# Unit tests for tuskar::ui
3#
4require 'spec_helper'
5
6describe 'tuskar::ui' do
7
8 shared_examples_for 'tuskar ui' do
9
10 context 'with default parameters' do
11 it 'installs tuskar-ui package' do
12 is_expected.to contain_package('tuskar-ui').with(
13 :name => platform_params[:ui_package_name],
14 :ensure => 'present',
15 :tag => ['openstack', 'tuskar-package'],
16 )
17 is_expected.to_not contain_package('tuskar-ui-extras')
18 end
19 end
20
21 context 'with extras parameter parameter provided' do
22 let :params do
23 { :extras => true }
24 end
25 it 'installs tuskar-ui and tuskar-ui-extras packages' do
26 is_expected.to contain_package('tuskar-ui').with(
27 :name => platform_params[:ui_package_name],
28 :ensure => 'present',
29 :tag => ['openstack', 'tuskar-package'],
30 )
31 is_expected.to contain_package('tuskar-ui-extras').with(
32 :name => platform_params[:ui_extras_package_name],
33 :ensure => 'present',
34 :tag => ['openstack', 'tuskar-package'],
35 )
36 end
37 end
38
39 context 'with package_ensure parameter provided' do
40 let :params do
41 { :package_ensure => 'absent' }
42 end
43 it 'installs tuskar-ui and tuskar-ui-extras packages' do
44 is_expected.to contain_package('tuskar-ui').with(
45 :name => platform_params[:ui_package_name],
46 :ensure => 'absent',
47 :tag => ['openstack', 'tuskar-package'],
48 )
49 end
50 end
51
52 end
53
54 context 'on Debian platforms' do
55 let :facts do
56 { :osfamily => 'Debian' }
57 end
58
59 let :platform_params do
60 { :ui_package_name => 'tuskar-ui',
61 :ui_extras_package_name => 'tuskar-ui-extras' }
62 end
63
64 it_configures 'tuskar ui'
65 end
66
67 context 'on RedHat platforms' do
68 let :facts do
69 { :osfamily => 'RedHat' }
70 end
71
72 let :platform_params do
73 { :ui_package_name => 'openstack-tuskar-ui',
74 :ui_extras_package_name => 'openstack-tuskar-ui-extras' }
75 end
76
77 it_configures 'tuskar ui'
78 end
79end
diff --git a/spec/shared_examples.rb b/spec/shared_examples.rb
deleted file mode 100644
index d8d8841..0000000
--- a/spec/shared_examples.rb
+++ /dev/null
@@ -1,60 +0,0 @@
1shared_examples_for "a Puppet::Error" do |description|
2 it "with message matching #{description.inspect}" do
3 expect { is_expected.to have_class_count(1) }.to raise_error(Puppet::Error, description)
4 end
5end
6
7shared_examples 'generic Tuskar service' do |service|
8
9 context 'with default parameters' do
10 it 'installs package and service' do
11 is_expected.to contain_package(service[:name]).with({
12 :name => service[:package_name],
13 :ensure => 'present',
14 :notify => "Service[#{service[:name]}]",
15 :tag => ['openstack', 'tuskar-package'],
16 })
17 is_expected.to contain_service(service[:name]).with({
18 :name => service[:service_name],
19 :ensure => 'stopped',
20 :hasstatus => true,
21 :enable => false,
22 :tag => 'tuskar-service',
23 })
24 end
25 end
26
27 context 'with overridden parameters' do
28 let :params do
29 { :enabled => true,
30 :ensure_package => '2014.1-1' }
31 end
32
33 it 'installs package and service' do
34 is_expected.to contain_package(service[:name]).with({
35 :name => service[:package_name],
36 :ensure => '2014.1-1',
37 :notify => "Service[#{service[:name]}]",
38 :tag => ['openstack', 'tuskar-package'],
39 })
40 is_expected.to contain_service(service[:name]).with({
41 :name => service[:service_name],
42 :ensure => 'running',
43 :hasstatus => true,
44 :enable => true,
45 :tag => 'tuskar-service',
46 })
47 end
48 end
49
50 context 'while not managing service state' do
51 let :params do
52 { :enabled => false,
53 :manage_service => false }
54 end
55
56 it 'does not control service state' do
57 is_expected.to contain_service(service[:name]).without_ensure
58 end
59 end
60end
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
deleted file mode 100644
index 9bc7bcf..0000000
--- a/spec/spec_helper.rb
+++ /dev/null
@@ -1,13 +0,0 @@
1require 'puppetlabs_spec_helper/module_spec_helper'
2require 'shared_examples'
3require 'webmock/rspec'
4
5RSpec.configure do |c|
6 c.alias_it_should_behave_like_to :it_configures, 'configures'
7 c.alias_it_should_behave_like_to :it_raises, 'raises'
8 c.before :each do
9 @default_facts = { :os_service_default => '<SERVICE DEFAULT>' }
10 end
11end
12
13at_exit { RSpec::Puppet::Coverage.report! }
diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb
deleted file mode 100644
index 429e807..0000000
--- a/spec/spec_helper_acceptance.rb
+++ /dev/null
@@ -1,56 +0,0 @@
1require 'beaker-rspec'
2require 'beaker/puppet_install_helper'
3
4run_puppet_install_helper
5
6RSpec.configure do |c|
7 # Project root
8 proj_root = File.expand_path(File.join(File.dirname(__FILE__), '..'))
9 modname = JSON.parse(open('metadata.json').read)['name'].split('-')[1]
10
11 # Readable test descriptions
12 c.formatter = :documentation
13
14 # Configure all nodes in nodeset
15 c.before :suite do
16 # Install module and dependencies
17 hosts.each do |host|
18
19 # install git
20 install_package host, 'git'
21
22 zuul_ref = ENV['ZUUL_REF']
23 zuul_branch = ENV['ZUUL_BRANCH']
24 zuul_url = ENV['ZUUL_URL']
25
26 repo = 'openstack/puppet-openstack-integration'
27
28 # Start out with clean moduledir, don't trust r10k to purge it
29 on host, "rm -rf /etc/puppet/modules/*"
30 # Install dependent modules via git or zuul
31 r = on host, "test -e /usr/zuul-env/bin/zuul-cloner", { :acceptable_exit_codes => [0,1] }
32 if r.exit_code == 0
33 zuul_clone_cmd = '/usr/zuul-env/bin/zuul-cloner '
34 zuul_clone_cmd += '--cache-dir /opt/git '
35 zuul_clone_cmd += "--zuul-ref #{zuul_ref} "
36 zuul_clone_cmd += "--zuul-branch #{zuul_branch} "
37 zuul_clone_cmd += "--zuul-url #{zuul_url} "
38 zuul_clone_cmd += "git://git.openstack.org #{repo}"
39 on host, zuul_clone_cmd
40 else
41 on host, "git clone https://git.openstack.org/#{repo} #{repo}"
42 end
43
44 on host, "ZUUL_REF=#{zuul_ref} ZUUL_BRANCH=#{zuul_branch} ZUUL_URL=#{zuul_url} bash #{repo}/install_modules.sh"
45
46 # Install the module being tested
47 on host, "rm -fr /etc/puppet/modules/#{modname}"
48 puppet_module_install(:source => proj_root, :module_name => modname)
49
50 on host, "rm -fr #{repo}"
51
52 # List modules installed to help with debugging
53 on host, puppet('module','list'), { :acceptable_exit_codes => 0 }
54 end
55 end
56end
diff --git a/spec/unit/provider/tuskar_config/ini_setting_spec.rb b/spec/unit/provider/tuskar_config/ini_setting_spec.rb
deleted file mode 100644
index 047515a..0000000
--- a/spec/unit/provider/tuskar_config/ini_setting_spec.rb
+++ /dev/null
@@ -1,66 +0,0 @@
1# these tests are a little concerning b/c they are hacking around the
2# modulepath, so these tests will not catch issues that may eventually arise
3# related to loading these plugins.
4# I could not, for the life of me, figure out how to programatcally set the modulepath
5$LOAD_PATH.push(
6 File.join(
7 File.dirname(__FILE__),
8 '..',
9 '..',
10 '..',
11 'fixtures',
12 'modules',
13 'inifile',
14 'lib')
15)
16$LOAD_PATH.push(
17 File.join(
18 File.dirname(__FILE__),
19 '..',
20 '..',
21 '..',
22 'fixtures',
23 'modules',
24 'openstacklib',
25 'lib')
26)
27require 'spec_helper'
28provider_class = Puppet::Type.type(:tuskar_config).provider(:ini_setting)
29describe provider_class do
30
31 it 'should default to the default setting when no other one is specified' do
32 resource = Puppet::Type::Tuskar_config.new(
33 {:name => 'DEFAULT/foo', :value => 'bar'}
34 )
35 provider = provider_class.new(resource)
36 expect(provider.section).to eq('DEFAULT')
37 expect(provider.setting).to eq('foo')
38 end
39
40 it 'should allow setting to be set explicitly' do
41 resource = Puppet::Type::Tuskar_config.new(
42 {:name => 'dude/foo', :value => 'bar'}
43 )
44 provider = provider_class.new(resource)
45 expect(provider.section).to eq('dude')
46 expect(provider.setting).to eq('foo')
47 end
48
49 it 'should ensure absent when <SERVICE DEFAULT> is specified as a value' do
50 resource = Puppet::Type::Tuskar_config.new(
51 {:name => 'dude/foo', :value => '<SERVICE DEFAULT>'}
52 )
53 provider = provider_class.new(resource)
54 provider.exists?
55 expect(resource[:ensure]).to eq :absent
56 end
57
58 it 'should ensure absent when value matches ensure_absent_val' do
59 resource = Puppet::Type::Tuskar_config.new(
60 {:name => 'dude/foo', :value => 'foo', :ensure_absent_val => 'foo' }
61 )
62 provider = provider_class.new(resource)
63 provider.exists?
64 expect(resource[:ensure]).to eq :absent
65 end
66end
diff --git a/spec/unit/type/tuskar_config_spec.rb b/spec/unit/type/tuskar_config_spec.rb
deleted file mode 100644
index 9e47910..0000000
--- a/spec/unit/type/tuskar_config_spec.rb
+++ /dev/null
@@ -1,63 +0,0 @@
1require 'puppet'
2require 'puppet/type/tuskar_config'
3describe 'Puppet::Type.type(:tuskar_config)' do
4 before :each do
5 @tuskar_config = Puppet::Type.type(:tuskar_config).new(:name => 'DEFAULT/foo', :value => 'bar')
6 end
7
8 it 'should require a name' do
9 expect {
10 Puppet::Type.type(:tuskar_config).new({})
11 }.to raise_error(Puppet::Error, 'Title or name must be provided')
12 end
13
14 it 'should not expect a name with whitespace' do
15 expect {
16 Puppet::Type.type(:tuskar_config).new(:name => 'f oo')
17 }.to raise_error(Puppet::Error, /Parameter name failed/)
18 end
19
20 it 'should fail when there is no section' do
21 expect {
22 Puppet::Type.type(:tuskar_config).new(:name => 'foo')
23 }.to raise_error(Puppet::Error, /Parameter name failed/)
24 end
25
26 it 'should not require a value when ensure is absent' do
27 Puppet::Type.type(:tuskar_config).new(:name => 'DEFAULT/foo', :ensure => :absent)
28 end
29
30 it 'should accept a valid value' do
31 @tuskar_config[:value] = 'bar'
32 expect(@tuskar_config[:value]).to eq('bar')
33 end
34
35 it 'should not accept a value with whitespace' do
36 @tuskar_config[:value] = 'b ar'
37 expect(@tuskar_config[:value]).to eq('b ar')
38 end
39
40 it 'should accept valid ensure values' do
41 @tuskar_config[:ensure] = :present
42 expect(@tuskar_config[:ensure]).to eq(:present)
43 @tuskar_config[:ensure] = :absent
44 expect(@tuskar_config[:ensure]).to eq(:absent)
45 end
46
47 it 'should not accept invalid ensure values' do
48 expect {
49 @tuskar_config[:ensure] = :latest
50 }.to raise_error(Puppet::Error, /Invalid value/)
51 end
52
53 it 'should autorequire the package that install the file' do
54 catalog = Puppet::Resource::Catalog.new
55 package = Puppet::Type.type(:package).new(:name => 'tuskar-api')
56 catalog.add_resource package, @tuskar_config
57 dependency = @tuskar_config.autorequire
58 expect(dependency.size).to eq(1)
59 expect(dependency[0].target).to eq(@tuskar_config)
60 expect(dependency[0].source).to eq(package)
61 end
62
63end