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

{WIP} remove exporter class state from infra nodes #36

Merged
merged 8 commits into from Jan 12, 2021
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
57 changes: 57 additions & 0 deletions manifests/remove_exporter.pp
@@ -0,0 +1,57 @@
# @summary A short summary of the purpose of this class
#
# A description of what this class does
#
# @example
# include rsan::remove_exporter
class rsan::remove_exporter {


#Disable NFS Server

# class { '::nfs':
# server_enabled => false
#}

file { '/etc/exports':
ensure => absent,
}

service {'nfs':
ensure => stopped,
}


if $facts['pe_postgresql_info'] != undef and $facts['pe_postgresql_info']['installed_server_version'] != '' {


$dbs = ['pe-activity', 'pe-classifier', 'pe-inventory', 'pe-puppetdb', 'pe-rbac', 'pe-orchestrator']
$dbs.each |$db|{

$dropowned_cmd = 'DROP OWNED BY rsan'
pe_postgresql_psql { "${dropowned_cmd} on ${db}":
command => $dropowned_cmd,
db => $db,
port => $pe_postgresql::server::port,
psql_user => $pe_postgresql::server::user,
psql_group => $pe_postgresql::server::group,
psql_path => $pe_postgresql::server::psql_path,
require => [Class['pe_postgresql::server']]
}

}


$droprole_cmd = 'DROP ROLE rsan'
pe_postgresql_psql { "${droprole_cmd} ":
command => $droprole_cmd,
db => pe-puppetdb,
port => $pe_postgresql::server::port,
psql_user => $pe_postgresql::server::user,
psql_group => $pe_postgresql::server::group,
psql_path => $pe_postgresql::server::psql_path,
require => Pe_postgresql_psql['DROP OWNED BY rsan on pe-puppetdb'],
}

}
}
5 changes: 3 additions & 2 deletions spec/classes/importer_spec.rb
Expand Up @@ -4,13 +4,14 @@

describe 'rsan::importer' do
before :each do
Puppet::Parser::Functions.newfunction(:puppetdb_query, :type => :rvalue, :arity => 1) do |args|
Puppet::Parser::Functions.newfunction(:puppetdb_query, type: :rvalue, arity: 1) do |_args|
[]
end
end
end
on_supported_os.each do |os, os_facts|
context "on #{os}" do
let(:facts) { os_facts }

it { is_expected.to compile }
end
end
Expand Down
13 changes: 13 additions & 0 deletions spec/classes/remove_exporter_spec.rb
@@ -0,0 +1,13 @@
# frozen_string_literal: true

require 'spec_helper'

describe 'rsan::remove_exporter' do
on_supported_os.each do |os, os_facts|
context "on #{os}" do
let(:facts) { os_facts }

it { is_expected.to compile }
end
end
end