Browse Source

Inital commit

master
Tobias Herre 2 years ago
parent
commit
b3563fb24e
  1. 18
      wmde-odoo/Gemfile
  2. 89
      wmde-odoo/README.md
  3. 32
      wmde-odoo/Rakefile
  4. 12
      wmde-odoo/examples/init.pp
  5. 105
      wmde-odoo/manifests/init.pp
  6. 61
      wmde-odoo/manifests/params.pp
  7. 22
      wmde-odoo/metadata.json
  8. 6
      wmde-odoo/spec/classes/init_spec.rb
  9. 1
      wmde-odoo/spec/spec_helper.rb

18
wmde-odoo/Gemfile

@ -0,0 +1,18 @@
source ENV['GEM_SOURCE'] || 'https://rubygems.org'
puppetversion = ENV.key?('PUPPET_VERSION') ? ENV['PUPPET_VERSION'] : ['>= 3.3']
gem 'metadata-json-lint'
gem 'puppet', puppetversion
gem 'puppetlabs_spec_helper', '>= 1.2.0'
gem 'puppet-lint', '>= 1.0.0'
gem 'facter', '>= 1.7.0'
gem 'rspec-puppet'
# 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'
else
# rubocop requires ruby >= 1.9
gem 'rubocop'
end

89
wmde-odoo/README.md

@ -0,0 +1,89 @@
# odoo
#### Table of Contents
1. [Description](#description)
1. [Setup - The basics of getting started with odoo](#setup)
* [What odoo affects](#what-odoo-affects)
* [Setup requirements](#setup-requirements)
* [Beginning with odoo](#beginning-with-odoo)
1. [Usage - Configuration options and additional functionality](#usage)
1. [Reference - An under-the-hood peek at what the module is doing and how](#reference)
1. [Limitations - OS compatibility, etc.](#limitations)
1. [Development - Guide for contributing to the module](#development)
## Description
Start with a one- or two-sentence summary of what the module does and/or what
problem it solves. This is your 30-second elevator pitch for your module.
Consider including OS/Puppet version it works with.
You can give more descriptive information in a second paragraph. This paragraph
should answer the questions: "What does this module *do*?" and "Why would I use
it?" If your module has a range of functionality (installation, configuration,
management, etc.), this is the time to mention it.
## Setup
### What odoo affects **OPTIONAL**
If it's obvious what your module touches, you can skip this section. For
example, folks can probably figure out that your mysql_instance module affects
their MySQL instances.
If there's more that they should know about, though, this is the place to mention:
* A list of files, packages, services, or operations that the module will alter,
impact, or execute.
* Dependencies that your module automatically installs.
* Warnings or other important notices.
### Setup Requirements **OPTIONAL**
If your module requires anything extra before setting up (pluginsync enabled,
etc.), mention it here.
If your most recent release breaks compatibility or requires particular steps
for upgrading, you might want to include an additional "Upgrading" section
here.
### Beginning with odoo
The very basic steps needed for a user to get the module up and running. This
can include setup steps, if necessary, or it can be an example of the most
basic use of the module.
## Usage
This section is where you describe how to customize, configure, and do the
fancy stuff with your module here. It's especially helpful if you include usage
examples and code samples for doing things with your module.
## Reference
Users need a complete list of your module's classes, types, defined types providers, facts, and functions, along with the parameters for each. You can provide this list either via Puppet Strings code comments or as a complete list in this Reference section.
* If you are using Puppet Strings code comments, this Reference section should include Strings information so that your users know how to access your documentation.
* If you are not using Puppet Strings, include a list of all of your classes, defined types, and so on, along with their parameters. Each element in this listing should include:
* The data type, if applicable.
* A description of what the element does.
* Valid values, if the data type doesn't make it obvious.
* Default value, if any.
## Limitations
This is where you list OS compatibility, version compatibility, etc. If there
are Known Issues, you might want to include them under their own heading here.
## Development
Since your module is awesome, other users will want to play with it. Let them
know what the ground rules for contributing are.
## Release Notes/Contributors/Etc. **Optional**
If you aren't using changelog, put your release notes here (though you should
consider using changelog). You can also add any additional sections you feel
are necessary or important to include here. Please use the `## ` header.

32
wmde-odoo/Rakefile

@ -0,0 +1,32 @@
require 'puppetlabs_spec_helper/rake_tasks'
require 'puppet-lint/tasks/puppet-lint'
require 'metadata-json-lint/rake_task'
if RUBY_VERSION >= '1.9'
require 'rubocop/rake_task'
RuboCop::RakeTask.new
end
PuppetLint.configuration.send('disable_80chars')
PuppetLint.configuration.relative = true
PuppetLint.configuration.ignore_paths = ['spec/**/*.pp', 'pkg/**/*.pp']
desc 'Validate manifests, templates, and ruby files'
task :validate do
Dir['manifests/**/*.pp'].each do |manifest|
sh "puppet parser validate --noop #{manifest}"
end
Dir['spec/**/*.rb', 'lib/**/*.rb'].each do |ruby_file|
sh "ruby -c #{ruby_file}" unless ruby_file =~ %r{spec/fixtures}
end
Dir['templates/**/*.erb'].each do |template|
sh "erb -P -x -T '-' #{template} | ruby -c"
end
end
desc 'Run lint, validate, and spec tests.'
task :test do
[:lint, :validate, :spec].each do |test|
Rake::Task[test].invoke
end
end

12
wmde-odoo/examples/init.pp

@ -0,0 +1,12 @@
# The baseline for module testing used by Puppet Inc. 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:
# https://docs.puppet.com/guides/tests_smoke.html
#
include ::odoo

105
wmde-odoo/manifests/init.pp

@ -0,0 +1,105 @@
# Class: odoo
# ===========================
#
# Full description of class odoo here.
#
# Parameters
# ----------
#
# 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.
#
# * `sample variable`
# Explanation of how this variable affects the function of this class and if
# it has a default. e.g. "The parameter enc_ntp_servers must be set by the
# External Node Classifier as a comma separated list of hostnames." (Note,
# global variables should be avoided in favor of class parameters as
# of Puppet 2.6.)
#
# Examples
# --------
#
# @example
# class { 'odoo':
# servers => [ 'pool.ntp.org', 'ntp.local.company.com' ],
# }
#
# Authors
# -------
#
# Author Name <author@domain.com>
#
# Copyright
# ---------
#
# Copyright 2018 Your name here, unless otherwise noted.
#
class odoo(
$version = "8.0"
)
inherits odoo::params {
file {"$logdir":
ensure => "directory"
}
file {"$logfile":
ensure => "present",
owner => "odoo",
group => "odoo",
}
file {"$conffile":
ensure => "present",
owner => "odoo",
group => "odoo",
}
file {"$homedirs":
ensure => 'directory'
}
user {"$odoo_user":
ensure => present,
home => "$odoo_user_homedir",
require => File["$homedirs"],
}
package {$prepkg:
ensure => "installed"
}
vcsrepo { "$odoo_systemdir":
ensure => present,
provider => git,
source => 'https://www.github.com/odoo/odoo.git',
revision => $version,
# submodules => false,
depth => 1,
require => Package[$prepkg]
}
exec {"install_pre":
command => "/bin/ls > /dev/null && $preenv && $pip_cmd install -r $odoo_systemdir/requirements.txt",
require => [
Vcsrepo["$odoo_systemdir"],
Package[$prepkg],
]
}
}

61
wmde-odoo/manifests/params.pp

@ -0,0 +1,61 @@
#x
class odoo::params{
$odoo_user = 'odoo'
$odoo_user_homedir = '/usr/home/odoo'
$homedirs = '/usr/home'
$odoo_systemdir = "$odoo_user_homedir/system"
$logdir = "/var/log/odoo"
$logfile = "/var/log/odoo.log"
case $::osfamily {
'FreeBSD':{
$prepkg = [
"cyrus-sasl",
"textproc/py-libxml2",
"jpeg",
"python",
"devel/py-pip",
"git",
"postgresql93-client",
"gcc",
"libxslt",
"openldap-client",
]
$pip_cmd = "/usr/local/bin/pip"
$preenv = "export CC=gcc && export C_INCLUDE_PATH=/usr/local/include/libxml2:/usr/local/include/sasl"
$conffile = "/usr/local/etc/odoo-server.conf"
}
default: {
$git_pkg = "git"
$python3_pkg = "python3"
$pip3_pkg = "pip3"
$pip_cmd = "/usr/bin/pip"
$preenv = "export CC=gcc && export C_INCLUDE_PATH=/usr/local/include/libxml2:/usr/local/include/sasl"
$conffile = "/usr/local/etc/odoo-server.conf"
$prepkg = [
"git",
"python3-pip",
# "cyrus-sasl",
# "textproc/py-libxml2",
# "jpeg",
# "python",
# "devel/py-pip",
# "git",
# "postgresql93-client",
# "gcc",
# "libxslt",
# "openldap-client",
]
}
}
}

22
wmde-odoo/metadata.json

@ -0,0 +1,22 @@
{
"name": "wmde-odoo",
"version": "0.1.0",
"author": "wmde",
"summary": "Odoo installer",
"license": "Apache-2.0",
"source": "",
"project_page": null,
"issues_url": null,
"dependencies": [
{
"name": "puppetlabs-stdlib",
"version_requirement": ">= 1.0.0"
},
{
"name": "puppetlabs-vcsrepo",
"version_reqjuirement":">= 2.3.0"
}
],
"data_provider": null
}

6
wmde-odoo/spec/classes/init_spec.rb

@ -0,0 +1,6 @@
require 'spec_helper'
describe 'odoo' do
context 'with default values for all parameters' do
it { should contain_class('odoo') }
end
end

1
wmde-odoo/spec/spec_helper.rb

@ -0,0 +1 @@
require 'puppetlabs_spec_helper/module_spec_helper'
Loading…
Cancel
Save