Defined Type: mrepo::repo::rhn

Defined in:
manifests/repo/rhn.pp

Overview

This define creates and manages a redhat mrepo repository.

Parameters

rhn

Whether to generate rhn metadata for these repos. Default: false

typerelease

The name of the RHN release as understood by mrepo. Optional.

Examples

TODO

Further examples can be found in the module README.

Author

Adrien Thebo <adrien@puppetlabs.com>

Copyright 2012 Puppet Labs, unless otherwise noted

Parameters:

  • ensure (Any)
  • release (Any)
  • arch (Any)
  • urls (Any) (defaults to: {})
  • metadata (Any) (defaults to: 'repomd')
  • update (Any) (defaults to: 'nightly')
  • hour (Any) (defaults to: '0')
  • iso (Any) (defaults to: '')
  • typerelease (Any) (defaults to: $release)
  • repotitle (Any) (defaults to: $name)


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
88
89
90
91
92
93
94
95
# File 'manifests/repo/rhn.pp', line 26

define mrepo::repo::rhn (
  $ensure,
  $release,
  $arch,
  $urls        = {},
  $metadata    = 'repomd',
  $update      = 'nightly',
  $hour        = '0',
  $iso         = '',
  $typerelease = $release,
  $repotitle   = $name,
) {
  include ::mrepo::params

  $http_proxy    = $mrepo::http_proxy
  $https_proxy   = $mrepo::https_proxy
  $rhn_username  = $mrepo::rhn_username
  $rhn_password  = $mrepo::rhn_password
  $src_root      = $mrepo::src_root
  $user          = $mrepo::user
  $group         = $mrepo::group
  $genid_command = $mrepo::genid_command

  $sysid_command = "${genid_command}\s-r\s${typerelease}\s-u\s\'${rhn_username}\'\s-p\s\'${rhn_password}\'\s-a\s${arch}\s\'${src_root}/${name}\'"

  # Workaround for http://projects.puppetlabs.com/issues/19848
  if $http_proxy or $https_proxy {
    if $http_proxy and $https_proxy {
      $gen_env = ["http_proxy=${http_proxy}","https_proxy=${https_proxy}"]
    }
    elsif $http_proxy {
      $gen_env = "http_proxy=${http_proxy}"
    }
    elsif $https_proxy {
      $gen_env = "https_proxy=${https_proxy}"
    }
  }

  if $ensure == 'present' and $gen_env {
    exec { "Generate systemid ${name} - ${arch}":
      command     => $sysid_command,
      path        => [ '/bin', '/usr/bin' ],
      user        => $user,
      group       => $group,
      creates     => "${src_root}/${name}/systemid",
      require     => [
        Class['mrepo::package'],
        Class['mrepo::rhn'],
      ],
      before      => Exec["Generate mrepo repo ${name}"],
      logoutput   => on_failure,
      environment => $gen_env,
    }
  }
  elsif $ensure == 'present' {
    exec { "Generate systemid ${name} - ${arch}":
      command   => $sysid_command,
      path      => [ '/bin', '/usr/bin' ],
      user      => $user,
      group     => $group,
      creates   => "${src_root}/${name}/systemid",
      require   => [
        Class['mrepo::package'],
        Class['mrepo::rhn'],
      ],
      before    => Exec["Generate mrepo repo ${name}"],
      logoutput => on_failure,
    }
  }
}