Skip to content
Permalink
Browse files

Merge 333688a into 418e29f

  • Loading branch information...
alvagante committed Oct 9, 2019
2 parents 418e29f + 333688a commit 05f8f1d6982a71d1bae55249d41362eef35c9fe4
Showing with 69 additions and 38 deletions.
  1. +3 −0 CHANGELOG.md
  2. +13 −0 Gemfile.local
  3. +7 −1 lib/puppet/parser/functions/tp_lookup.rb
  4. +16 −25 manifests/init.pp
  5. +16 −2 manifests/install.pp
  6. +3 −2 manifests/repo.pp
  7. +11 −8 metadata.json
@@ -1,5 +1,8 @@
# CHANGELOG

# 2.4.0
* Added manage_repo option

# 2.3.5
* Explicitly close opn files in tp_lookup
* Add purge_dirs argument to tp class
@@ -0,0 +1,13 @@
# Danger integration: http://danger.systems
gem 'danger'
gem 'danger-changelog'
gem 'danger-mention'

# Coveralls
gem 'coveralls', require: false

# Semantic Puppet
gem 'semantic_puppet', require: false
gem 'puppet-blacksmith', require: false
# vim: syntax=ruby

@@ -29,13 +29,19 @@ module Puppet::Parser::Functions

hiera_file = File.open(hiera_file_path)
hiera = YAML::load(hiera_file)
if lookupvar("upstream_repo")
repo = 'upstream'
else
repo = ''
end

model = {
:title => app,
:osfamily => lookupvar("::osfamily"),
:operatingsystem => lookupvar("::operatingsystem"),
:operatingsystemmajrelease => lookupvar("::operatingsystemmajrelease"),
:operatingsystemrelease => lookupvar("::operatingsystemrelease"),
:repo => exist?("repo") && lookupvar("repo"),
:repo => repo,
}

hiera[:hierarchy].reverse!.each { | p |
@@ -60,39 +60,30 @@
} else {
$install_hash.each | $name, $options| { tp_install($name, $options) }
}
if $conf_hash != {} {
$conf_hash.each |$k,$v| {
tp::conf { $k:
* => $v,
}

$conf_hash.each |$k,$v| {
tp::conf { $k:
* => $v,
}
}
if $dir_hash != {} {
$dir_hash.each |$k,$v| {
tp::dir { $k:
* => $v,
}
$dir_hash.each |$k,$v| {
tp::dir { $k:
* => $v,
}
}
if $concat_hash != {} {
$concat_hash.each |$k,$v| {
tp::concat { $k:
* => $v,
}
$concat_hash.each |$k,$v| {
tp::concat { $k:
* => $v,
}
}
if $stdmod_hash != {} {
$stdmod_hash.each |$k,$v| {
tp::stdmod { $k:
* => $v,
}
$stdmod_hash.each |$k,$v| {
tp::stdmod { $k:
* => $v,
}
}
if $repo_hash != {} {
$repo_hash.each |$k,$v| {
tp::repo { $k:
* => $v,
}
$repo_hash.each |$k,$v| {
tp::repo { $k:
* => $v,
}
}
}
@@ -21,6 +21,12 @@
# ensure => '4.0.1',
# }
#
# @example installation of a package from its upstream repo, rather
# than default OS based one. Relevant tinydata must be present.
# tp::install { 'mongodb':
# upstream_repo => true,
# }
#
# @example installation and configuration via an options_hash
# Note: this works when auto_conf is true (as default) AND when
# is defined $settings['config_file_template'] with a valid template
@@ -68,6 +74,11 @@
# @param settings_hash An hash that can override the application settings tp
# returns, according to the underlying OS and the default behaviour
#
# @param upstream_repo Boolean to enable usage of upstream repo for the app and
# install packages from it rather than default local OS one
# For working needs relevant tinydata settings, like repo_package_url or
# repo_url
#
# @param auto_repo Boolean to enable automatic package repo management for the
# specified application. Repo data is not always provided.
#
@@ -122,6 +133,7 @@
Optional[Boolean] $auto_prerequisites = undef,
Boolean $auto_prereq = false,

Optional[Boolean] $upstream_repo = undef,
Variant[Undef,String] $repo = undef,
Array $repo_exec_environment = [],
Boolean $manage_package = true,
@@ -186,8 +198,9 @@
}

# Automatic repo management
if $auto_repo == true
and ( $settings[repo_url] or $settings[yum_mirrorlist] or $settings[repo_package_url] ) {
$use_upstream_repo = pick($upstream_repo,$settings[upstream_repo])
if $use_upstream_repo or
( $auto_repo == true and ( $settings[repo_url] or $settings[yum_mirrorlist] or $settings[repo_package_url] ) ) {
$repo_enabled = $ensure ? {
'absent' => false,
false => false,
@@ -200,6 +213,7 @@
repo => $repo,
settings_hash => $settings_hash,
exec_environment => $repo_exec_environment,
upstream_repo => $use_upstream_repo,
}
}

@@ -9,6 +9,7 @@
Hash $settings_hash = { },

Variant[Undef,String] $repo = undef,
Variant[Undef,Boolean] $upstream_repo = undef,

String[1] $description = "${title} repository",

@@ -136,9 +137,9 @@
}
}
'RedHat': {
if !defined(Yumrepo[$title])
$yumrepo_title = pick($settings[repo_filename],$title)
if !defined(Yumrepo[$yumrepo_title])
and ( $settings[repo_url] or $settings[yum_mirrorlist] ) {
$yumrepo_title = pick($settings[repo_filename],$title)
yumrepo { $yumrepo_title:
enabled => $enabled_num,
descr => $description,
@@ -1,6 +1,6 @@
{
"name": "example42-tp",
"version": "2.3.5",
"version": "2.4.0",
"summary": "Tiny Puppet",
"license": "Apache-2.0",
"author": "Example42 Gmbh",
@@ -27,28 +27,32 @@
"operatingsystem": "RedHat",
"operatingsystemrelease": [
"6",
"7"
"7",
"8"
]
},
{
"operatingsystem": "CentOS",
"operatingsystemrelease": [
"6",
"7"
"7",
"8"
]
},
{
"operatingsystem": "OracleLinux",
"operatingsystemrelease": [
"6",
"7"
"7",
"8"
]
},
{
"operatingsystem": "Scientific",
"operatingsystemrelease": [
"6",
"7"
"7",
"8"
]
},
{
@@ -72,13 +76,12 @@
"6",
"7",
"8",
"8"
"9"
]
},
{
"operatingsystem": "Ubuntu",
"operatingsystemrelease": [
"10.04",
"12.04",
"14.04",
"16.04",
@@ -95,7 +98,7 @@
"requirements": [
{
"name": "puppet",
"version_requirement": ">= 4.6.0 < 7.0.0"
"version_requirement": ">= 4.6.0 < 8.0.0"
}
],
"dependencies": [

0 comments on commit 05f8f1d

Please sign in to comment.
You can’t perform that action at this time.