Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into feature-9
Browse files Browse the repository at this point in the history
  • Loading branch information
dallinb committed Dec 26, 2016
2 parents 3b38a75 + e899517 commit c8b0835
Show file tree
Hide file tree
Showing 15 changed files with 224 additions and 91 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
.bundle/
coverage/
doc/
Gemfile.lock
.idea/
*.iml
log/
pkg/
spec/fixtures/
*.swn
*.swo
*.swp
vendor/
log/
.yardoc/
21 changes: 21 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -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
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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.
33 changes: 22 additions & 11 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,17 +1,28 @@
source ENV['GEM_SOURCE'] || 'https://rubygems.org'

puppetversion = ENV.key?('PUPPET_VERSION') ? ENV['PUPPET_VERSION'] : ['>= 3.3']

gem 'coveralls'
gem 'facter', '>= 1.7.0'
gem 'metadata-json-lint'
gem 'puppet', puppetversion
gem 'puppet-blacksmith'
gem 'puppet-lint', '>= 1.0.0'
gem 'puppetlabs_spec_helper', '>= 1.0.0'
gem 'rspec-puppet'
gem 'rspec-puppet-utils'
gem 'rspec_junit_formatter'
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'
Expand Down
63 changes: 11 additions & 52 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
# odoo

#### 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 odoo](#setup)
Expand Down Expand Up @@ -74,58 +79,12 @@ class { '::odoo':

## Reference

### Attributes

#### Class odoo

##### `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 odoo::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

Expand Down
91 changes: 91 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -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
14 changes: 9 additions & 5 deletions circle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
-
Expand Down
6 changes: 6 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
# Class: odoo
# 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 odoo (
$install_wkhtmltopdf = false,
$settings = {},
Expand Down
12 changes: 8 additions & 4 deletions manifests/repo.pp
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
# == Class: odoo::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 odoo::repo (
$descr = 'Odoo Nightly repository',
$key_id = '5D134C924CB06330DCEFE2A1DEF2A2198183CBB5',
Expand Down
6 changes: 6 additions & 0 deletions metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@
"operatingsystemrelease": [
"14.04"
]
},
{
"operatingsystem": "CentOS",
"operatingsystemrelease": [
"7"
]
}
],
"data_provider": null
Expand Down
15 changes: 15 additions & 0 deletions spec/acceptance/nodesets/centos7.yml
Original file line number Diff line number Diff line change
@@ -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
13 changes: 0 additions & 13 deletions spec/acceptance/nodesets/default.yml

This file was deleted.

13 changes: 13 additions & 0 deletions spec/acceptance/nodesets/ubuntu1404.yml
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class { '::odoo9':
'addons_path' => '/usr/lib/python2.7/dist-packages/openerp/addons',
}
},
version => '9.0c.20161009',
version => 'present',
}
EOS

Expand Down
Loading

0 comments on commit c8b0835

Please sign in to comment.