Skip to content

Commit

Permalink
Merge pull request #4105 from jrafanie/rely_on_env_for_repo_dir
Browse files Browse the repository at this point in the history
Rely on env variable for manageiq-appliance repo directory
  • Loading branch information
Fryguy committed Sep 8, 2015
2 parents a04d742 + ec7b5e9 commit b6cb04a
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 13 deletions.
Expand Up @@ -112,7 +112,7 @@ def configure_ipa

def configure_pam
say("Configuring pam ...")
cp_template(PAM_CONFIG, TEMPLATE_BASE_DIR)
cp_template(PAM_CONFIG, template_directory)
end

def configure_sssd
Expand Down
12 changes: 8 additions & 4 deletions gems/pending/appliance_console/external_httpd_configuration.rb
@@ -1,11 +1,11 @@
require 'pathname'

module ApplianceConsole
class ExternalHttpdAuthentication
module ExternalHttpdConfiguration
#
# External Authentication Definitions
#
TEMPLATE_BASE_DIR = "/var/www/miq/system/TEMPLATE/"

IPA_COMMAND = "/usr/bin/ipa"
IPA_INSTALL_COMMAND = "/usr/sbin/ipa-client-install"
IPA_GETKEYTAB = "/usr/sbin/ipa-getkeytab"
Expand All @@ -32,6 +32,10 @@ module ExternalHttpdConfiguration
"displayname" => "REMOTE_USER_FULLNAME"
}

def template_directory
Pathname.new(ENV.fetch("APPLIANCE_TEMPLATE_DIRECTORY"))
end

#
# IPA Configuration Methods
#
Expand Down Expand Up @@ -68,8 +72,8 @@ def unconfigure_httpd
end

def configure_httpd_application
cp_template(HTTP_EXTERNAL_AUTH_TEMPLATE, TEMPLATE_BASE_DIR)
cp_template(HTTP_REMOTE_USER, TEMPLATE_BASE_DIR)
cp_template(HTTP_EXTERNAL_AUTH_TEMPLATE, template_directory)
cp_template(HTTP_REMOTE_USER, template_directory)
end

def unconfigure_httpd_application
Expand Down
Expand Up @@ -15,7 +15,7 @@ def self.postgres_dir
end

def self.postgresql_template
RAILS_ROOT.join("../system/TEMPLATE").join(postgres_dir)
PostgresAdmin.template_directory.join(postgres_dir)
end

def initialize(hash = {})
Expand Down
Expand Up @@ -53,8 +53,9 @@
end

it ".postgresql_template" do
PostgresAdmin.stub(:data_directory => Pathname.new("/var/lib/pgsql/data"))
expect(described_class.postgresql_template.to_s).to end_with("system/TEMPLATE/var/lib/pgsql/data")
PostgresAdmin.stub(:data_directory => Pathname.new("/var/lib/pgsql/data"))
PostgresAdmin.stub(:template_directory => Pathname.new("/opt/manageiq/manageiq-appliance/TEMPLATE"))
expect(described_class.postgresql_template.to_s).to end_with("TEMPLATE/var/lib/pgsql/data")
end

context "#update_fstab (private)" do
Expand Down
11 changes: 6 additions & 5 deletions gems/pending/spec/util/postgres_admin_spec.rb
Expand Up @@ -7,11 +7,12 @@
ENV.delete_if { |k, _| k.start_with?("APPLIANCE") }
end

[%w(pg_ctl APPLIANCE_PG_CTL /some/path true),
%w(data_directory APPLIANCE_PG_DATA /some/path true),
%w(service_name APPLIANCE_PG_SERVICE postgresql ),
%w(scl_name APPLIANCE_PG_SCL_NAME postgresql_scl ),
%w(package_name APPLIANCE_PG_PACKAGE_NAME postgresql-server ),
[%w(pg_ctl APPLIANCE_PG_CTL /some/path true),
%w(data_directory APPLIANCE_PG_DATA /some/path true),
%w(service_name APPLIANCE_PG_SERVICE postgresql ),
%w(scl_name APPLIANCE_PG_SCL_NAME postgresql_scl ),
%w(package_name APPLIANCE_PG_PACKAGE_NAME postgresql-server ),
%w(template_directory APPLIANCE_TEMPLATE_DIRECTORY /some/path true),

].each do |method, var, value, pathname_required|
it "#{method}" do
Expand Down
4 changes: 4 additions & 0 deletions gems/pending/util/postgres_admin.rb
Expand Up @@ -12,6 +12,10 @@ def self.data_directory
Pathname.new(ENV.fetch("APPLIANCE_PG_DATA"))
end

def self.template_directory
Pathname.new(ENV.fetch("APPLIANCE_TEMPLATE_DIRECTORY"))
end

def self.service_name
ENV.fetch("APPLIANCE_PG_SERVICE")
end
Expand Down

0 comments on commit b6cb04a

Please sign in to comment.