diff --git a/Puppetfile b/Puppetfile index fdc6b4872..2e112a9d3 100644 --- a/Puppetfile +++ b/Puppetfile @@ -139,8 +139,8 @@ mod 'rsync', :git => 'https://github.com/puppetlabs/puppetlabs-rsync.git' mod 'sahara', - :commit => '6b696cffcba6692975dbcfee144e81b6e90e5ecf', - :git => 'https://github.com/stackforge/puppet-sahara.git' + :commit => '66301097ee42840831f8c8c7cd0482e3e2325df5', + :git => 'https://github.com/frozencemetery/puppet-sahara.git' mod 'ssh', :commit => 'd6571f8c43ac55d20a6afd8a8ce3f86ac4b0d7a4', diff --git a/sahara/.fixtures.yml b/sahara/.fixtures.yml index 27ce6bb1e..77ce9cf85 100644 --- a/sahara/.fixtures.yml +++ b/sahara/.fixtures.yml @@ -6,9 +6,7 @@ fixtures: repo: 'git://github.com/puppetlabs/puppetlabs-mysql.git' ref: 'origin/2.2.x' 'openstacklib': 'git://github.com/stackforge/puppet-openstacklib.git' - 'postgresql': - repo: "git://github.com/puppetlabs/puppet-postgresql.git" - ref: '2.5.0' + 'postgresql': 'git://github.com/puppetlabs/puppetlabs-postgresql.git' 'qpid': 'git://github.com/dprince/puppet-qpid.git' 'rabbitmq': repo: 'git://github.com/puppetlabs/puppetlabs-rabbitmq' diff --git a/sahara/.gitreview b/sahara/.gitreview deleted file mode 100644 index c9b04466b..000000000 --- a/sahara/.gitreview +++ /dev/null @@ -1,4 +0,0 @@ -[gerrit] -host=review.openstack.org -port=29418 -project=stackforge/puppet-sahara.git diff --git a/sahara/Gemfile b/sahara/Gemfile index d965fa900..5a55d1f7e 100644 --- a/sahara/Gemfile +++ b/sahara/Gemfile @@ -2,7 +2,10 @@ source 'https://rubygems.org' group :development, :test do gem 'puppetlabs_spec_helper', :require => false - gem 'puppet-lint', '~> 0.3.2' + gem 'puppet-lint', '~> 1.1' + gem 'puppet-lint-param-docs', '1.1.0' + gem 'metadata-json-lint' + gem 'puppet-syntax' gem 'rake', '10.1.1' gem 'rspec', '< 2.99' gem 'json' @@ -14,5 +17,3 @@ if puppetversion = ENV['PUPPET_GEM_VERSION'] else gem 'puppet', :require => false end - -# vim:ft=ruby diff --git a/sahara/LICENSE b/sahara/LICENSE new file mode 100644 index 000000000..8d968b6cb --- /dev/null +++ b/sahara/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/sahara/README.md b/sahara/README.md index 27806e26b..4a4557174 100644 --- a/sahara/README.md +++ b/sahara/README.md @@ -1,11 +1,84 @@ -# puppet-sahara +sahara +====== -Installs the OpenStack [sahara UI and backend](https://launchpad.net/sahara) +5.0.0 - 2014.2.0 - Juno -If you want an example of how it's used see example/example.pp. +#### Table of Contents -Pull requests and suggestions gladly received! +1. [Overview - What is the sahara module?](#overview) +2. [Module Description - What does the module do?](#module-description) +3. [Setup - The basics of getting started with sahara](#setup) +4. [Implementation - An under-the-hood peek at what the module is doing](#implementation) +5. [Limitations - OS compatibility, etc.](#limitations) +6. [Development - Guide for contributing to the module](#development) +7. [Contributors - Those with commits](#contributors) +8. [Release Notes - Notes on the most recent updates to the module](#release-notes) -If you wish to participate in the Sahara project please -[see the Sahara OpenStack wiki page](http://docs.openstack.org/developer/sahara/devref/how_to_participate.html) -for more information. \ No newline at end of file +Overview +-------- + +The Sahara module itself is used to flexibly configure and manage the +clustering service for OpenStack. + +Module Description +------------------ + +The sahara module is an attempt to make Puppet capable of managing the +entirety of sahara. + +Setup +----- + +**What the sahara module affects:** + +* sahara, the hadoop clustering service for Openstack. + +### Installing sahara + + example% cd /usr/share/puppet/modules + example% git clone https://github.com/frozencemetery/puppet-sahara sahara + +### Beginning with sahara + +To use the sahara module's functionality you will need to declare multiple +resources. This is not an exhaustive list of all the components needed; we +recommend you consult and understand the +[core of openstack](http://docs.openstack.org) documentation. + +Examples of usage can be found in the *examples* directory. + +Implementation +-------------- + +### sahara + +sahara is a combination of Puppet manifests and ruby code to deliver +configuration and extra functionality through types and providers. + +Limitations +----------- + +Batman has no limits. + +Development +----------- + +Since this is not (yet?) a stackforge project, development happens through +pull requests on the +[main repository](https://github.com/frozencemetery/puppet-sahara). + +I will do my best to keep in mind when merging that building the bike shed is +more important than its [color](http://bikeshed.org/). + +Contributors +------------ + +- Robbie Harwood <rharwood@redhat.com> +- Sebastien Badia <sbadia@redhat.com> + +Release Notes +------------- + +**5.0.0** + +* Rewrite diff --git a/sahara/README.rst b/sahara/README.rst deleted file mode 100644 index 2743a2c1d..000000000 --- a/sahara/README.rst +++ /dev/null @@ -1 +0,0 @@ -This repo will contain puppet manifests for Sahara diff --git a/sahara/Rakefile b/sahara/Rakefile index c76798a01..33626c40a 100644 --- a/sahara/Rakefile +++ b/sahara/Rakefile @@ -3,6 +3,14 @@ require 'puppet-lint/tasks/puppet-lint' PuppetLint.configuration.fail_on_warnings = true PuppetLint.configuration.send('disable_80chars') -PuppetLint.configuration.send('disable_class_inherits_from_params_class') PuppetLint.configuration.send('disable_class_parameter_defaults') -PuppetLint.configuration.send('disable_autoloader_layout') +PuppetLint.configuration.send('disable_class_inherits_from_params_class') + +exclude_tests_paths = ['pkg/**/*','vendor/**/*'] +PuppetLint.configuration.ignore_paths = exclude_tests_paths +PuppetSyntax.exclude_paths = exclude_tests_paths + +desc "Lint metadata.json file" +task :metadata do + sh "metadata-json-lint metadata.json" +end diff --git a/sahara/example/example.pp b/sahara/example/example.pp deleted file mode 100644 index 607e87206..000000000 --- a/sahara/example/example.pp +++ /dev/null @@ -1,23 +0,0 @@ - -class { 'sahara::db::mysql': password => 'sahara', } - -class { 'sahara::keystone::auth': - password => 'sahara', - public_address => '127.0.0.1', - admin_address => '127.0.0.1', - internal_address => '127.0.0.1', -} - -class { 'sahara': - sahara_host => '127.0.0.1', - db_host => '127.0.0.1', - sahara_db_password => 'sahara', - keystone_auth_host => '127.0.0.1', - keystone_password => 'sahara', - sahara_verbose => true, -} - -class { 'sahara::dashboard': - sahara_host => '127.0.0.1', - use_neutron => true, -} diff --git a/sahara/examples/basic.pp b/sahara/examples/basic.pp new file mode 100644 index 000000000..de30ab380 --- /dev/null +++ b/sahara/examples/basic.pp @@ -0,0 +1,47 @@ +# First, install a mysql server +class { 'mysql::server': + # sahara documentation recommends this configuration. + override_options => { + 'mysqld' => { + 'max_allowed_packet' => '256M' + } + }, + + # many configurations will need this line, too + package_name => 'mariadb-galera-server', + + # if you're installing into an existing openstack + manage_config_file => false, + purge_conf_dir => false, +} + +# Then, create a database +class { 'sahara::db::mysql': + password => 'a_big_secret', +} + +# And connect a message bus +class { 'sahara::notify::rabbitmq': + rabbit_password => 'guest', + rabbit_use_ssl => false, +} + +# Then the common class +class { 'sahara': + database_connection => 'mysql://sahara:a_big_secret@127.0.0.1:3306/sahara', + verbose => true, + debug => true, + os_username => 'admin', + os_password => 'secrets_everywhere', + os_tenant_name => 'admin', + os_auth_url => 'http://127.0.0.1:5000/v2.0/', + identity_url => 'http://127.0.0.1:35357/', + service_host => '127.0.0.1', + service_port => 8386, + use_neutron => true, +} + +# Finally, make it accessible +class { 'sahara::keystone::auth': + password => 'secrete', +} diff --git a/sahara/lib/puppet/provider/sahara_config/ini_setting.rb b/sahara/lib/puppet/provider/sahara_config/ini_setting.rb new file mode 100644 index 000000000..241fd9671 --- /dev/null +++ b/sahara/lib/puppet/provider/sahara_config/ini_setting.rb @@ -0,0 +1,22 @@ +Puppet::Type.type(:sahara_config).provide( + :ini_setting, + :parent => Puppet::Type.type(:ini_setting).provider(:ruby) +) do + + def section + resource[:name].split('/', 2).first + end + + def setting + resource[:name].split('/', 2).last + end + + def separator + '=' + end + + def file_path + '/etc/sahara/sahara.conf' + end + +end diff --git a/sahara/lib/puppet/provider/sahara_config/ini_settings.rb b/sahara/lib/puppet/provider/sahara_config/ini_settings.rb deleted file mode 100644 index b7826f4b5..000000000 --- a/sahara/lib/puppet/provider/sahara_config/ini_settings.rb +++ /dev/null @@ -1,32 +0,0 @@ -Puppet::Type.type(:sahara_config).provide( - :ini_setting, - :parent => Puppet::Type.type(:ini_setting).provider(:ruby) -) do - - # the setting is always default - # this if for backwards compat with the old puppet providers for sahara_config - def section - resource[:name].split('/', 2)[0] - end - - # assumes that the name was the setting - # this is to maintain backwards compat with the the older - # stuff - def setting - resource[:name].split('/', 2)[1] - end - - def separator - '=' - end - - def self.file_path - '/etc/sahara/sahara.conf' - end - - # this needs to be removed. This has been replaced with the class method - def file_path - self.class.file_path - end - -end diff --git a/sahara/lib/puppet/type/sahara_config.rb b/sahara/lib/puppet/type/sahara_config.rb index eae05a719..9bad75eaa 100644 --- a/sahara/lib/puppet/type/sahara_config.rb +++ b/sahara/lib/puppet/type/sahara_config.rb @@ -1,8 +1,8 @@ Puppet::Type.newtype(:sahara_config) do - ensurable newparam(:name, :namevar => true) do + desc 'Section/setting name to manage from sahara.conf' newvalues(/\S+\/\S+/) end @@ -13,9 +13,8 @@ value.capitalize! if value =~ /^(true|false)$/i value end - newvalues(/^[\S ]*$/) - def is_to_s( currentvalue ) + def is_to_s(currentvalue) if resource.secret? return '[old secret redacted]' else @@ -23,7 +22,7 @@ def is_to_s( currentvalue ) end end - def should_to_s( newvalue ) + def should_to_s(newvalue) if resource.secret? return '[new secret redacted]' else @@ -33,7 +32,7 @@ def should_to_s( newvalue ) end newparam(:secret, :boolean => true) do - desc 'Whether to hide the value from Puppet logs. Defaults to `false`.' + desc 'Whether to hide the value from Puppet logs. Defaults to `false`.' newvalues(:true, :false) diff --git a/sahara/manifests/client.pp b/sahara/manifests/client.pp new file mode 100644 index 000000000..4d3a2541b --- /dev/null +++ b/sahara/manifests/client.pp @@ -0,0 +1,21 @@ +# == Class: sahara::client +# +# Installs the sahara python library. +# +# === Parameters +# +# [*package_ensure*] +# (Optional) Ensure state for package. +# Default: present. +# +class sahara::client ( + $package_ensure = 'present' +) { + + include sahara::params + + package { 'python-saharaclient': + ensure => $package_ensure, + name => $::sahara::params::client_package_name, + } +} diff --git a/sahara/manifests/dashboard.pp b/sahara/manifests/dashboard.pp deleted file mode 100644 index d26b51064..000000000 --- a/sahara/manifests/dashboard.pp +++ /dev/null @@ -1,83 +0,0 @@ -# Copyright 2013 Zuercher Hochschule fuer Angewandte Wissenschaften -# All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -# -# Used to install sahara's horizon component -# - -class sahara::dashboard ( - $sahara_host = '127.0.0.1', - $sahara_port = '8386', - $use_neutron = false, - ) { - - include sahara::params - - if use_neutron { - $neutron = 'True' - } else { - $neutron = 'False' - } - - if !defined(Package['python-pip']) { - package { 'python-pip': ensure => latest, } - } - - if $sahara::params::development { - info('Installing the developement version of sahara dashboard') - - package { 'sahara-dashboard': - ensure => installed, - provider => pip, - source => $sahara::params::development_dashboard_build_url, - require => Package['python-pip'], - } - } elsif $sahara::params::rpm_install { - info('Installing RPM package of Sahara-dashboard') - package { $sahara::params::rpm_package_name_dashboard: - ensure => installed, - } - } else { - package { 'sahara-dashboard': - ensure => installed, - provider => pip, - require => Package['python-pip'], - } - } - - exec { 'sahara-horizon-config': - command => "echo \"HORIZON_CONFIG['dashboards'] += ('sahara',)\" >> ${sahara::params::horizon_settings}", - path => '/usr/bin:/usr/sbin:/bin:/usr/local/bin', - unless => "grep \"HORIZON_CONFIG\['dashboards'\] +=\" ${sahara::params::horizon_settings}", - } - - exec { 'sahara-installed-apps': - command => "echo \"INSTALLED_APPS += ('saharadashboard',)\" >> ${sahara::params::horizon_settings}", - path => '/usr/bin:/usr/sbin:/bin:/usr/local/bin', - unless => "grep \"INSTALLED_APPS +=\" ${sahara::params::horizon_settings}", - } - - exec { 'sahara-use-neutron': - command => "echo 'SAHARA_USE_NEUTRON = ${neutron}' >> ${sahara::params::horizon_local_settings}", - path => '/usr/bin:/usr/sbin:/bin:/usr/local/bin', - unless => "grep \"SAHARA_USE_NEUTRON\" ${sahara::params::horizon_local_settings}", - } - - exec { 'sahara-url': - command => "echo \"SAHARA_URL = 'http://${sahara_host}:${sahara_port}/v1.1'\" >> ${sahara::params::horizon_local_settings}", - path => '/usr/bin:/usr/sbin:/bin:/usr/local/bin', - unless => "grep \"SAHARA_URL\" ${sahara::params::horizon_local_settings}", - } -} \ No newline at end of file diff --git a/sahara/manifests/db/mysql.pp b/sahara/manifests/db/mysql.pp index f32a85895..4c74054d4 100644 --- a/sahara/manifests/db/mysql.pp +++ b/sahara/manifests/db/mysql.pp @@ -1,64 +1,60 @@ -# Copyright 2013 Zuercher Hochschule fuer Angewandte Wissenschaften -# All Rights Reserved. +# == Class: sahara::db::mysql # -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at +# The sahara::db::mysql class creates a MySQL database for sahara. +# It must be used on the MySQL server. # -# http://www.apache.org/licenses/LICENSE-2.0 +# === Parameters # -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - +# [*password*] +# (Mandatory) Password to connect to the database. +# Defaults to 'false'. # -# workaround for desire of python-mysqldb on RHEL +# [*dbname*] +# (Optional) Name of the database. +# Defaults to 'sahara'. # -class mysql::bindings::python { - include mysql::params - package { 'python-mysqldb': - ensure => $mysql::params::python_package_ensure, - name => $mysql::params::python_package_name, - provider => $mysql::params::python_package_provider, - } -} - +# [*user*] +# (Optional) User to connect to the database. +# Defaults to 'sahara'. +# +# [*host*] +# (Optional) The default source host user is allowed to connect from. +# Defaults to '127.0.0.1' # -# Used to create the sahara db +# [*allowed_hosts*] +# (Optional) Other hosts the user is allowed to connect from. +# Defaults to 'undef'. # -class sahara::db::mysql ( - $password = 'sahara', +# [*charset*] +# (Optional) The database charset. +# Defaults to 'utf8'. +# +# [*collate*] +# (Optional) The database collate. +# Only used with mysql modules >= 2.2. +# Defaults to 'utf8_unicode_ci'. +# +class sahara::db::mysql( + $password, $dbname = 'sahara', $user = 'sahara', $host = '127.0.0.1', - $allowed_hosts = undef, # ['127.0.0.1'], - $charset = 'utf8',) { - Class['mysql::server'] -> Class['sahara::db::mysql'] + $allowed_hosts = undef, + $charset = 'utf8', + $collate = 'utf8_unicode_ci', +) { - require mysql::server + validate_string($password) - mysql::db { $dbname: - user => $user, - password => $password, - host => $host, - charset => $charset, - require => Class['mysql::server::config'], + ::openstacklib::db::mysql{ 'sahara': + user => $user, + password_hash => mysql_password($password), + dbname => $dbname, + host => $host, + charset => $charset, + collate => $collate, + allowed_hosts => $allowed_hosts, } - # Check allowed_hosts to avoid duplicate resource declarations - if is_array($allowed_hosts) and delete($allowed_hosts, $host) != [] { - $real_allowed_hosts = delete($allowed_hosts, $host) - } elsif is_string($allowed_hosts) and ($allowed_hosts != $host) { - $real_allowed_hosts = $allowed_hosts - } - - if $real_allowed_hosts { - sahara::db::mysql::host_access { $real_allowed_hosts: - user => $user, - password => $password, - database => $dbname, - } - } + ::Openstacklib::Db::Mysql['sahara'] ~> Exec<| title == 'sahara-dbmanage' |> } diff --git a/sahara/manifests/db/mysql/host_access.pp b/sahara/manifests/db/mysql/host_access.pp deleted file mode 100644 index 1c3b9dca9..000000000 --- a/sahara/manifests/db/mysql/host_access.pp +++ /dev/null @@ -1,33 +0,0 @@ -# Copyright 2013 Zuercher Hochschule fuer Angewandte Wissenschaften -# All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -# -# Used to grant access to the sahara mysql DB -# - -define sahara::db::mysql::host_access ($user, $password, $database) { - database_user { "${user}@${name}": - password_hash => mysql_password($password), - provider => 'mysql', - require => Database[$database], - } - - database_grant { "${user}@${name}/${database}": - # TODO figure out which privileges to grant. - privileges => 'all', - provider => 'mysql', - require => Database_user["${user}@${name}"] - } -} diff --git a/sahara/manifests/db/postgresql.pp b/sahara/manifests/db/postgresql.pp new file mode 100644 index 000000000..344b60dcf --- /dev/null +++ b/sahara/manifests/db/postgresql.pp @@ -0,0 +1,36 @@ +# == Class: sahara::db:postgresql +# +# The sahara::db::postgresql creates a PostgreSQL database for sahara. +# It must be used on the PostgreSQL server. +# +# === Parameters +# +# [*password*] +# (Mandatory) Password to connect to the database. +# Defaults to 'false'. +# +# [*dbname*] +# (Optional) Name of the database. +# Defaults to 'sahara'. +# +# [*user*] +# (Optional) User to connect to the database. +# Defaults to 'sahara'. +# +class sahara::db::postgresql ( + $password, + $dbname = 'sahara', + $user = 'sahara', +) { + + require postgresql::lib::python + validate_string($password) + + postgresql::server::db { $dbname: + user => $user, + password => postgresql_password($user, $password), + } + + PostgreSQL::Server::Db[$dbname] ~> Exec<| title == 'sahara-dbmanage' |> + Package['python-psycopg2'] -> Exec<| title == 'sahara-dbmanage' |> +} diff --git a/sahara/manifests/init.pp b/sahara/manifests/init.pp index 5bf8c08cd..1d067785e 100644 --- a/sahara/manifests/init.pp +++ b/sahara/manifests/init.pp @@ -1,109 +1,172 @@ -# Copyright 2013 Zuercher Hochschule fuer Angewandte Wissenschaften -# All Rights Reserved. +# == Class: sahara # -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at +# Sahara base package & configuration # -# http://www.apache.org/licenses/LICENSE-2.0 +# === Parameters # -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -# == Class: sahara +# [*package_ensure*] +# (Optional) Ensure state for package +# Defaults to 'present'. # -# Installs the sahara backend. +# [*manage_service*] +# (optional) Whether the service should be managed by Puppet. +# Defaults to true. # -# === Parameters +# [*enabled*] +# (optional) Should the service be enabled. +# Defaults to true. # -# Document parameters here. -# -# [*sample_parameter*] -# Explanation of what this parameter affects and what it defaults to. -# e.g. "Specify one or more upstream ntp servers as an array." -# -# === Variables -# -# Here you should define a list of variables that this module would require. -# -# [*sahara_host*] -# The host on which the sahara process (API) runs. Defaults to '127.0.0.1' -# [*sahara_port*] -# The port on which the sahara process (API) runs on. Defaults to 3836 -# [*db_host*] -# The host where the database is running. Sahara will use this to persist -# information about clusters. Defaults to '127.0.0.1' -# [*sahara_db_name*] -# [*sahara_db_password*] -# [*keystone_auth_protocol*] -# Defaults to 'http', -# [*keystone_auth_host*] -# Defaults to '127.0.0.1' -# [*keystone_auth_port*] -# Defaults to '35357' -# [*keystone_user*] -# Defaults to 'sahara' -# [*keystone_password*] -# Defaults to 'sahara' -# [*keystone_tenant*] -# Defaults to undef -# [*sahara_verbose*] -# Defaults to false -# [*sahara_debug*] -# Defaults to false -# === Examples -# -# class{'sahara': -# sahara_host => '127.0.0.1', -# db_host => '127.0.0.1', -# sahara_db_password => 'sahara', -# keystone_auth_host => '127.0.0.1', -# keystone_password => 'admin', -# sahara_verbose => True, -#} -# -# === Authors -# -# Andy Edmonds -# -# -# TODOs -# - need to install disk builder and create image -# or generate and install -# - use a puppet type for configuration file -# - clean up documentation - -class sahara ( - $sahara_host = '127.0.0.1', - $sahara_port = '8386', - $sahara_verbose = false, - $sahara_debug = false, - # db - $db_host = '127.0.0.1', - $sahara_db_name = 'sahara', - $sahara_db_user = 'sahara', - $sahara_db_password = 'sahara', - # keystone - $keystone_auth_protocol = 'http', - $keystone_auth_host = '127.0.0.1', - $keystone_auth_port = '35357', - $keystone_user = 'sahara', - $keystone_password = 'sahara', - $keystone_tenant = undef,) { +# [*verbose*] +# (Optional) Should the daemons log verbose messages +# Defaults to 'false'. +# +# [*debug*] +# (Optional) Should the daemons log debug messages +# Defaults to 'false'. +# +# [*service_host*] +# (Optional) Hostname for sahara to listen on +# Defaults to '127.0.0.1'. +# +# [*service_port*] +# (Optional) Port for sahara to listen on +# Defaults to 8386. +# +# [*use_neutron*] +# (Optional) Whether to use neutron +# Defaults to true. +# +# [*database_connection*] +# (Optional) Non-sqllite database for sahara +# Defaults to 'mysql://sahara:secrete@localhost:3306/sahara'. +# +# == keystone authentication options +# +# [*os_username*] +# (Optional) Username for sahara credentials +# Defaults to 'admin'. +# +# [*os_password*] +# (Optional) Password for sahara credentials +# Defaults to 'secrete'. +# +# [*os_tenant_name*] +# (Optional) Tenant for os_username +# Defaults to 'admin'. +# +# [*os_auth_url*] +# (Optional) Public identity endpoint +# Defaults to 'http://127.0.0.1:5000/v2.0/'. +# +# [*identity_url*] +# (Optional) Admin identity endpoint +# Defaults to 'http://127.0.0.1:35357/'. +# +class sahara( + $manage_service = true, + $enabled = true, + $package_ensure = 'present', + $verbose = false, + $debug = false, + $service_host = '127.0.0.1', + $service_port = 8386, + $use_neutron = true, + $database_connection = 'mysql://sahara:secrete@localhost:3306/sahara', + $os_username = 'admin', + $os_password = 'secrete', + $os_tenant_name = 'admin', + $os_auth_url = 'http://127.0.0.1:5000/v2.0/', + $identity_url = 'http://127.0.0.1:35357/', +) { include sahara::params - # move keystone and db classes here? + file { '/etc/sahara/': + ensure => directory, + owner => 'root', + group => 'sahara', + mode => '0750', + require => Package['sahara'], + } + + file { '/etc/sahara/sahara.conf': + owner => 'root', + group => 'sahara', + mode => '0640', + require => File['/etc/sahara'], + } + + package { 'sahara': + ensure => $package_ensure, + name => $::sahara::params::package_name, + } + + Package['sahara'] -> Sahara_config<||> + Package['sahara'] ~> Service['sahara'] + + validate_re($database_connection, '(sqlite|mysql|postgresql):\/\/(\S+:\S+@\S+\/\S+)?') + + case $database_connection { + /^mysql:\/\//: { + require mysql::bindings + require mysql::bindings::python + } + /^postgresql:\/\//: { + require postgresql::lib::python + } + /^sqlite:\/\//: { + fail('Sahara does not support sqlite!') + } + default: { + fail('Unsupported db backend configured') + } + } + + sahara_config { + 'DEFAULT/use_neutron': value => $use_neutron; + 'DEFAULT/host': value => $service_host; + 'DEFAULT/port': value => $service_port; + 'DEFAULT/debug': value => $debug; + 'DEFAULT/verbose': value => $verbose; + + 'database/connection': + value => $database_connection, + secret => true; + + 'keystone_authtoken/auth_uri': value => $os_auth_url; + 'keystone_authtoken/identity_uri': value => $identity_url; + 'keystone_authtoken/admin_user': value => $os_username; + 'keystone_authtoken/admin_tenant_name': value => $os_tenant_name; + 'keystone_authtoken/admin_password': + value => $os_password, + secret => true; + } + + if $manage_service { + if $enabled { + $service_ensure = 'running' + } else { + $service_ensure = 'stopped' + } + } + + Package['sahara'] -> Service['sahara'] + service { 'sahara': + ensure => $service_ensure, + name => $::sahara::params::service_name, + hasstatus => true, + enable => $enabled, + hasrestart => true, + subscribe => Exec['sahara-dbmanage'], + } + + Sahara_config<||> ~> Exec['sahara-dbmanage'] - if !$keystone_tenant { - $int_keystone_tenant = $keystone_user - } else { - $int_keystone_tenant = $keystone_tenant + exec { 'sahara-dbmanage': + command => $::sahara::params::dbmanage_command, + path => '/usr/bin', + user => 'root', + refreshonly => true, + logoutput => on_failure, } - class { '::sahara::install': - } -> - class { '::sahara::service': } } diff --git a/sahara/manifests/install.pp b/sahara/manifests/install.pp deleted file mode 100644 index f6a2050ec..000000000 --- a/sahara/manifests/install.pp +++ /dev/null @@ -1,173 +0,0 @@ -# Copyright 2013 Zuercher Hochschule fuer Angewandte Wissenschaften -# All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -class sahara::install { - include sahara::params - - # this is here until this fix is released - # https://bugs.launchpad.net/ubuntu/+source/python-pbr/+bug/1245676 - if !defined(Package['git']) { - package { 'git': ensure => latest, } - } - - if !defined(Package['python-pip']) { - package { 'python-pip': - ensure => latest, - require => Package['git'] - } - } - - if $::osfamily == 'Debian' { - if !defined(Package['python-dev']) { - package { 'python-dev': - ensure => latest, - require => Package['python-pip'] - } - } - } elsif $::osfamily == 'Redhat' { - if !defined(Package['python-devel']) { - package { 'python-devel': - ensure => latest, - require => Package['python-pip'] - } - } - if !defined(Package['python-jinja2']) { - package { 'python-jinja2': - ensure => latest, - require => Package['python-pip'] - } - } - } - - if $sahara::params::development { - info("Installing and using the sahara development version. URL: - ${sahara::params::development_build_url}") - - package { 'sahara': - ensure => installed, - provider => pip, - source => $sahara::params::development_build_url, - require => Package['python-pip'], - } - } elsif $sahara::params::rpm_install { - info('Installing RPM package of Sahara') - package { $sahara::params::rpm_package_name_service: - ensure => installed, - } - } else { - package { 'sahara': - ensure => installed, - provider => pip, - require => Package['python-pip'], - } - } - - group { 'sahara': - ensure => present, - system => true, - } -> - user { 'sahara': - ensure => present, - gid => 'sahara', - system => true, - home => '/var/lib/sahara', - shell => '/bin/false' - } -> - file { '/var/lib/sahara': - ensure => 'directory', - owner => 'sahara', - group => 'sahara', - mode => '0750', - } -> - file { '/var/log/sahara': - ensure => 'directory', - owner => 'sahara', - group => 'sahara', - mode => '0750', - } -> - file { '/var/log/sahara/sahara.log': - ensure => 'file', - owner => 'sahara', - group => 'sahara', - mode => '0640', - } -> - file { '/etc/sahara': - ensure => 'directory', - owner => 'sahara', - group => 'sahara', - mode => '0750', - } -> - file { '/etc/sahara/sahara.conf': - ensure => file, - path => '/etc/sahara/sahara.conf', - content => template('sahara/sahara.conf.erb'), - owner => 'sahara', - group => 'sahara', - mode => '0640', - } - - if $::osfamily == 'Debian' { - file { '/etc/init.d/sahara-api': - ensure => file, - path => '/etc/init.d/sahara-api', - content => template('sahara/sahara-api.erb'), - mode => '0750', - owner => 'root', - group => 'root', - } -> - file { '/etc/sahara/sahara-api.conf': - ensure => file, - path => '/etc/init/sahara-api.conf', - content => template('sahara/sahara-api.conf.erb'), - mode => '0750', - owner => 'root', - group => 'root', - notify => Service['sahara-api'], - } - } elsif $::osfamily == 'Redhat' { - file { '/etc/init.d/sahara-api': - ensure => file, - path => '/etc/init.d/sahara-api', - content => template('sahara/sahara-api-redhat.erb'), - mode => '0750', - owner => 'root', - group => 'root', - } -> - file { '/etc/sahara/sahara-api.conf': - ensure => file, - path => '/etc/init/sahara-api.conf', - content => template('sahara/sahara-api.conf.erb'), - mode => '0750', - owner => 'root', - group => 'root', - notify => Service['sahara-api'], - } -> - file { '/var/run/sahara': - ensure => 'directory', - owner => 'sahara', - group => 'root', - mode => '0750', - } - } else { - error('Sahara cannot be installed on this operating system. - It does not have the supported initscripts. There is only - support for Debian and Red Hat-based systems.') - } - - info('Creating database schema, latest version') - exec { 'sahara-db-manage': - command => '/usr/bin/sahara-db-manage upgrade head' - } -} \ No newline at end of file diff --git a/sahara/manifests/keystone/auth.pp b/sahara/manifests/keystone/auth.pp index 03d5e6e73..0ecee4b7e 100644 --- a/sahara/manifests/keystone/auth.pp +++ b/sahara/manifests/keystone/auth.pp @@ -1,73 +1,125 @@ -# Copyright 2013 Zuercher Hochschule fuer Angewandte Wissenschaften -# All Rights Reserved. +# == Class: sahara::keystone::auth # -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at +# Configures sahara service and endpoint in Keystone. # -# http://www.apache.org/licenses/LICENSE-2.0 +# === Parameters # -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - +# [*password*] +# (required) Password for Sahara user. # -# Used to setup the sahara keystone user +# [*service_name*] +# (Optional) Name of the service. +# Defaults to the value of auth_name. # +# [*auth_name*] +# (Optional) Username for sahara service. +# Defaults to 'sahara'. +# +# [*email*] +# (Optional) Email for Sahara user. +# Defaults to 'sahara@localhost'. +# +# [*tenant*] +# (Optional) Tenant for Sahara user. +# Defaults to 'services'. +# +# [*configure_endpoint*] +# (Optional) Should Sahara endpoint be configured? +# Defaults to 'true'. +# +# [*service_type*] +# (Optional) Type of service. +# Defaults to 'data_processing'. +# +# [*service_description*] +# (Optional) Description of service. +# Defaults to 'Sahara Data Processing'. +# +# [*region*] +# (Optional) Region for endpoint. +# Defaults to 'RegionOne'. +# +# [*public_protocol*] +# (Optional) Protocol for public endpoint. +# Defaults to 'http'. +# +# [*admin_protocol*] +# (Optional) Protocol for admin endpoint. +# Defaults to 'http'. +# +# [*internal_protocol*] +# (Optional) Protocol for internal endpoint. +# Defaults to 'http'. +# +# [*public_address*] +# (Optional) Public address for endpoint. +# Defaults to '127.0.0.1'. +# +# [*admin_address*] +# (Optional) Admin address for endpoint. +# Defaults to '127.0.0.1'. +# +# [*internal_address*] +# (Optional) Internal address for endpoint. +# Defaults to '127.0.0.1'. +# +# [*port*] +# (Optional) Port for endpoint. +# Defaults to '8386'. +# +# [*public_port*] +# Port for public endpoint. Defaults to $port. +# +# [*version*] +# (Optional) Version of API to use. +# Defaults to 'v1.1'. +# +class sahara::keystone::auth( + $password, + $service_name = undef, + $auth_name = 'sahara', + $email = 'sahara@localhost', + $tenant = 'services', + $service_type = 'data_processing', + $service_description = 'Sahara Data Processing', + $configure_endpoint = true, + $region = 'RegionOne', + $public_protocol = 'http', + $admin_protocol = 'http', + $internal_protocol = 'http', + $public_address = '127.0.0.1', + $admin_address = '127.0.0.1', + $internal_address = '127.0.0.1', + $port = '8386', + $public_port = undef, + $version = 'v1.1', +) { -class sahara::keystone::auth ( - $password = 'sahara', - $auth_name = 'sahara', - $email = 'sahara@localhost', - $tenant = 'services', - $configure_endpoint = true, - $service_type = 'data_processing', - $public_address = '127.0.0.1', - $admin_address = '127.0.0.1', - $internal_address = '127.0.0.1', - $port = '8386', - $public_port = undef, - $region = 'RegionOne', - $public_protocol = 'http', - $internal_protocol = 'http', - ) { - - Keystone_user_role["${auth_name}@${tenant}"] ~> - Service <| name == 'sahara-api' |> + if $service_name == undef { + $real_service_name = $auth_name + } else { + $real_service_name = $service_name + } - if !$public_port { + if ! $public_port { $real_public_port = $port } else { $real_public_port = $public_port } - keystone_user { $auth_name: - ensure => present, - password => $password, - email => $email, - tenant => $tenant, - } - - keystone_user_role { "${auth_name}@${tenant}": - ensure => present, - roles => 'admin', - } - - keystone_service { $auth_name: - ensure => present, - type => $service_type, - description => 'Openstack Data Processing', - } - if $configure_endpoint { - keystone_endpoint { "${region}/${auth_name}": - ensure => present, - public_url => - "${public_protocol}://${public_address}:${real_public_port}/", - internal_url => "${internal_protocol}://${internal_address}:${port}/", - admin_url => "${internal_protocol}://${admin_address}:${port}/", - } + keystone::resource::service_identity { $real_service_name: + configure_user => true, + configure_user_role => true, + configure_endpoint => $configure_endpoint, + service_type => $service_type, + service_description => $service_description, + region => $region, + password => $password, + email => $email, + tenant => $tenant, + public_url => "${public_protocol}://${public_address}:${real_public_port}/${version}/%(tenant_id)s", + admin_url => "${admin_protocol}://${admin_address}:${port}/${version}/%(tenant_id)s", + internal_url => "${internal_protocol}://${internal_address}:${port}/${version}/%(tenant_id)s", } -} \ No newline at end of file +} diff --git a/sahara/manifests/notify/qpid.pp b/sahara/manifests/notify/qpid.pp new file mode 100644 index 000000000..36c04cc2c --- /dev/null +++ b/sahara/manifests/notify/qpid.pp @@ -0,0 +1,143 @@ +# == Class: sahara::notify::qpid +# +# Qpid broker configuration for Sahara +# +# === Parameters +# +# [*durable_queues*] +# (Optional) Use durable queues in broker. +# Defaults to false. +# +# [*qpid_hostname*] +# (Optional) IP or hostname of the qpid server. +# Defaults to '127.0.0.1'. +# +# [*qpid_port*] +# (Optional) Port of the qpid server. +# Defaults to 5672. +# +# [*qpid_username*] +# (Optional) User to connect to the qpid server. +# Defaults to 'guest'. +# +# [*qpid_password*] +# (Optional) Password to connect to the qpid server. +# Defaults to 'guest'. +# +# [*qpid_sasl_mechanisms*] +# (Optional) String of SASL mechanisms to use. +# Defaults to ''. +# +# [*qpid_heartbeat*] +# (Optional) Seconds between connection keepalive heartbeats. +# Defaults to 60. +# +# [*qpid_protocol*] +# (Optional) Protocol to use for qpid (tcp/ssl). +# Defaults to tcp. +# +# [*qpid_tcp_nodelay*] +# (Optional) Whether to disable the Nagle algorithm. +# Defaults to true. +# +# [*qpid_receiver_capacity*] +# (Optional) Number of prefetched messages to hold. +# Defaults to 1. +# +# [*qpid_topology_version*] +# (Optional) Version of qpid toplogy to use. +# Defaults to 2. +# +# [*notification_topics*] +# (Optional) Topic to use for notifications. +# Defaults to 'notifications'. +# +# [*control_exchange*] +# (Optional) The default exchange to scope topics. +# Defaults to 'openstack'. +# +# [*kombu_ssl_keyfile*] +# (Optional) SSL key file (valid only if SSL enabled). +# Defaults to undef. +# +# [*kombu_ssl_certfile*] +# (Optional) SSL cert file (valid only if SSL enabled). +# Defaults to undef. +# +# [*kombu_ssl_ca_certs*] +# (optional) SSL certification authority file (valid only if SSL enabled). +# Defaults to undef. +# +# [*kombu_reconnect_delay*] +# (Optional) Backoff on cancel notification (valid only if SSL enabled). +# Defaults to '1.0'; floating-point value. +# +class sahara::notify::qpid( + $durable_queues = false, + $qpid_hostname = 'localhost', + $qpid_port = 5672, + $qpid_username = 'guest', + $qpid_password = 'guest', + $qpid_sasl_mechanisms = '', + $qpid_heartbeat = 60, + $qpid_protocol = 'tcp', + $qpid_tcp_nodelay = true, + $qpid_receiver_capacity = 1, + $qpid_topology_version = 2, + $notification_topics = 'notifications', + $control_exchange = 'openstack', + $kombu_ssl_keyfile = undef, + $kombu_ssl_certfile = undef, + $kombu_ssl_ca_certs = undef, + $kombu_reconnect_delay = '1.0', +) { + if $qpid_protocol == 'ssl' { + if !$kombu_ssl_keyfile { + fail('kombu_ssl_keyfile must be set when using SSL in qpid') + } + if !$kombu_ssl_certfile { + fail('kombu_ssl_certfile must be set when using SSL in qpid') + } + if !$kombu_ssl_ca_certs { + fail('kombu_ca_certs must be set when using SSL in qpid') + } + sahara_config { + 'DEFAULT/kombu_ssl_version': value => 'TLSv1'; + 'DEFAULT/kombu_ssl_keyfile': value => $kombu_ssl_keyfile; + 'DEFAULT/kombu_ssl_certfile': value => $kombu_ssl_certfile; + 'DEFAULT/kombu_ssl_ca_certs': value => $kombu_ssl_ca_certs; + 'DEFAULT/kombu_reconnect_delay': value => $kombu_reconnect_delay; + } + } elsif $qpid_protocol == 'tcp' { + sahara_config { + 'DEFAULT/kombu_ssl_version': ensure => absent; + 'DEFAULT/kombu_ssl_keyfile': ensure => absent; + 'DEFAULT/kombu_ssl_certfile': ensure => absent; + 'DEFAULT/kombu_ssl_ca_certs': ensure => absent; + 'DEFAULT/kombu_reconnect_delay': ensure => absent; + } + } else { + fail("valid qpid_protocol settings are 'tcp' and 'ssl' only") + } + + sahara_config { + 'DEFAULT/rpc_backend': value => 'qpid'; + 'DEFAULT/qpid_hosts': value => '$qpid_hostname:$qpid_port'; + + 'DEFAULT/amqp_durable_queues': value => $durable_queues; + 'DEFAULT/qpid_hostname': value => $qpid_hostname; + 'DEFAULT/qpid_port': value => $qpid_port; + 'DEFAULT/qpid_username': value => $qpid_username; + 'DEFAULT/qpid_password': + value => $qpid_password, + secret => true; + 'DEFAULT/qpid_sasl_mechanisms': value => $qpid_sasl_mechanisms; + 'DEFAULT/qpid_heartbeat': value => $qpid_heartbeat; + 'DEFAULT/qpid_protocol': value => $qpid_protocol; + 'DEFAULT/qpid_tcp_nodelay': value => $qpid_tcp_nodelay; + 'DEFAULT/qpid_receiver_capacity': value => $qpid_receiver_capacity; + 'DEFAULT/qpid_topology_version': value => $qpid_topology_version; + 'DEFAULT/notification_topics': value => $notification_topics; + 'DEFAULT/control_exchange': value => $control_exchange; + } +} diff --git a/sahara/manifests/notify/rabbitmq.pp b/sahara/manifests/notify/rabbitmq.pp new file mode 100644 index 000000000..dda9fdd95 --- /dev/null +++ b/sahara/manifests/notify/rabbitmq.pp @@ -0,0 +1,158 @@ +# == Class: sahara::notify::rabbitmq +# +# RabbitMQ broker configuration for Sahara +# +# === Parameters +# +# [*durable_queues*] +# (Optional) Use durable queues in broker. +# Defaults to false. +# +# [*rabbit_host*] +# (Optional) IP or hostname of the rabbit server. +# Defaults to '127.0.0.1'. +# +# [*rabbit_port*] +# (Optional) Port of the rabbit server. +# Defaults to 5672. +# +# [*rabbit_hosts*] +# (Optional) IP or hostname of the rabbits servers. +# comma separated array (ex: ['1.0.0.10:5672','1.0.0.11:5672']) +# Defaults to false. +# +# [*rabbit_use_ssl*] +# (Optional) Connect over SSL for RabbitMQ. +# Defaults to false. +# +# [*rabbit_userid*] +# (Optional) User to connect to the rabbit server. +# Defaults to 'guest'. +# +# [*rabbit_password*] +# (Optional) Password to connect to the rabbit server. +# Defaults to 'guest'. +# +# [*rabbit_login_method*] +# (Optional) Method to auth with the rabbit server. +# Defaults to 'AMQPLAIN'. +# +# [*rabbit_virtual_host*] +# (Optional) Virtual host to use. +# Defaults to '/'. +# +# [*rabbit_retry_interval*] +# (Optional) Reconnection attempt frequency for rabbit. +# Defaults to 1. +# +# [*rabbit_retry_backoff*] +# (Optional) Backoff between reconnection attempts for rabbit. +# Defaults to 2. +# +# [*rabbit_max_retries*] +# (Optional) Number of times to retry (0 == no limit). +# Defaults to 0. +# +# [*notification_topics*] +# (Optional) Topic to use for notifications. +# Defaults to 'notifications'. +# +# [*control_exchange*] +# (Optional) The default exchange to scope topics. +# Defaults to 'openstack'. +# +# [*kombu_ssl_keyfile*] +# (Optional) SSL key file (valid only if SSL enabled). +# Defaults to undef. +# +# [*kombu_ssl_certfile*] +# (Optional) SSL cert file (valid only if SSL enabled). +# Defaults to undef. +# +# [*kombu_ssl_ca_certs*] +# (Optional) SSL certification authority file (valid only if SSL enabled). +# Defaults to undef +# +# [*kombu_reconnect_delay*] +# (Optional) Backoff on cancel notification (valid only if SSL enabled). +# Defaults to '1.0'; floating-point value. +# +class sahara::notify::rabbitmq( + $durable_queues = false, + $rabbit_host = 'localhost', + $rabbit_hosts = false, + $rabbit_port = 5672, + $rabbit_use_ssl = false, + $rabbit_userid = 'guest', + $rabbit_password = 'guest', + $rabbit_login_method = 'AMQPLAIN', + $rabbit_virtual_host = '/', + $rabbit_retry_interval = 1, + $rabbit_retry_backoff = 2, + $rabbit_max_retries = 0, + $notification_topics = 'notifications', + $control_exchange = 'openstack', + $kombu_ssl_keyfile = undef, + $kombu_ssl_certfile = undef, + $kombu_ssl_ca_certs = undef, + $kombu_reconnect_delay = '1.0', +) { + if $rabbit_use_ssl { + if !$kombu_ssl_keyfile { + fail('kombu_ssl_keyfile must be set when using SSL in rabbit') + } + if !$kombu_ssl_certfile { + fail('kombu_ssl_certfile must be set when using SSL in rabbit') + } + if !$kombu_ssl_ca_certs { + fail('kombu_ssl_ca_certs must be set when using SSL in rabbit') + } + sahara_config { + 'DEFAULT/kombu_ssl_version': value => 'TLSv1'; + 'DEFAULT/kombu_ssl_keyfile': value => $kombu_ssl_keyfile; + 'DEFAULT/kombu_ssl_certfile': value => $kombu_ssl_certfile; + 'DEFAULT/kombu_ssl_ca_certs': value => $kombu_ssl_ca_certs; + 'DEFAULT/kombu_reconnect_delay': value => $kombu_reconnect_delay; + } + } else { + sahara_config { + 'DEFAULT/kombu_ssl_version': ensure => absent; + 'DEFAULT/kombu_ssl_keyfile': ensure => absent; + 'DEFAULT/kombu_ssl_certfile': ensure => absent; + 'DEFAULT/kombu_ssl_ca_certs': ensure => absent; + 'DEFAULT/kombu_reconnect_delay': ensure => absent; + } + } + + if $rabbit_hosts { + sahara_config { + 'DEFAULT/rabbit_hosts': value => join($rabbit_hosts, ','); + 'DEFAULT/rabbit_ha_queues': value => true + } + } else { + sahara_config { + 'DEFAULT/rabbit_host': value => $rabbit_host; + 'DEFAULT/rabbit_port': value => $rabbit_port; + 'DEFAULT/rabbit_ha_queues': value => false; + # single-quotes to get literal dollar signs + 'DEFAULT/rabbit_hosts': value => '$rabbit_host:$rabbit_port'; + } + } + + sahara_config { + 'DEFAULT/rpc_backend': value => 'rabbit'; + 'DEFAULT/amqp_durable_queues': value => $durable_queues; + 'DEFAULT/rabbit_use_ssl': value => $rabbit_use_ssl; + 'DEFAULT/rabbit_userid': value => $rabbit_userid; + 'DEFAULT/rabbit_password': + value => $rabbit_password, + secret => true; + 'DEFAULT/rabbit_login_method': value => $rabbit_login_method; + 'DEFAULT/rabbit_virtual_host': value => $rabbit_virtual_host; + 'DEFAULT/rabbit_retry_interval': value => $rabbit_retry_interval; + 'DEFAULT/rabbit_retry_backoff': value => $rabbit_retry_backoff; + 'DEFAULT/rabbit_max_retries': value => $rabbit_max_retries; + 'DEFAULT/notification_topics': value => $notification_topics; + 'DEFAULT/control_exchange': value => $control_exchange; + } +} diff --git a/sahara/manifests/notify/zeromq.pp b/sahara/manifests/notify/zeromq.pp new file mode 100644 index 000000000..505ebc87c --- /dev/null +++ b/sahara/manifests/notify/zeromq.pp @@ -0,0 +1,101 @@ +# == Class: sahara::notify::zeromq +# +# Zeromq broker configuration for Sahara +# +# === Parameters +# +# [*zeromq_bind_address*] +# (Optional) Bind address; wildcard, ethernet, or ip address. +# Defaults to '*'. +# +# [*zeromq_port*] +# (Optional) Receiver listening port. +# Defaults to 9501. +# +# [*zeromq_contexts*] +# (Optional) Number of contexsts for zeromq. +# Defaults to 1. +# +# [*zeromq_topic_backlog*] +# (Optional) Number of incoming messages to buffer. +# Defaults to 'None'. +# +# [*zeromq_ipc_dir*] +# (Optional) Directory for zeromq IPC. +# Defaults to '/var/run/openstack'. +# +# [*zeromq_host*] +# (Optional) Name of the current node: hostname, FQDN, or IP. +# Defaults to 'sahara'. +# +# [*cast_timeout*] +# (Optional) TTL for zeromq messages. +# Defaults to 30. +# +# [*kombu_ssl_keyfile*] +# (Optional) SSL key file (valid only if SSL enabled). +# Defaults to undef. +# +# [*kombu_ssl_certfile*] +# (Optional) SSL cert file (valid only if SSL enabled). +# Defaults to undef. +# +# [*kombu_ssl_ca_certs*] +# (optional) SSL certification authority file (valid only if SSL enabled). +# Defaults to undef. +# +# [*kombu_reconnect_delay*] +# (Optional) Backoff on cancel notification (valid only if SSL enabled). +# Defaults to '1.0'; floating-point value. +# +class sahara::notify::zeromq( + $zeromq_bind_address = '*', + $zeromq_port = 9501, + $zeromq_contexts = 1, + $zeromq_topic_backlog = 'None', + $zeromq_ipc_dir = '/var/run/openstack', + $zeromq_host = 'sahara', + $cast_timeout = 30, + $kombu_ssl_keyfile = undef, + $kombu_ssl_certfile = undef, + $kombu_ssl_ca_certs = undef, + $kombu_reconnect_delay = '1.0', +) { + if $kombu_ssl_keyfile or $kombu_ssl_certfile or $kombu_ssl_ca_certs { + if !$kombu_ssl_keyfile { + fail('kombu_ssl_keyfile must be set when using SSL in zeromq') + } + if !$kombu_ssl_certfile { + fail('kombu_ssl_certfile must be set when using SSL in zeromq') + } + if !$kombu_ssl_ca_certs { + fail('kombu_ca_certs must be set when using SSL in zeromq') + } + sahara_config { + 'DEFAULT/kombu_ssl_version': value => 'TLSv1'; + 'DEFAULT/kombu_ssl_keyfile': value => $kombu_ssl_keyfile; + 'DEFAULT/kombu_ssl_certfile': value => $kombu_ssl_certfile; + 'DEFAULT/kombu_ssl_ca_certs': value => $kombu_ssl_ca_certs; + 'DEFAULT/kombu_reconnect_delay': value => $kombu_reconnect_delay; + } + } else { + sahara_config { + 'DEFAULT/kombu_ssl_version': ensure => absent; + 'DEFAULT/kombu_ssl_keyfile': ensure => absent; + 'DEFAULT/kombu_ssl_certfile': ensure => absent; + 'DEFAULT/kombu_ssl_ca_certs': ensure => absent; + 'DEFAULT/kombu_reconnect_delay': ensure => absent; + } + } + + sahara_config { + 'DEFAULT/rpc_backend': value => 'zmq'; + 'DEFAULT/rpc_zmq_bind_address': value => $zeromq_bind_address; + 'DEFAULT/rpc_zmq_port': value => $zeromq_port; + 'DEFAULT/rpc_zmq_contexts': value => $zeromq_contexts; + 'DEFAULT/rpc_zmq_topic_backlog': value => $zeromq_topic_backlog; + 'DEFAULT/rpc_zmq_ipc_dir': value => $zeromq_ipc_dir; + 'DEFAULT/rpc_zmq_host': value => $zeromq_host; + 'DEFAULT/rpc_cast_timeout': value => $cast_timeout; + } +} diff --git a/sahara/manifests/params.pp b/sahara/manifests/params.pp index 13d622b88..5ab3f87ab 100644 --- a/sahara/manifests/params.pp +++ b/sahara/manifests/params.pp @@ -1,42 +1,31 @@ -# Copyright 2013 Zuercher Hochschule fuer Angewandte Wissenschaften -# All Rights Reserved. +# == Class: sahara::params # -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at +# Parameters for puppet-sahara # -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - class sahara::params { - $sys_rundir = '/var/run' - $sahara_service = 'sahara-api' - $sahara_logdir = '/var/log/sahara' - $sahara_rundir = '/var/run/sahara' - $sahara_lockdir = '/var/lock/sahara' - $sahara_conf_file = '/etc/sahara/sahara.conf' - $sahara_syslog = false - $sahara_usefips = false - $sahara_node_domain = 'novalocal' - # installs source version from github builds - $development = false - $development_build_url = - 'http://tarballs.openstack.org/sahara/sahara-master.tar.gz' - $development_dashboard_build_url = - 'http://tarballs.openstack.org/sahara-dashboard/sahara-dashboard-master.tar.gz' - - $rpm_install = false - $rpm_package_name_service = 'openstack-sahara' - $rpm_package_name_dashboard = 'python-django-sahara' + $dbmanage_command = 'sahara-db-manage --config-file /etc/sahara/sahara.conf upgrade head' + $client_package_name = 'python-saharaclient' - # these two paths are OS specific - on redhat they're diff - $horizon_settings = - '/usr/share/openstack-dashboard/openstack_dashboard/settings.py' - $horizon_local_settings = - '/usr/share/openstack-dashboard/openstack_dashboard/local/local_settings.py' + case $::osfamily { + 'RedHat': { + $package_name = 'openstack-sahara' + $service_name = 'openstack-sahara-all' + } + 'Debian': { + case $::operatingsystem { + 'Debian': { + $package_name = 'sahara' + $service_name = 'sahara' + } + default: { + fail('While Sahara is packaged in Debian, it is not packaged in \ + Ubuntu or any derivatives (yet). If you would like to package \ + Sahara for this system, please contact the Sahara team.') + } + } + } + default: { + fail("Unsupported osfamily: ${::osfamily} operatingsystem: ${::operatingsystem}") + } + } } diff --git a/sahara/manifests/service.pp b/sahara/manifests/service.pp deleted file mode 100644 index 92f7ae2d2..000000000 --- a/sahara/manifests/service.pp +++ /dev/null @@ -1,23 +0,0 @@ -# Copyright 2013 Zuercher Hochschule fuer Angewandte Wissenschaften -# All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -class sahara::service ($enable = true,) { - service { 'sahara-api': - ensure => running, - enable => $enable, - hasrestart => true, - hasstatus => true, - } -} diff --git a/sahara/metadata.json b/sahara/metadata.json index 58a3564b9..ebbfacf0e 100644 --- a/sahara/metadata.json +++ b/sahara/metadata.json @@ -1,33 +1,37 @@ { "name": "stackforge-sahara", - "version": "4.0.0", - "author": "StackForge Contributors", + "version": "5.0.0", + "author": "Red Hat and StackForge Contributors", "summary": "Puppet module for OpenStack Sahara", "license": "Apache License 2.0", - "source": "git://github.com/stackforge/puppet-sahara.git", - "project_page": "https://launchpad.net/puppet-sahara", - "issues_url": "https://bugs.launchpad.net/puppet-sahara", + "source": "git://github.com/frozencemetery/puppet-sahara.git", + "project_page": "https://github.com/frozencemetery/puppet-sahara", + "issues_url": "https://github.com/frozencemetery/puppet-sahara/issues", "requirements": [ - { "name": "pe","version_requirement": "3.2.x" }, + { "name": "pe","version_requirement": "3.x" }, { "name": "puppet","version_requirement": "3.x" } ], "operatingsystem_support": [ { - "operatingsystem": "Debian", - "operatingsystemrelease": ["7"] + "operatingsystem": "Fedora", + "operatingsystemrelease": ["20"] }, { "operatingsystem": "RedHat", - "operatingsystemrelease": ["6","7"] + "operatingsystemrelease": ["7"] }, { - "operatingsystem": "Ubuntu", - "operatingsystemrelease": ["14.04"] + "operatingsystem": "Debian", + "operatingsystemrelease": ["8"] } ], - "description": "Installs and configures OpenStack Sahara (Data Processing).", + "description": "Installs and configures OpenStack Sahara (Hadoop).", "dependencies": [ + { "name": "duritong/sysctl", "version_requirement": ">=0.0.1 <1.0.0" }, + { "name": "stackforge/keystone", "version_requirement": ">=5.0.0 <6.0.0" }, + { "name": "puppetlabs/inifile", "version_requirement": ">=5.0.0 <6.0.0" }, { "name": "puppetlabs/stdlib", "version_requirement": ">=4.0.0 <5.0.0" }, + { "name": "puppetlabs/postgresql", "version_requirement": ">=3.0.0" }, { "name": "stackforge/openstacklib", "version_requirement": ">=5.0.0" } ] } diff --git a/sahara/spec/spec_helper.rb b/sahara/spec/spec_helper.rb index 33926ec44..bb959e485 100644 --- a/sahara/spec/spec_helper.rb +++ b/sahara/spec/spec_helper.rb @@ -1,20 +1,5 @@ -# Copyright 2013 Zürcher Hochschule für Angewandte Wissenschaften -# All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. -# - require 'puppetlabs_spec_helper/module_spec_helper' +require 'shared_examples' RSpec.configure do |c| c.alias_it_should_behave_like_to :it_configures, 'configures' diff --git a/sahara/templates/sahara-api-redhat.erb b/sahara/templates/sahara-api-redhat.erb deleted file mode 100644 index b2e7831d4..000000000 --- a/sahara/templates/sahara-api-redhat.erb +++ /dev/null @@ -1,102 +0,0 @@ -#!/bin/sh -# -# sahara-api OpenStack Hadoop Cluster API -# -# chkconfig: - 99 02 -# description: OpenStack Hadoop Cluster Management API service - -### BEGIN INIT INFO -# Provides: -# Required-Start: $remote_fs $network $syslog -# Required-Stop: $remote_fs $syslog -# Default-Stop: 0 1 6 -# Short-Description: Sahara API server -# Description: OpenStack Hadoop Cluster Management API service -### END INIT INFO - -. /etc/rc.d/init.d/functions - -suffix=api -prog=sahara-$suffix -config="/etc/sahara/sahara.conf" -exec="/usr/bin/sahara-$suffix" -pidfile="/var/run/sahara/sahara-$suffix.pid" -user=sahara - -[ -e /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog - -lockfile=/var/lock/subsys/$prog - -start() { - [ -x $exec ] || exit 5 - [ -f $config ] || exit 6 - echo -n $"Starting $prog: " - daemon --user $user --pidfile $pidfile "$exec -d &>/dev/null & echo \$! > $pidfile" - retval=$? - echo - [ $retval -eq 0 ] && touch $lockfile - return $retval -} - -stop() { - echo -n $"Stopping $prog: " - killproc -p $pidfile $prog - retval=$? - echo - [ $retval -eq 0 ] && rm -f $lockfile - return $retval -} - -restart() { - stop - start -} - -reload() { - restart -} - -force_reload() { - restart -} - -rh_status() { - status $prog -} - -rh_status_q() { - rh_status >/dev/null 2>&1 -} - - -case "$1" in - start) - rh_status_q && exit 0 - $1 - ;; - stop) - rh_status_q || exit 0 - $1 - ;; - restart) - $1 - ;; - reload) - rh_status_q || exit 7 - $1 - ;; - force-reload) - force_reload - ;; - status) - rh_status - ;; - condrestart|try-restart) - rh_status_q || exit 0 - restart - ;; - *) - echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}" - exit 2 -esac -exit $? \ No newline at end of file diff --git a/sahara/templates/sahara-api.conf.erb b/sahara/templates/sahara-api.conf.erb deleted file mode 100644 index f14fb7a29..000000000 --- a/sahara/templates/sahara-api.conf.erb +++ /dev/null @@ -1,18 +0,0 @@ -description "Sahara API Server upstart job" -author "Andy Edmonds " - -start on runlevel [2345] -stop on runlevel [!2345] - - -chdir <%= scope.lookupvar("sahara::params::sys_rundir") %> - -pre-start script - mkdir -p <%= scope.lookupvar("sahara::params::sahara_rundir") %> - chown sahara:root <%= scope.lookupvar("sahara::params::sahara_rundir") %> - - mkdir -p <%= scope.lookupvar("sahara::params::sahara_lockdir") %> - chown sahara:root <%= scope.lookupvar("sahara::params::sahara_lockdir") %> -end script - -exec start-stop-daemon --start --chuid sahara --exec /usr/local/bin/<%= scope.lookupvar("sahara::params::sahara_service") %> -- --config-file=<%= scope.lookupvar("sahara::params::sahara_conf_file") %> \ No newline at end of file diff --git a/sahara/templates/sahara-api.erb b/sahara/templates/sahara-api.erb deleted file mode 100644 index 00935f338..000000000 --- a/sahara/templates/sahara-api.erb +++ /dev/null @@ -1,119 +0,0 @@ -#!/bin/sh -e -# upstart-job -# -# Symlink target for initscripts that have been converted to Upstart. - -set -e - -UPSTART_JOB_CONF="/etc/default/upstart-job" -INITSCRIPT="$(basename "$0")" -JOB="${INITSCRIPT%.sh}" - -if [ "$JOB" = "upstart-job" ]; then - if [ -z "$1" ]; then - echo "Usage: upstart-job JOB COMMAND" 1>&2 - exit 1 - fi - - JOB="$1" - INITSCRIPT="$1" - shift -else - if [ -z "$1" ]; then - echo "Usage: $0 COMMAND" 1>&2 - exit 1 - fi -fi - -COMMAND="$1" -shift - -ECHO=echo -ECHO_ERROR=echo -if [ -e "$UPSTART_JOB_CONF" ]; then - . "$UPSTART_JOB_CONF" -fi -if [ -n "$DPKG_MAINTSCRIPT_PACKAGE" ]; then - ECHO=: - ECHO_ERROR=: -fi - -$ECHO "Rather than invoking init scripts through /etc/init.d, use the service(8)" -$ECHO "utility, e.g. service $INITSCRIPT $COMMAND" - -# Only check if jobs are disabled if the currently _running_ version of -# Upstart (which may be older than the latest _installed_ version) -# supports such a query. -# -# This check is necessary to handle the scenario when upgrading from a -# release without the 'show-config' command (introduced in -# Upstart for Ubuntu version 0.9.7) since without this check, all -# installed packages with associated Upstart jobs would be considered -# disabled. -# -# Once Upstart can maintain state on re-exec, this change can be -# dropped (since the currently running version of Upstart will always -# match the latest installed version). - -UPSTART_VERSION_RUNNING=$(initctl version|awk '{print $3}'|tr -d ')') - -if dpkg --compare-versions "$UPSTART_VERSION_RUNNING" ge 0.9.7 -then - initctl show-config -e "$JOB"|grep -q '^ start on' || DISABLED=1 -fi - -case $COMMAND in -status) - $ECHO - $ECHO "Since the script you are attempting to invoke has been converted to an" - $ECHO "Upstart job, you may also use the $COMMAND(8) utility, e.g. $COMMAND $JOB" - $COMMAND "$JOB" - ;; -start|stop) - $ECHO - $ECHO "Since the script you are attempting to invoke has been converted to an" - $ECHO "Upstart job, you may also use the $COMMAND(8) utility, e.g. $COMMAND $JOB" - if status "$JOB" 2>/dev/null | grep -q ' start/'; then - RUNNING=1 - fi - if [ -z "$RUNNING" ] && [ "$COMMAND" = "stop" ]; then - exit 0 - elif [ -n "$RUNNING" ] && [ "$COMMAND" = "start" ]; then - exit 0 - elif [ -n "$DISABLED" ] && [ "$COMMAND" = "start" ]; then - exit 0 - fi - $COMMAND "$JOB" - ;; -restart) - $ECHO - $ECHO "Since the script you are attempting to invoke has been converted to an" - $ECHO "Upstart job, you may also use the stop(8) and then start(8) utilities," - $ECHO "e.g. stop $JOB ; start $JOB. The restart(8) utility is also available." - if status "$JOB" 2>/dev/null | grep -q ' start/'; then - RUNNING=1 - fi - if [ -n "$RUNNING" ] ; then - stop "$JOB" - fi - # If the job is disabled and is not currently running, the job is - # not restarted. However, if the job is disabled but has been forced into the - # running state, we *do* stop and restart it since this is expected behaviour - # for the admin who forced the start. - if [ -n "$DISABLED" ] && [ -z "$RUNNING" ]; then - exit 0 - fi - start "$JOB" - ;; -reload|force-reload) - $ECHO - $ECHO "Since the script you are attempting to invoke has been converted to an" - $ECHO "Upstart job, you may also use the reload(8) utility, e.g. reload $JOB" - reload "$JOB" - ;; -*) - $ECHO_ERROR - $ECHO_ERROR "The script you are attempting to invoke has been converted to an Upstart" 1>&2 - $ECHO_ERROR "job, but $COMMAND is not supported for Upstart jobs." 1>&2 - exit 1 -esac diff --git a/sahara/templates/sahara.conf.erb b/sahara/templates/sahara.conf.erb deleted file mode 100644 index 73f4e82da..000000000 --- a/sahara/templates/sahara.conf.erb +++ /dev/null @@ -1,267 +0,0 @@ -[DEFAULT] - -# -# Options defined in sahara.config -# - -# set host (string value) -host=<%= @sahara_host %> - -# set port (integer value) -port=<%= @sahara_port %> - - -# -# Options defined in sahara.main -# - -# Protocol used to access OpenStack Identity service (string -# value) -os_auth_protocol=<%= @keystone_auth_protocol %> - -# IP or hostname of machine on which OpenStack Identity -# service is located (string value) -os_auth_host=<%= @keystone_auth_host %> - -# Port of OpenStack Identity service (string value) -os_auth_port=<%= @keystone_auth_port %> - -# This OpenStack user is used to verify provided tokens. The -# user must have admin role in tenant -# (string value) -os_admin_username=<%= @keystone_user %> - -# Password of the admin user (string value) -os_admin_password=<%= @keystone_password %> - -# Name of tenant where the user is admin (string value) - -os_admin_tenant_name=<%= scope.lookupvar("sahara::keystone::auth::tenant") %> - - -# -# Options defined in sahara.openstack.common.db.sqlalchemy.session -# - -# the filename to use with sqlite (string value) -#sqlite_db=sahara.sqlite - -# If true, use synchronous mode for sqlite (boolean value) -#sqlite_synchronous=true - - -# -# Options defined in sahara.openstack.common.lockutils -# - -# Whether to disable inter-process locks (boolean value) -#disable_process_locking=false - -# Directory to use for lock files. Default to a temp directory -# (string value) -lock_path=<%= scope.lookupvar("sahara::params::sahara_lockdir") %> - - -# -# Options defined in sahara.openstack.common.log -# - -# Print debugging output (set logging level to DEBUG instead -# of default WARNING level). (boolean value) -debug=<%= @sahara_debug %> - -# Print more verbose output (set logging level to INFO instead -# of default WARNING level). (boolean value) -verbose=<%= @sahara_verbose %> - -# Log output to standard error (boolean value) -#use_stderr=true - -# format string to use for log messages with context (string -# value) -#logging_context_format_string=%(asctime)s.%(msecs)03d %(process)d %(levelname)s %(name)s [%(request_id)s %(user)s %(tenant)s] %(instance)s%(message)s - -# format string to use for log messages without context -# (string value) -#logging_default_format_string=%(asctime)s.%(msecs)03d %(process)d %(levelname)s %(name)s [-] %(instance)s%(message)s - -# data to append to log format when level is DEBUG (string -# value) -#logging_debug_format_suffix=%(funcName)s %(pathname)s:%(lineno)d - -# prefix each line of exception output with this format -# (string value) -#logging_exception_prefix=%(asctime)s.%(msecs)03d %(process)d TRACE %(name)s %(instance)s - -# list of logger=LEVEL pairs (list value) -#default_log_levels=amqplib=WARN,sqlalchemy=WARN,boto=WARN,suds=INFO,keystone=INFO,eventlet.wsgi.server=WARN - -# publish error events (boolean value) -#publish_errors=false - -# make deprecations fatal (boolean value) -#fatal_deprecations=false - -# If an instance is passed with the log message, format it -# like this (string value) -#instance_format="[instance: %(uuid)s] " - -# If an instance UUID is passed with the log message, format -# it like this (string value) -#instance_uuid_format="[instance: %(uuid)s] " - -# If this option is specified, the logging configuration file -# specified is used and overrides any other logging options -# specified. Please see the Python logging module -# documentation for details on logging configuration files. -# (string value) -#log_config= - -# A logging.Formatter log message format string which may use -# any of the available logging.LogRecord attributes. This -# option is deprecated. Please use -# logging_context_format_string and -# logging_default_format_string instead. (string value) -#log_format= - -# Format string for %%(asctime)s in log records. Default: -# %(default)s (string value) -#log_date_format=%Y-%m-%d %H:%M:%S - -# (Optional) Name of log file to output to. If no default is -# set, logging will go to stdout. (string value) -log_file=<%= scope.lookupvar("sahara::params::sahara_logdir") %>/sahara.log - -# (Optional) The base directory used for relative --log-file -# paths (string value) -# log_dir=<%= scope.lookupvar("sahara::params::sahara_logdir") %> - -# Use syslog for logging. (boolean value) -use_syslog=<%= scope.lookupvar("sahara::params::sahara_syslog") %> - -# syslog facility to receive log lines (string value) -#syslog_log_facility=LOG_USER - - -# -# Options defined in sahara.openstack.common.notifier.api -# - -# Driver or drivers to handle sending notifications (multi -# valued) -#notification_driver= - -# Default notification level for outgoing notifications -# (string value) -#default_notification_level=INFO - -# Default publisher_id for outgoing notifications (string -# value) -#default_publisher_id=$host - - -# -# Options defined in sahara.plugins.base -# - -# TODO(dizz): parameterise the following! -# List of plugins to be loaded. Sahara preserves the order of -# the list when returning it. (list value) - vanilla, hdp -plugins=vanilla - -[plugin:vanilla] -plugin_class=sahara.plugins.vanilla.plugin:VanillaProvider - -#[plugin:hdp] -#plugin_class=sahara.plugins.hdp.plugin:AmbariPlugin - -# -# Options defined in sahara.service.networks -# - -# When set to false, Sahara uses only internal IP of VMs. -# When set to true, Sahara expects OpenStack to auto-assign -# floating IPs to cluster nodes. Internal IPs will be used for -# inter-cluster communication, while floating ones will be -# used by Sahara to configure nodes. Also floating IPs will -# be exposed in service URLs. (boolean value) -use_floating_ips=<%= scope.lookupvar("sahara::params::sahara_usefips") %> - -# The suffix of the node's FQDN. In nova-network that is -# dhcp_domain config parameter (string value) -node_domain=<%= scope.lookupvar("sahara::params::sahara_node_domain") %> - - -[database] - -# -# Options defined in sahara.db.migration.cli -# - -# URL to database (string value) -# connection=sqlite:////tmp/sahara-server.db -connection=mysql://<%= @sahara_db_user %>:<%= @sahara_db_password %>@<%= @db_host %>/<%= @sahara_db_name %> - - -# -# Options defined in sahara.openstack.common.db.api -# - -# The backend to use for db (string value) -#backend=sqlalchemy - -# Enable the experimental use of thread pooling for all DB API -# calls (boolean value) -#use_tpool=false - - -# -# Options defined in sahara.openstack.common.db.sqlalchemy.session -# - -# The SQLAlchemy connection string used to connect to the -# database (string value) -#connection=sqlite:////sahara/openstack/common/db/$sqlite_db - -# The SQLAlchemy connection string used to connect to the -# slave database (string value) -#slave_connection= - -# timeout before idle sql connections are reaped (integer -# value) -#idle_timeout=3600 - -# Minimum number of SQL connections to keep open in a pool -# (integer value) -#min_pool_size=1 - -# Maximum number of SQL connections to keep open in a pool -# (integer value) -#max_pool_size= - -# maximum db connection retries during startup. (setting -1 -# implies an infinite retry count) (integer value) -#max_retries=10 - -# interval between retries of opening a sql connection -# (integer value) -#retry_interval=10 - -# If set, use this value for max_overflow with sqlalchemy -# (integer value) -#max_overflow= - -# Verbosity of SQL debugging information. 0=None, -# 100=Everything (integer value) -#connection_debug=0 - -# Add python stack traces to SQL as comment strings (boolean -# value) -#connection_trace=false - -# If set, use this value for pool_timeout with sqlalchemy -# (integer value) -#pool_timeout= - - -# Total option count: 51 diff --git a/sahara/tests/init.pp b/sahara/tests/init.pp deleted file mode 100644 index ffa2c9c66..000000000 --- a/sahara/tests/init.pp +++ /dev/null @@ -1,26 +0,0 @@ -# Copyright 2013 Zürcher Hochschule für Angewandte Wissenschaften -# All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -# The baseline for module testing used by Puppet Labs is that each manifest -# should have a corresponding test manifest that declares that class or defined -# type. -# -# Tests are then run by using puppet apply --noop (to check for compilation errors -# and view a log of events) or by fully applying the test in a virtual environment -# (to compare the resulting system state to the desired state). -# -# Learn more about module testing here: http://docs.puppetlabs.com/guides/tests_smoke.html -# -include sahara