diff --git a/Gemfile b/Gemfile index 25f5ea60..80a65951 100644 --- a/Gemfile +++ b/Gemfile @@ -18,7 +18,7 @@ group :test do gem 'rspec-puppet-facts', :require => false gem 'rspec', :require => false gem 'rspec-puppet-utils', :require => false - gem 'puppet-lint-absolute_classname-check', :require => false + gem 'puppet-lint-absolute_classname-check', '~> 0.2.4', :require => false gem 'puppet-lint-leading_zero-check', :require => false gem 'puppet-lint-trailing_comma-check', :require => false gem 'puppet-lint-version_comparison-check', :require => false @@ -35,6 +35,10 @@ group :development do end group :system_tests do + #TODO: to be removed when + #https://tickets.puppetlabs.com/browse/BKR-851 is resolved. + gem 'specinfra', '= 2.59.0' + if beaker_version = ENV['BEAKER_VERSION'] gem 'beaker', *location_for(beaker_version) else diff --git a/manifests/contain.pp b/manifests/contain.pp new file mode 100644 index 00000000..f3db4f2c --- /dev/null +++ b/manifests/contain.pp @@ -0,0 +1,19 @@ +# == Class: pacemaker::contain +# +# Work around this bug https://github.com/puppetlabs/puppet/pull/2633 +# in puppet where contains cannot have a absolute class as a +# parameter. It has not been fixed for 3.6 which is tested in the CI. +# +# === Parameters +# +# [*class_name*] +# The relative name of the class to contain. +# Default to $name +define pacemaker::contain ($class_name='') { + $k = pick($class_name, $name) + validate_re($k, '^[^:][^:]', "The class name must be relative not ${k}") + include "::${k}" + # lint:ignore:relative_classname_inclusion + contain $k + # lint:endignore +} diff --git a/manifests/new.pp b/manifests/new.pp index cb7df11b..0a161a9b 100644 --- a/manifests/new.pp +++ b/manifests/new.pp @@ -102,10 +102,10 @@ class pacemaker::new ( pacemaker_provider => $pacemaker_provider, } - contain 'pacemaker::new::firewall' - contain 'pacemaker::new::install' - contain 'pacemaker::new::setup' - contain 'pacemaker::new::service' + pacemaker::contain { 'pacemaker::new::firewall': } + pacemaker::contain { 'pacemaker::new::install': } + pacemaker::contain { 'pacemaker::new::setup': } + pacemaker::contain { 'pacemaker::new::service': } Class['::pacemaker::new::firewall'] -> Class['::pacemaker::new::install'] diff --git a/manifests/new/params.pp b/manifests/new/params.pp index 1f028bd2..56f63962 100644 --- a/manifests/new/params.pp +++ b/manifests/new/params.pp @@ -24,7 +24,11 @@ class pacemaker::new::params { $log_file_path = '/var/log/cluster/corosync.log' } elsif $::osfamily == 'Debian' { $pcsd_mode = false - $package_list = ['pacemaker-mgmt', 'pacemaker', 'corosync', 'pacemaker-cli-utils', 'resource-agents', 'crmsh'] + if ($::operatingsystem == 'Ubuntu') and (versioncmp($::operatingsystemmajrelease, '16') >= 0) { + $package_list = ['dbus', 'pacemaker', 'corosync', 'pacemaker-cli-utils', 'resource-agents', 'crmsh'] + } else { + $package_list = ['pacemaker-mgmt', 'pacemaker', 'corosync', 'pacemaker-cli-utils', 'resource-agents', 'crmsh'] + } $cluster_user = 'root' $cluster_group = 'root' $log_file_path = '/var/log/corosync/corosync.log' diff --git a/manifests/new/setup.pp b/manifests/new/setup.pp index 91a014c4..0a46d0e7 100644 --- a/manifests/new/setup.pp +++ b/manifests/new/setup.pp @@ -27,7 +27,7 @@ class pacemaker::new::setup ( class { '::pacemaker::new::setup::debian' : plugin_version => $plugin_version, } - contain 'pacemaker::new::setup::debian' + pacemaker::contain { 'pacemaker::new::setup::debian': } } class { '::pacemaker::new::setup::auth_key' : @@ -36,7 +36,7 @@ class pacemaker::new::setup ( cluster_user => $cluster_user, cluster_group => $cluster_group, } - contain 'pacemaker::new::setup::auth_key' + pacemaker::contain { 'pacemaker::new::setup::auth_key': } if $pcsd_mode { class { '::pacemaker::new::setup::pcsd' : @@ -50,7 +50,7 @@ class pacemaker::new::setup ( cluster_password => $cluster_password, pcs_bin_path => $pcs_bin_path, } - contain 'pacemaker::new::setup::pcsd' + pacemaker::contain { 'pacemaker::new::setup::pcsd': } } else { class { '::pacemaker::new::setup::config' : cluster_nodes => $cluster_nodes, @@ -64,6 +64,6 @@ class pacemaker::new::setup ( cluster_log_subsys => $cluster_log_subsys, log_file_path => $log_file_path, } - contain 'pacemaker::new::setup::config' + pacemaker::contain { 'pacemaker::new::setup::config': } } } diff --git a/manifests/resource/service.pp b/manifests/resource/service.pp index 0d468af4..68942394 100644 --- a/manifests/resource/service.pp +++ b/manifests/resource/service.pp @@ -107,7 +107,10 @@ define pacemaker::resource::service( tries => $tries, try_sleep => $try_sleep, verify_on_create => $verify_on_create, + # https://github.com/voxpupuli/puppet-lint-absolute_classname-check/issues/9 + # lint:ignore:relative_classname_inclusion require => Exec['wait-for-settle'], + # lint:endignore } }) } diff --git a/metadata.json b/metadata.json index e959fcb3..e004e93e 100644 --- a/metadata.json +++ b/metadata.json @@ -16,7 +16,7 @@ }, { "operatingsystem": "Ubuntu", - "operatingsystemrelease": [ "12.04", "14.04" ] + "operatingsystemrelease": [ "12.04", "14.04", "16.04" ] } ], diff --git a/releasenotes/notes/feature_add_xenial_support-6ff98a4d9fd83e62.yaml b/releasenotes/notes/feature_add_xenial_support-6ff98a4d9fd83e62.yaml new file mode 100644 index 00000000..ef375d99 --- /dev/null +++ b/releasenotes/notes/feature_add_xenial_support-6ff98a4d9fd83e62.yaml @@ -0,0 +1,3 @@ +--- +features: + - Add Ubuntu Xenial 16.04 support for the module. diff --git a/releasenotes/source/_static/.placeholder b/releasenotes/source/_static/.placeholder new file mode 100644 index 00000000..e69de29b diff --git a/releasenotes/source/conf.py b/releasenotes/source/conf.py new file mode 100644 index 00000000..5713a5d2 --- /dev/null +++ b/releasenotes/source/conf.py @@ -0,0 +1,259 @@ +# -*- coding: utf-8 -*- +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# If extensions (or modules to document with autodoc) are in another directory, +# add these directories to sys.path here. If the directory is relative to the +# documentation root, use os.path.abspath to make it absolute, like shown here. +#sys.path.insert(0, os.path.abspath('.')) + +# -- General configuration ------------------------------------------------ + +# If your documentation needs a minimal Sphinx version, state it here. +#needs_sphinx = '1.0' + +# Add any Sphinx extension module names here, as strings. They can be +# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom +# ones. +extensions = [ + 'oslosphinx', + 'reno.sphinxext', +] + +# Add any paths that contain templates here, relative to this directory. +templates_path = ['_templates'] + +# The suffix of source filenames. +source_suffix = '.rst' + +# The encoding of source files. +#source_encoding = 'utf-8-sig' + +# The master toctree document. +master_doc = 'index' + +# General information about the project. +project = u'puppet-pacemaker Release Notes' +copyright = u'2016, Puppet OpenStack Developers' + +# The version info for the project you're documenting, acts as replacement for +# |version| and |release|, also used in various other places throughout the +# built documents. +# +# The short X.Y version. +version = '1.0.0' +# The full version, including alpha/beta/rc tags. +release = '1.0.0' + +# The language for content autogenerated by Sphinx. Refer to documentation +# for a list of supported languages. +#language = None + +# There are two options for replacing |today|: either, you set today to some +# non-false value, then it is used: +#today = '' +# Else, today_fmt is used as the format for a strftime call. +#today_fmt = '%B %d, %Y' + +# List of patterns, relative to source directory, that match files and +# directories to ignore when looking for source files. +exclude_patterns = [] + +# The reST default role (used for this markup: `text`) to use for all +# documents. +#default_role = None + +# If true, '()' will be appended to :func: etc. cross-reference text. +#add_function_parentheses = True + +# If true, the current module name will be prepended to all description +# unit titles (such as .. function::). +#add_module_names = True + +# If true, sectionauthor and moduleauthor directives will be shown in the +# output. They are ignored by default. +#show_authors = False + +# The name of the Pygments (syntax highlighting) style to use. +pygments_style = 'sphinx' + +# A list of ignored prefixes for module index sorting. +#modindex_common_prefix = [] + +# If true, keep warnings as "system message" paragraphs in the built documents. +#keep_warnings = False + + +# -- Options for HTML output ---------------------------------------------- + +# The theme to use for HTML and HTML Help pages. See the documentation for +# a list of builtin themes. +html_theme = 'default' + +# Theme options are theme-specific and customize the look and feel of a theme +# further. For a list of options available for each theme, see the +# documentation. +#html_theme_options = {} + +# Add any paths that contain custom themes here, relative to this directory. +#html_theme_path = [] + +# The name for this set of Sphinx documents. If None, it defaults to +# " v documentation". +#html_title = None + +# A shorter title for the navigation bar. Default is the same as html_title. +#html_short_title = None + +# The name of an image file (relative to this directory) to place at the top +# of the sidebar. +#html_logo = None + +# The name of an image file (within the static path) to use as favicon of the +# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 +# pixels large. +#html_favicon = None + +# Add any paths that contain custom static files (such as style sheets) here, +# relative to this directory. They are copied after the builtin static files, +# so a file named "default.css" will overwrite the builtin "default.css". +html_static_path = ['_static'] + +# Add any extra paths that contain custom files (such as robots.txt or +# .htaccess) here, relative to this directory. These files are copied +# directly to the root of the documentation. +#html_extra_path = [] + +# If not '', a 'Last updated on:' timestamp is inserted at every page bottom, +# using the given strftime format. +#html_last_updated_fmt = '%b %d, %Y' + +# If true, SmartyPants will be used to convert quotes and dashes to +# typographically correct entities. +#html_use_smartypants = True + +# Custom sidebar templates, maps document names to template names. +#html_sidebars = {} + +# Additional templates that should be rendered to pages, maps page names to +# template names. +#html_additional_pages = {} + +# If false, no module index is generated. +#html_domain_indices = True + +# If false, no index is generated. +#html_use_index = True + +# If true, the index is split into individual pages for each letter. +#html_split_index = False + +# If true, links to the reST sources are added to the pages. +#html_show_sourcelink = True + +# If true, "Created using Sphinx" is shown in the HTML footer. Default is True. +#html_show_sphinx = True + +# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. +#html_show_copyright = True + +# If true, an OpenSearch description file will be output, and all pages will +# contain a tag referring to it. The value of this option must be the +# base URL from which the finished HTML is served. +#html_use_opensearch = '' + +# This is the file name suffix for HTML files (e.g. ".xhtml"). +#html_file_suffix = None + +# Output file base name for HTML help builder. +htmlhelp_basename = 'puppet-pacemakerReleaseNotesdoc' + + +# -- Options for LaTeX output --------------------------------------------- + +latex_elements = { +# The paper size ('letterpaper' or 'a4paper'). +#'papersize': 'letterpaper', + +# The font size ('10pt', '11pt' or '12pt'). +#'pointsize': '10pt', + +# Additional stuff for the LaTeX preamble. +#'preamble': '', +} + +# Grouping the document tree into LaTeX files. List of tuples +# (source start file, target name, title, +# author, documentclass [howto, manual, or own class]). +latex_documents = [ + ('index', 'puppet-pacemakerReleaseNotes.tex', u'puppet-pacemaker Release Notes Documentation', + u'2016, Puppet OpenStack Developers', 'manual'), +] + +# The name of an image file (relative to this directory) to place at the top of +# the title page. +#latex_logo = None + +# For "manual" documents, if this is true, then toplevel headings are parts, +# not chapters. +#latex_use_parts = False + +# If true, show page references after internal links. +#latex_show_pagerefs = False + +# If true, show URL addresses after external links. +#latex_show_urls = False + +# Documents to append as an appendix to all manuals. +#latex_appendices = [] + +# If false, no module index is generated. +#latex_domain_indices = True + + +# -- Options for manual page output --------------------------------------- + +# One entry per manual page. List of tuples +# (source start file, name, description, authors, manual section). +man_pages = [ + ('index', 'puppet-pacemakerreleasenotes', u'puppet-pacemaker Release Notes Documentation', + [u'2016, Puppet OpenStack Developers'], 1) +] + +# If true, show URL addresses after external links. +#man_show_urls = False + + +# -- Options for Texinfo output ------------------------------------------- + +# Grouping the document tree into Texinfo files. List of tuples +# (source start file, target name, title, author, +# dir menu entry, description, category) +texinfo_documents = [ + ('index', 'puppet-pacemakerReleaseNotes', u'puppet-pacemaker Release Notes Documentation', + u'2016, Puppet OpenStack Developers', 'puppet-pacemakerReleaseNotes', 'One line description of project.', + 'Miscellaneous'), +] + +# Documents to append as an appendix to all manuals. +#texinfo_appendices = [] + +# If false, no module index is generated. +#texinfo_domain_indices = True + +# How to display URL addresses: 'footnote', 'no', or 'inline'. +#texinfo_show_urls = 'footnote' + +# If true, do not generate a @detailmenu in the "Top" node's menu. +#texinfo_no_detailmenu = False diff --git a/releasenotes/source/index.rst b/releasenotes/source/index.rst new file mode 100644 index 00000000..13ef912e --- /dev/null +++ b/releasenotes/source/index.rst @@ -0,0 +1,18 @@ +========================================== +Welcome to puppet-pacemaker Release Notes! +========================================== + +Contents +======== + +.. toctree:: + :maxdepth: 2 + + unreleased + + +Indices and tables +================== + +* :ref:`genindex` +* :ref:`search` diff --git a/releasenotes/source/unreleased.rst b/releasenotes/source/unreleased.rst new file mode 100644 index 00000000..2334dd5c --- /dev/null +++ b/releasenotes/source/unreleased.rst @@ -0,0 +1,5 @@ +============================== + Current Series Release Notes +============================== + + .. release-notes:: diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 00000000..ec400fdc --- /dev/null +++ b/setup.cfg @@ -0,0 +1,13 @@ +[metadata] +name = puppet-pacemaker +summary = Puppet module for Pacemaker +description-file = + README.md +author = Mirantis, Red-Hat and OpenStack Contributors +author-email = openstack-dev@lists.openstack.org +home-page = http://www.openstack.org/ +classifier = + Intended Audience :: Developers + Intended Audience :: System Administrators + License :: OSI Approved :: Apache Software License + Operating System :: POSIX :: Linux diff --git a/setup.py b/setup.py new file mode 100644 index 00000000..70c2b3f3 --- /dev/null +++ b/setup.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python +# Copyright (c) 2013 Hewlett-Packard Development Company, L.P. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# THIS FILE IS MANAGED BY THE GLOBAL REQUIREMENTS REPO - DO NOT EDIT +import setuptools + +setuptools.setup( + setup_requires=['pbr'], + pbr=True) diff --git a/spec/acceptance/nodesets/nodepool-xenial.yml b/spec/acceptance/nodesets/nodepool-xenial.yml new file mode 100644 index 00000000..99dd3187 --- /dev/null +++ b/spec/acceptance/nodesets/nodepool-xenial.yml @@ -0,0 +1,10 @@ +HOSTS: + ubuntu-16.04-amd64: + roles: + - master + platform: ubuntu-16.04-amd64 + hypervisor: none + ip: 127.0.0.1 +CONFIG: + type: foss + set_env: false diff --git a/spec/classes/pacemaker_install_spec.rb b/spec/classes/pacemaker_install_spec.rb index e76380bb..983cfd3c 100644 --- a/spec/classes/pacemaker_install_spec.rb +++ b/spec/classes/pacemaker_install_spec.rb @@ -13,7 +13,11 @@ describe 'pacemaker::new::install', type: :class do %w(pacemaker pcs fence-agents cman) end elsif facts[:osfamily] == 'Debian' - %w(pacemaker-mgmt pacemaker corosync pacemaker-cli-utils resource-agents) + if facts[:operatingsystem] == 'Ubuntu' && facts[:operatingsystemmajrelease].to_i >= 16 + %w(pacemaker corosync pacemaker-cli-utils resource-agents) + else + %w(pacemaker-mgmt pacemaker corosync pacemaker-cli-utils resource-agents) + end else [] end diff --git a/spec/defines/pacemaker_contain_spec.rb b/spec/defines/pacemaker_contain_spec.rb new file mode 100644 index 00000000..cb044c23 --- /dev/null +++ b/spec/defines/pacemaker_contain_spec.rb @@ -0,0 +1,33 @@ +require 'spec_helper' + +describe 'pacemaker::contain', type: :define do + on_supported_os.each do |os, facts| + context "on #{os}" do + let(:facts) { facts } + let(:pre_condition) do + <<-eof +class my_dummy_class {} + eof + end + + + context 'with default parameters' do + let(:title) { 'my_dummy_class' } + it { is_expected.to compile.with_all_deps } + it { is_expected.to include_class('my_dummy_class') } + it { is_expected.to contain_class('my_dummy_class') } + end + context 'with class_name parameters' do + let(:title) { 'something_else' } + let(:params) { { 'class_name' => 'my_dummy_class' }} + it { is_expected.to compile.with_all_deps } + it { is_expected.to include_class('my_dummy_class') } + it { is_expected.to contain_class('my_dummy_class') } + end + context 'fail with an absolute class name' do + let(:title) { '::dummy_class' } + it { is_expected.not_to compile } + end + end + end +end diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb index d43e9e34..d14ab1eb 100644 --- a/spec/spec_helper_acceptance.rb +++ b/spec/spec_helper_acceptance.rb @@ -5,6 +5,8 @@ require 'pry' run_puppet_install_helper +# Xenial install is in /opt/puppetlabs + def example_manifest(name, path = '../examples') test_dir = File.expand_path File.join File.dirname(__FILE__), path manifest = File.join test_dir, name @@ -20,7 +22,8 @@ RSpec.configure do |c| c.formatter = :documentation c.before :suite do hosts.each do |host| - + # https://tickets.puppetlabs.com/browse/BKR-821 + on host, '[ ! -f /opt/puppetlabs/bin/puppet ] || ln -s /opt/puppetlabs/bin/puppet /usr/bin/puppet' copy_module_to(host, source: root, module_name: 'pacemaker') on host, puppet('module', 'install', 'puppetlabs-stdlib') diff --git a/test-requirements.txt b/test-requirements.txt new file mode 100644 index 00000000..bedd6669 --- /dev/null +++ b/test-requirements.txt @@ -0,0 +1,4 @@ +# this is required for the docs build jobs +sphinx!=1.2.0,!=1.3b1,<1.3,>=1.1.2 +oslosphinx>=2.5.0 # Apache-2.0 +reno>=0.1.1 # Apache-2.0 diff --git a/tox.ini b/tox.ini new file mode 100644 index 00000000..aea06c84 --- /dev/null +++ b/tox.ini @@ -0,0 +1,8 @@ +[tox] +minversion = 1.6 +skipsdist = True +envlist = releasenotes + +[testenv:releasenotes] +deps = -rtest-requirements.txt +commands = sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html