From e899517c5499ba4e701abb30d64d20b1f8af7efd Mon Sep 17 00:00:00 2001 From: Ben Dalling Date: Mon, 26 Dec 2016 11:19:46 +0000 Subject: [PATCH] Feature 7 (#11) Work on #7, but fixes #10. --- .gitignore | 4 +- .rubocop.yml | 3 + .travis.yml | 21 ++ CHANGELOG.md | 13 ++ Gemfile | 35 +-- LICENCE.md | 201 ++++++++++++++++++ README.md | 63 +----- Rakefile | 91 ++++++++ Vagrantfile | 122 +---------- circle.yml | 14 +- manifests/init.pp | 7 +- manifests/repo.pp | 12 +- metadata.json | 6 + spec/acceptance/nodesets/centos7.yml | 15 ++ spec/acceptance/nodesets/default.yml | 13 -- spec/acceptance/nodesets/ubuntu1404.yml | 13 ++ .../{odoo9_spec.rb => odoo_spec.rb} | 2 +- spec/spec_helper.rb | 9 +- 18 files changed, 431 insertions(+), 213 deletions(-) create mode 100644 .rubocop.yml create mode 100644 .travis.yml create mode 100644 CHANGELOG.md create mode 100644 LICENCE.md create mode 100644 spec/acceptance/nodesets/centos7.yml delete mode 100644 spec/acceptance/nodesets/default.yml create mode 100644 spec/acceptance/nodesets/ubuntu1404.yml rename spec/acceptance/{odoo9_spec.rb => odoo_spec.rb} (95%) diff --git a/.gitignore b/.gitignore index 4cad460..6b50d60 100644 --- a/.gitignore +++ b/.gitignore @@ -1,12 +1,14 @@ .bundle/ coverage/ +doc/ Gemfile.lock .idea/ *.iml +log/ pkg/ spec/fixtures/ *.swn *.swo *.swp vendor/ -log/ +.yardoc/ diff --git a/.rubocop.yml b/.rubocop.yml new file mode 100644 index 0000000..d25556a --- /dev/null +++ b/.rubocop.yml @@ -0,0 +1,3 @@ +--- +Metrics/LineLength: + Enabled: false diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..97655a5 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,21 @@ +--- +env: + - "PUPPET_VERSION='~> 4.5' BEAKER_set=centos7" + - "PUPPET_VERSION='~> 4.5' BEAKER_set=ubuntu1404" +language: ruby +rvm: + - 2.3.1 +cache: bundler +before_install: rm Gemfile.lock || true +bundler_args: --without development --with acceptance +dist: trusty +sudo: required +script: + - "bundle exec rake metadata_lint" + - "bundle exec rubocop" + - "bundle exec rake lint" + - "bundle exec rake validate" + - "bundle exec rake spec SPEC_OPTS='--format documentation'" + - "bundle exec rake acceptance" +notifications: + email: false diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..f8d1538 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,13 @@ +# locp-odoo + +##2016-12-23 - Release 0.1.2 ([diff](https://github.com/locp/puppet-odoo/compare/0.1.1...0.1.2)) + +Announce that the module has been renamed from locp-odoo9 to locp-odoo. + +##2016-10-09 - Release 0.1.1 ([diff](https://github.com/locp/puppet-odoo/compare/0.1.0...0.1.1)) + +Corrected metadata for the module. + +##2016-10-09 - Release 0.1.0 + +Initial release. diff --git a/Gemfile b/Gemfile index dd92732..9777aef 100644 --- a/Gemfile +++ b/Gemfile @@ -1,22 +1,33 @@ source ENV['GEM_SOURCE'] || 'https://rubygems.org' - puppetversion = ENV.key?('PUPPET_VERSION') ? ENV['PUPPET_VERSION'] : ['>= 3.3'] -gem 'coveralls' -gem 'metadata-json-lint' -gem 'puppet', puppetversion -gem 'puppet-blacksmith' -gem 'puppetlabs_spec_helper', '>= 1.0.0' -gem 'puppet-lint', '>= 1.0.0' -gem 'facter', '>= 1.7.0' -gem 'rspec_junit_formatter' -gem 'rspec-puppet' -gem 'rspec-puppet-utils' +group :test do + gem 'coveralls' + gem 'facter', '>= 1.7.0' + gem 'git', '1.3.0' + gem 'httparty' + gem 'metadata-json-lint' + gem 'puppet', puppetversion + gem 'puppet-blacksmith' + gem 'puppet-lint', '>= 1.0.0' + gem 'puppet-strings' + gem 'puppetlabs_spec_helper', '>= 1.0.0' + gem 'rspec-puppet' + gem 'rspec-puppet-utils' + gem 'rspec_junit_formatter' +end + +group :acceptance do + gem 'beaker' + gem 'beaker-puppet_install_helper' + gem 'beaker-rspec' + gem 'pry' +end # rspec must be v2 for ruby 1.8.7 if RUBY_VERSION >= '1.8.7' && RUBY_VERSION < '1.9' - gem 'rspec', '~> 2.0' gem 'rake', '~> 10.0' + gem 'rspec', '~> 2.0' else # rubocop requires ruby >= 1.9 gem 'rubocop' diff --git a/LICENCE.md b/LICENCE.md new file mode 100644 index 0000000..36fb164 --- /dev/null +++ b/LICENCE.md @@ -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 2016 League of Crafty Programmers Ltd. + + 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/README.md b/README.md index 7b1ef08..38b506c 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,11 @@ # odoo9 -#### Table of Contents +[![CircleCI](https://circleci.com/gh/locp/puppet-odoo/tree/master.svg?style=svg)](https://circleci.com/gh/locp/puppet-odoo/tree/master) +[![Build Status](https://travis-ci.org/locp/puppet-odoo.png?branch=master)](https://travis-ci.org/locp/puppet-odoo) +[![Coverage Status](https://coveralls.io/repos/github/locp/puppet-odoo/badge.svg?branch=master)](https://coveralls.io/github/locp/puppet-odoo?branch=master) +[![Join the chat at https://gitter.im/locp/puppet-odoo](https://badges.gitter.im/locp/puppet-odoo.svg)](https://gitter.im/locp/puppet-odoo?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) + +## Table of Contents 1. [Description](#description) 1. [Setup - The basics of getting started with odoo9](#setup) @@ -74,58 +79,12 @@ class { '::odoo9': ## Reference -### Attributes - -#### Class odoo9 - -##### `install_wkhtmltopdf` -Whether or not to install the optional `wkhtmltopdf` package from the Odoo -repository. -Default value **false**. - -##### `settings` -A hash of settings to be passed to the `create_ini_settings` (see -https://forge.puppet.com/puppetlabs/inifile#manage-multiple-ini_settings -for details). The following defaults are provided: - -```puppet -{ - path => '/etc/odoo/openerp-server.conf', - require => Package['odoo'], - notify => Service['odoo'], -} -``` - -##### `version` -The version of the `odoo` package to be installed. Valid values are -**present**, **latest** or the version of the version of the package to be -installed ('i.e. *9.0c.20161009*). - -#### Class odoo9::repo - -##### `descr` -The name of the repository to be configured. -Default value 'Odoo Nightly repository' - -##### `key_id` -The key for the Debian APT repository. This option is ignored on the -Red Hat family. -Default value '5D134C924CB06330DCEFE2A1DEF2A2198183CBB5' - -##### `pkg_url` -The URL to the package on the repository. It defaults to -**http://nightly.odoo.com/9.0/nightly/rpm/** on the Red Hat family and -**http://nightly.odoo.com/9.0/nightly/deb/**. - -##### `pkg_url` -The release for the Debian APT repository. This option is ignored on the -Red Hat family. -Default value './' +### Public Classes -##### `repos` -The repos for the Debian APT repository. This option is ignored on the -Red Hat family. -Default value '' +* [odoo9] + (http://locp.github.io/puppet-odoo/puppet_classes/odoo9.html) +* [odoo9::repo] + (http://locp.github.io/puppet-odoo/puppet_classes/odoo9_3A_3Arepo.html) ## Limitations diff --git a/Rakefile b/Rakefile index 4d65cb0..17f70ca 100644 --- a/Rakefile +++ b/Rakefile @@ -1,8 +1,99 @@ require 'rubygems' require 'puppetlabs_spec_helper/rake_tasks' require 'puppet_blacksmith/rake_tasks' +require 'puppet-strings/tasks' +require 'httparty' +require 'json' +require 'yaml' +require 'git' # Use a custom pattern with git tag. %s is replaced with the version number. Blacksmith::RakeTask.new do |t| t.tag_pattern = '%s' end + +desc '[CI Only] Run beaker, but only for pull requests or for release branches.' +task :acceptance do + skip = true + travis_branch = ENV['TRAVIS_BRANCH'] + travis_event_type = ENV['TRAVIS_EVENT_TYPE'] + + if travis_event_type == 'pull_request' + skip = false + elsif travis_event_type == 'push' + skip = false if travis_branch =~ /^release-/ || travis_branch =~ /^hotfix-/ + end + + if skip + puts 'Skipping acceptance tests.' + exit(0) + else + Rake::Task['beaker'].invoke + end +end + +desc '[CI Only] Tag, build and push the module to PuppetForge.' +task :deploy do + abort('Only deploy from master.') unless ENV['CIRCLE_BRANCH'] == 'master' + + # Find out what the local version of the module is. + file = File.read('metadata.json') + data_hash = JSON.parse(file) + local_version = data_hash['version'] + abort('Unable to find local module version.') unless local_version + puts "Module version (local): #{local_version}" + + Rake::Task['deploy:tag'].invoke(local_version) + Rake::Task['deploy:forge'].invoke(local_version) +end + +namespace :deploy do + desc 'Deploy module to Puppet Forge if required.' + task :forge, [:version] do |_t, args| + local_version = args[:version] + + # Find out what the forge version of the module is. + response = HTTParty.get('https://forgeapi.puppetlabs.com/v3/modules/locp-cassandra') + data_hash = JSON.parse(response.body) + forge_version = data_hash['current_release']['version'] + abort('Unable to find out the forge version.') unless forge_version + puts "Module version (forge): #{forge_version}" + exit 0 unless local_version != forge_version + + # Build the module. + puts "Build and deploy version #{local_version}." + Rake::Task['module:clean'].invoke + Rake::Task['build'].invoke + + # Now see if we can push this baby to the forge. + PUPPET_FORGE_CREDENTIALS_FILE = ENV['HOME'] + '/' + '.puppetforge.yml' + username = ENV['CIRCLE_PROJECT_USERNAME'] + password = ENV['PUPPET_FORGE_PASSWORD'] + abort("Not enough data to populate #{PUPPET_FORGE_CREDENTIALS_FILE}") unless username && password + puts "Populating #{PUPPET_FORGE_CREDENTIALS_FILE}" + credentials = { 'username' => username, 'password' => password } + File.open(PUPPET_FORGE_CREDENTIALS_FILE, 'w') { |f| f.write credentials.to_yaml } + Rake::Task['module:push'].invoke + end +end + +namespace :deploy do + desc 'Deploy tag for the module' + task :tag, [:version] do |_t, args| + tagname = args[:version] + # Find out if a tag is available for this version. + log = Logger.new(STDOUT) + log.level = Logger::WARN + git = Git.open('.', log: log) + + begin + git.tag(tagname) + rescue Git::GitTagNameDoesNotExist + puts "Creating tag: #{tagname}" + git.add_tag(tagname, 'master', message: 'tagged by RubyAutoDeployTest', f: true) + git.push('origin', "refs/tags/#{tagname}", f: true) + else + puts "Tag: #{tagname} already exists." + end + end +end diff --git a/Vagrantfile b/Vagrantfile index 17a815a..637d46c 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -6,146 +6,28 @@ require 'json' VAGRANTFILE_API_VERSION = '2'.freeze Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| - # All Vagrant configuration is done here. The most common configuration - # options are documented and commented below. For a complete reference, - # please see the online documentation at vagrantup.com. - - # Every Vagrant virtual environment requires a box to build off of. config.vm.hostname = 'node0' - # config.vm.box = 'puppetlabs/centos-7.0-64-nocm' config.vm.box = 'puppetlabs/ubuntu-14.04-64-nocm' config.puppet_install.puppet_version = '3.8.2' config.vm.synced_folder '.', '/etc/puppet/modules/odoo9' - - # Enable provisioning with Puppet stand alone. Puppet manifests - # are contained in a directory path relative to this Vagrantfile. - # You will need to create the manifests directory and a manifest in - # the file default.pp in the manifests_path directory. - # - # generate list of puppet modules to be installed from metadata.json metadata_json_file = "#{File.dirname(__FILE__)}/metadata.json" if File.exist?(metadata_json_file) JSON.parse( File.read(metadata_json_file) )['dependencies'].each do |key, _value| module_name = key['name'].to_s - config.vm.provision 'shell', - inline: "puppet module install #{module_name}" + config.vm.provision 'shell', inline: "puppet module install #{module_name}" end else puts 'metadata.json not found; skipping install of dependencies' end - - config.vm.provision 'shell', - inline: 'puppet module install puppetlabs-postgresql' - + config.vm.provision 'shell', inline: 'puppet module install puppetlabs-postgresql' config.vm.provision 'puppet' do |puppet| puppet.manifests_path = 'examples' puppet.manifest_file = 'init.pp' end - - # Have something like the following in puppet/manifests/local.pp: - # node default { - # require '::base' - # include '::foobar' - # } - # - # Create a forwarded port mapping which allows access to a specific port - # within the machine from a port on the host machine. In the example below, - # accessing "localhost:8080" will access port 80 on the guest machine. - # config.vm.network "forwarded_port", guest: 80, host: 8080 config.vm.network 'forwarded_port', guest: 8069, host: 8069 - - # Disable automatic box update checking. If you disable this, then - # boxes will only be checked for updates when the user runs - # `vagrant box outdated`. This is not recommended. - # config.vm.box_check_update = false - - # Create a private network, which allows host-only access to the machine - # using a specific IP. - # config.vm.network "private_network", ip: "192.168.33.10" - - # Create a public network, which generally matched to bridged network. - # Bridged networks make the machine appear as another physical device on - # your network. - # config.vm.network "public_network" - - # If true, then any SSH connections made will enable agent forwarding. - # Default value: false - # config.ssh.forward_agent = true - - # Share an additional folder to the guest VM. The first argument is - # the path on the host to the actual folder. The second argument is - # the path on the guest to mount the folder. And the optional third - # argument is a set of non-required options. - # config.vm.synced_folder "../data", "/vagrant_data" - - # Provider-specific configuration so you can fine-tune various - # backing providers for Vagrant. These expose provider-specific options. - # Example for VirtualBox: - # config.vm.provider 'virtualbox' do |vb| - # Don't boot with headless mode - # vb.gui = true - - # Use VBoxManage to customize the VM. For example to change memory: vb.customize ['modifyvm', :id, '--memory', '2048'] end - # - # View the documentation for the provider you're using for more - # information on available options. - - # Enable provisioning with CFEngine. CFEngine Community packages are - # automatically installed. For example, configure the host as a - # policy server and optionally a policy file to run: - # - # config.vm.provision "cfengine" do |cf| - # cf.am_policy_hub = true - # # cf.run_file = "motd.cf" - # end - # - # You can also configure and bootstrap a client to an existing - # policy server: - # - # config.vm.provision "cfengine" do |cf| - # cf.policy_server_address = "10.0.2.15" - # end - - # Enable provisioning with chef solo, specifying a cookbooks path, roles - # path, and data_bags path (all relative to this Vagrantfile), and adding - # some recipes and/or roles. - # - # config.vm.provision "chef_solo" do |chef| - # chef.cookbooks_path = "../my-recipes/cookbooks" - # chef.roles_path = "../my-recipes/roles" - # chef.data_bags_path = "../my-recipes/data_bags" - # chef.add_recipe "mysql" - # chef.add_role "web" - # - # # You may also specify custom JSON attributes: - # chef.json = { mysql_password: "foo" } - # end - - # Enable provisioning with chef server, specifying the chef server URL, - # and the path to the validation key (relative to this Vagrantfile). - # - # The Opscode Platform uses HTTPS. Substitute your organization for - # ORGNAME in the URL and validation key. - # - # If you have your own Chef Server, use the appropriate URL, which may be - # HTTP instead of HTTPS depending on your configuration. Also change the - # validation key to validation.pem. - # - # config.vm.provision "chef_client" do |chef| - # chef.chef_server_url = "https://api.opscode.com/organizations/ORGNAME" - # chef.validation_key_path = "ORGNAME-validator.pem" - # end - # - # If you're using the Opscode platform, your validator client is - # ORGNAME-validator, replacing ORGNAME with your organization name. - # - # If you have your own Chef Server, the default validation client name is - # chef-validator, unless you changed the configuration. - # - # chef.validation_client_name = "ORGNAME-validator" end diff --git a/circle.yml b/circle.yml index dbd1617..a3aa72e 100644 --- a/circle.yml +++ b/circle.yml @@ -2,24 +2,28 @@ dependencies: bundler: without: [development] - cache_directories: - - "~/.rvm/gems" override: - - bundle install --without development: + - bundle install --without acceptance development: timeout: 240 environment: PUPPET_GEM_VERSION: '~> 4.0' STRICT_VARIABLES: yes post: - rvm cleanup all +deployment: + master: + branch: master + commands: + - git config --global user.email "info@locp.co.uk" + - git config --global user.name "CircleCI" + - bundle exec rake strings:gh_pages:update + - bundle exec rake deploy machine: environment: PUPPET_GEM_VERSION: '~> 4.0' STRICT_VARIABLES: yes ruby: version: 2.1.6 - services: - - docker notify: webhooks: - diff --git a/manifests/init.pp b/manifests/init.pp index 9e2cab3..b435e89 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -1,4 +1,9 @@ -# Class: odoo9 +# Install and configure Odoo Community. +# @param install_wkhtmltopdf [boolean] Whether or not to install the optional `wkhtmltopdf` package. +# @param settings [hash] A hash of settings to be passed to the `create_ini_settings` (see +# https://forge.puppet.com/puppetlabs/inifile#manage-multiple-ini_settings for details). +# @param version [string] The version of the `odoo` package to be installed. Valid values are **present**, **latest** +# or the version of the version of the package to be installed (i.e. '9.0c.20161009'). class odoo9 ( $install_wkhtmltopdf = false, $settings = {}, diff --git a/manifests/repo.pp b/manifests/repo.pp index dc97a00..38e8b27 100644 --- a/manifests/repo.pp +++ b/manifests/repo.pp @@ -1,8 +1,12 @@ -# == Class: odoo9::repo -# -# Please see the README for this module for full details of what this class -# does as part of the module and how to use it. +# Install a repository to install an Odoo 9 package from. # +# @param descr [string] A string to describe the repository. +# @param key_id [string] The key for the Debian APT repository. This option is ignored on the Red Hat family. +# @param key_url [string] A URL to the key for the Debian APT repository. This option is ignored on the Red Hat family. +# @param pkg_url [string] The URL to a package. This defaults to 'http://nightly.odoo.com/9.0/nightly/rpm/' on the Red +# Hat family and 'http://nightly.odoo.com/9.0/nightly/deb/' on Debian. +# @param release [string] The release for the Debian APT repository. This option is ignored on the Red Hat family. +# @param repos [string] The repos for the Debian APT repository. This option is ignored on the Red Hat family. class odoo9::repo ( $descr = 'Odoo Nightly repository', $key_id = '5D134C924CB06330DCEFE2A1DEF2A2198183CBB5', diff --git a/metadata.json b/metadata.json index 6f5eb74..188ba4e 100644 --- a/metadata.json +++ b/metadata.json @@ -37,6 +37,12 @@ "operatingsystemrelease": [ "14.04" ] + }, + { + "operatingsystem": "CentOS", + "operatingsystemrelease": [ + "7" + ] } ], "data_provider": null diff --git a/spec/acceptance/nodesets/centos7.yml b/spec/acceptance/nodesets/centos7.yml new file mode 100644 index 0000000..5ef717f --- /dev/null +++ b/spec/acceptance/nodesets/centos7.yml @@ -0,0 +1,15 @@ +--- +HOSTS: + centos7: + roles: + - master + platform: el-7-x86_64 + image: centos:7 + hypervisor: docker + docker_cmd: '["/sbin/init"]' + docker_image_commands: + - 'yum -y install systemd-container initscripts epel-release' + - 'yum clean all' +CONFIG: + type: foss + log_level: notice diff --git a/spec/acceptance/nodesets/default.yml b/spec/acceptance/nodesets/default.yml deleted file mode 100644 index b2abdeb..0000000 --- a/spec/acceptance/nodesets/default.yml +++ /dev/null @@ -1,13 +0,0 @@ ---- -HOSTS: - debian7: - roles: - - debian7 - platform: debian-7-amd64 - image: debian:7 - hypervisor: docker - docker_image_commands: - - 'apt-get install -y sudo ufw wget' -CONFIG: - type: foss - log_level: notice diff --git a/spec/acceptance/nodesets/ubuntu1404.yml b/spec/acceptance/nodesets/ubuntu1404.yml new file mode 100644 index 0000000..d65972d --- /dev/null +++ b/spec/acceptance/nodesets/ubuntu1404.yml @@ -0,0 +1,13 @@ +--- +HOSTS: + ubuntu1404: + roles: + - master + platform: ubuntu-14.04-x64 + image: ubuntu:14.04 + hypervisor: docker + docker_image_commands: + - 'apt-get install -y sudo' +CONFIG: + type: foss + log_level: notice diff --git a/spec/acceptance/odoo9_spec.rb b/spec/acceptance/odoo_spec.rb similarity index 95% rename from spec/acceptance/odoo9_spec.rb rename to spec/acceptance/odoo_spec.rb index 9d80f84..ea96301 100644 --- a/spec/acceptance/odoo9_spec.rb +++ b/spec/acceptance/odoo_spec.rb @@ -22,7 +22,7 @@ class { '::odoo9': 'addons_path' => '/usr/lib/python2.7/dist-packages/openerp/addons', } }, - version => '9.0c.20161009', + version => 'present', } EOS diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index fd6d314..9b1f149 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,16 +1,17 @@ -require 'coveralls' require 'rspec-puppet' require 'rspec-puppet-utils' require 'puppetlabs_spec_helper/module_spec_helper' require 'simplecov' +require 'coveralls' unless ENV['TRAVIS'] == 'true' +Coveralls.wear! unless ENV['TRAVIS'] == 'true' fixture_path = File.expand_path(File.join(__FILE__, '..', 'fixtures')) RSpec.configure do |c| c.module_path = File.join(fixture_path, 'modules') c.manifest_dir = File.join(fixture_path, 'manifests') c.environmentpath = File.join(Dir.pwd, 'spec') + c.after(:suite) do + exit(1) if RSpec::Puppet::Coverage.report!(100) + end end - -Coveralls.wear! -at_exit { RSpec::Puppet::Coverage.report! }