Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch AIO detection to use aio_agent_version fact #834

Merged
merged 1 commit into from
Apr 30, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@
}
}

if $facts['ruby']['sitedir'] =~ /\/opt\/puppetlabs\/puppet/ {
if fact('aio_agent_version') =~ String[1] {
$puppet_ssldir = '/etc/puppetlabs/puppet/ssl'
} else {
$puppet_ssldir = '/var/lib/puppet/ssl'
Expand Down
8 changes: 5 additions & 3 deletions manifests/providers/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,19 @@
# Dependency packages for different providers supplied in this module
$oauth = true

$is_aio = fact('aio_agent_version') =~ String[1]

# OS specific package names
case $facts['os']['family'] {
'RedHat': {
if $facts['ruby']['sitedir'] =~ /\/opt\/puppetlabs\/puppet/ {
if $is_aio {
$oauth_package = 'puppet-agent-oauth'
} else {
$oauth_package = 'rubygem-oauth'
}
}
'Debian': {
if $facts['ruby']['sitedir'] =~ /\/opt\/puppetlabs\/puppet/ {
if $is_aio {
$oauth_package = 'puppet-agent-oauth'
} else {
$oauth_package = 'ruby-oauth'
Expand All @@ -28,7 +30,7 @@
'Linux': {
case $facts['os']['name'] {
'Amazon': {
if $facts['ruby']['sitedir'] =~ /\/opt\/puppetlabs\/puppet/ {
if $is_aio {
$oauth_package = 'puppet-agent-oauth'
} else {
$oauth_package = 'rubygem-oauth'
Expand Down
2 changes: 1 addition & 1 deletion manifests/puppetmaster/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
$puppetmaster_timeout = 60
$puppetmaster_report_timeout = 60

if $facts['ruby']['sitedir'] =~ /\/opt\/puppetlabs\/puppet/ {
if fact('aio_agent_version') =~ String[1] {
$puppet_basedir = '/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet'
$puppet_etcdir = '/etc/puppetlabs/puppet'
$puppet_home = '/opt/puppetlabs/server/data/puppetserver'
Expand Down
10 changes: 2 additions & 8 deletions spec/support/aio.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
# This enforces the AIO Ruby sitedir
add_custom_fact :ruby, ->(os, facts) do
# Non-AIO platforms
return if ['Archlinux', 'FreeBSD', 'DragonFly', 'Windows'].include?(facts[:os]['family'])
return unless facts[:ruby]

version = facts[:ruby]['version'].match(/^(\d+\.\d+)/)[1]
facts[:ruby].merge(sitedir: "/opt/puppetlabs/puppet/lib/ruby/site_ruby/#{version}.0")
add_custom_fact :aio_agent_version, ->(os, facts) do
return facts[:puppetversion] unless ['Archlinux', 'FreeBSD', 'DragonFly', 'Windows'].include?(facts[:os]['family'])
end