Puppet Class: odoo::repo10

Defined in:
manifests/repo10.pp

Overview

Install a repository to install an Odoo 10 package from.

Examples:

Declaring the class

class { '::odoo::repo10':
  before => Class['odoo']
}

Parameters:

  • ensure (absent | present) (defaults to: present)

    Ensure the the repository is either absent or present.

  • descr (string) (defaults to: 'Odoo Nightly repository')

    A string to describe the repository.

  • key_id (string) (defaults to: '5D134C924CB06330DCEFE2A1DEF2A2198183CBB5')

    The key for the Debian APT repository. This option is ignored on the Red Hat family.

  • key_url (string) (defaults to: 'https://nightly.odoo.com/odoo.key')

    A URL to the key for the Debian APT repository. This option is ignored on the Red Hat family.

  • pkg_url (string) (defaults to: undef)

    The URL to a package. This defaults to 'nightly.odoo.com/10.0/nightly/rpm/' on the Red Hat family and 'nightly.odoo.com/9.0/nightly/deb/' on Debian.

  • release (string) (defaults to: './')

    The release for the Debian APT repository. This option is ignored on the Red Hat family.

  • repos (string) (defaults to: '')

    The repos for the Debian APT repository. This option is ignored on the Red Hat family.



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# File 'manifests/repo10.pp', line 22

class odoo::repo10 (
  $ensure  = present,
  $descr   = 'Odoo Nightly repository',
  $key_id  = '5D134C924CB06330DCEFE2A1DEF2A2198183CBB5',
  $key_url = 'https://nightly.odoo.com/odoo.key',
  $pkg_url = undef,
  $release = './',
  $repos = '',
  ) {
  case $::osfamily {
    'RedHat': {
      if $pkg_url != undef {
        $baseurl = $pkg_url
      } else {
        $baseurl = 'http://nightly.odoo.com/10.0/nightly/rpm/'
      }

      yumrepo { 'odoo':
        ensure   => $ensure,
        descr    => $descr,
        baseurl  => $baseurl,
        enabled  => 1,
        gpgcheck => 0,
      }
    }
    'Debian': {
      include apt
      include apt::update

      apt::key {'odookey':
        ensure => $ensure,
        id     => $key_id,
        source => $key_url,
        before => Apt::Source['odoo'],
      }

      if $pkg_url != undef {
        $location = $pkg_url
      } else {
        $location = 'http://nightly.odoo.com/10.0/nightly/deb/'
      }

      apt::source {'odoo':
        ensure   => $ensure,
        location => $location,
        comment  => $descr,
        release  => $release,
        repos    => $repos,
        include  => {
          'src' => false,
        },
        notify   => Exec['update-odoo-repos'],
      }

      # Required to wrap apt_update
      exec {'update-odoo-repos':
        refreshonly => true,
        command     => '/bin/true',
        require     => Exec['apt_update'],
      }
    }
    default: {
      warning("OS family ${::osfamily} not supported")
    }
  }
}