Skip to content

Commit

Permalink
Merge pull request #12 from treydock/data
Browse files Browse the repository at this point in the history
Use module Hiera data
  • Loading branch information
treydock authored Oct 30, 2019
2 parents 10bf69e + ba5d7fe commit c4555c4
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 34 deletions.
4 changes: 4 additions & 0 deletions data/common.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
globus::repo_baseurl: "https://downloads.globus.org/toolkit/gt6/stable/rpm/%{lookup('globus::url_os')}/%{facts.os.release.major}/$basearch/"
globus::repo_baseurl_v5: "https://downloads.globus.org/globus-connect-server/stable/rpm/%{lookup('globus::url_os')}/%{facts.os.release.major}/$basearch/"
globus::release_url: 'https://downloads.globus.org/toolkit/globus-connect-server/globus-connect-server-repo-latest.noarch.rpm'
4 changes: 4 additions & 0 deletions data/os/RedHat.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
globus::url_os: el
globus::repo_dependencies:
- yum-plugin-priorities
14 changes: 14 additions & 0 deletions hiera.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
version: 5

defaults: # Used for any hierarchy level that omits these keys.
datadir: data # This path is relative to hiera.yaml's directory.
data_hash: yaml_data # Use the built-in YAML backend.

hierarchy:
- name: 'os family major release'
path: "os/%{facts.os.family}/%{facts.os.release.major}.yaml"
- name: 'os family'
path: "os/%{facts.os.family}.yaml"
- name: 'common'
path: 'common.yaml'
24 changes: 16 additions & 8 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
# @param run_setup_commands
# @param manage_firewall
# @param manage_epel
# @param repo_dependencies
# @param package_name
# @param globus_user
# @param globus_password
Expand Down Expand Up @@ -89,16 +90,17 @@
Boolean $include_io_server = true,
Boolean $include_id_server = true,
Boolean $include_oauth_server = false,
Variant[Stdlib::Httpsurl, Stdlib::Httpurl] $release_url = $globus::params::release_url,
Variant[Stdlib::Httpsurl, Stdlib::Httpurl] $repo_baseurl = $globus::params::repo_baseurl,
Variant[Stdlib::Httpsurl, Stdlib::Httpurl] $repo_baseurl_v5 = $globus::params::repo_baseurl_v5,
Variant[Stdlib::Httpsurl, Stdlib::Httpurl] $release_url = 'https://downloads.globus.org/toolkit/globus-connect-server/globus-connect-server-repo-latest.noarch.rpm',
Variant[Stdlib::Httpsurl, Stdlib::Httpurl] $repo_baseurl = "https://downloads.globus.org/toolkit/gt6/stable/rpm/el/${facts['os']['release']['major']}/\$basearch/",
Variant[Stdlib::Httpsurl, Stdlib::Httpurl] $repo_baseurl_v5 = "https://downloads.globus.org/globus-connect-server/stable/rpm/el/${facts['os']['release']['major']}/\$basearch/",
Boolean $remove_cilogon_cron = false,
Array $extra_gridftp_settings = [],
Optional[String] $first_gridftp_callback = undef,
Boolean $manage_service = true,
Boolean $run_setup_commands = true,
Boolean $manage_firewall = true,
Boolean $manage_epel = true,
Array $repo_dependencies = ['yum-plugin-priorities'],

String $package_name = 'globus-connect-server53',

Expand Down Expand Up @@ -169,12 +171,18 @@
Boolean $oauth_server_behind_firewall = false,
Optional[String] $oauth_stylesheet = undef,
Optional[String] $oauth_logo = undef,
) inherits globus::params {

$releasever = $facts['os']['release']['major']
if versioncmp($releasever, '6') <= 0 {
) {

$osfamily = $facts.dig('os', 'family')
$osmajor = $facts.dig('os', 'release', 'major')
$supported = ['RedHat-6','RedHat-7']
$os = "${osfamily}-${osmajor}"
if ! ($os in $supported) {
fail("Unsupported OS: ${osfamily}, module ${module_name} only supports RedHat 6 and 7")
}
if versioncmp($osmajor, '6') <= 0 {
if String($version) == '5' {
fail("${module_name}: Version 5 is not supported on OS major release ${releasever}")
fail("${module_name}: Version 5 is not supported on OS major release ${osmajor}")
}
}

Expand Down
24 changes: 0 additions & 24 deletions manifests/params.pp

This file was deleted.

2 changes: 1 addition & 1 deletion manifests/repo/el.pp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# @summary Manage globus repo
# @api private
class globus::repo::el {
ensure_packages([$globus::params::yum_priorities_package])
ensure_packages([$globus::repo_dependencies])

exec { 'RPM-GPG-KEY-Globus':
path => '/usr/bin:/bin:/usr/sbin:/sbin',
Expand Down
1 change: 0 additions & 1 deletion spec/classes/globus_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
it { is_expected.to compile.with_all_deps }

it { is_expected.to create_class('globus') }
it { is_expected.to contain_class('globus::params') }

it { is_expected.to contain_class('epel').that_comes_before('Class[globus::repo::el]') }
it { is_expected.to contain_class('globus::repo::el').that_comes_before('Class[globus::install]') }
Expand Down

0 comments on commit c4555c4

Please sign in to comment.