Skip to content

Commit

Permalink
Merge pull request #50 from ehelms/fixes-8585
Browse files Browse the repository at this point in the history
Fixes #8585: Remove unused configuration and unneeded functions.
  • Loading branch information
ehelms committed Mar 5, 2015
2 parents f9406fa + 5687ce1 commit ecd73be
Show file tree
Hide file tree
Showing 7 changed files with 79 additions and 91 deletions.
15 changes: 0 additions & 15 deletions manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,6 @@
notify => [Service['foreman-tasks'], Class['foreman::service']],
}

file { '/etc/sysconfig/katello':
content => template('katello/etc/sysconfig/katello.erb'),
owner => 'root',
group => 'root',
mode => '0644',
}

foreman::config::passenger::fragment{ 'katello':
content => template('katello/etc/httpd/conf.d/05-foreman.d/katello.conf.erb'),
ssl_content => template('katello/etc/httpd/conf.d/05-foreman-ssl.d/katello.conf.erb'),
Expand All @@ -37,12 +30,4 @@
mode => '0755',
}

file { "${katello::config_dir}/katello/client.conf":
ensure => file,
content => template('katello/client.conf.erb'),
owner => 'root',
group => 'root',
mode => '0644',
}

}
2 changes: 0 additions & 2 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,6 @@

class { 'certs::foreman': }

class { 'katello::service': }

Service['httpd'] -> Exec['foreman-rake-db:seed']

User<|title == apache|>{groups +> $user_groups}
Expand Down
18 changes: 1 addition & 17 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -47,36 +47,20 @@
$config_dir = '/etc/foreman/plugins'
$log_dir = '/var/log/foreman/plugins'

# sysconfig settings
$job_workers = 1

# OAUTH settings
$oauth_key = 'katello'

# we set foreman oauth key to foreman, so that katello knows where the call
# comes from and can find the rigth secret. This way only one key-secret pair
# is needed to be mainained for duplex communication.
$foreman_oauth_key = 'foreman'
$oauth_token_file = 'katello_oauth_secret'
$oauth_secret = cache_data($oauth_token_file, random_password(32))

$post_sync_token = cache_data('post_sync_token', random_password(32))

# Subsystems settings
$candlepin_url = 'https://localhost:8443/candlepin'
$pulp_url = subsystem_url('pulp/api/v2/')
$foreman_url = subsystem_url('foreman')
$pulp_url = "https://${::fqdn}/pulp/api/v2"

# database reinitialization flag
$reset_data = 'NONE'

# Delete this from configuration check
$use_foreman = false
$ldap_roles = false
$validate_ldap = false

$use_passenger = true

$qpid_url = "amqp:ssl:${::fqdn}:5671"
$candlepin_event_queue = 'katello_event_queue'
}
4 changes: 0 additions & 4 deletions manifests/service.pp

This file was deleted.

78 changes: 75 additions & 3 deletions spec/classes/katello_config_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,94 @@
describe 'katello::config' do
let :facts do
{
:concat_basedir => '/tmp',
:interfaces => '',
:concat_basedir => '/tmp',
:interfaces => '',
:osfamily => 'RedHat',
:operatingsystem => 'CentOS',
:operatingsystemrelease => '6.5',
:fqdn => 'host.example.org',
}
end

context 'default config settings' do
let(:pre_condition) do
['include foreman','include certs']
[
'include foreman',
'include certs',
'class {"katello":' \
'post_sync_token => test_token,' \
'oauth_secret => secret' \
'}'
]
end

it 'should NOT set the cdn-ssl-version' do
should_not contain_file('/etc/foreman/plugins/katello.yaml').
with_content(/cdn_ssl_version/)
end

it 'should generate correct katello.yaml' do
should contain_file('/etc/foreman/plugins/katello.yaml')
content = catalogue.resource('file', '/etc/foreman/plugins/katello.yaml').send(:parameters)[:content]
content.split("\n").reject { |c| c =~ /(^#|^$)/ }.should == [
'common:',
' rest_client_timeout: 120',
' post_sync_url: https://localhost/katello/api/v2/repositories/sync_complete?token=test_token',
' candlepin:',
' url: https://localhost:8443/candlepin',
' oauth_key: katello',
' oauth_secret: secret',
' pulp:',
" url: https://#{facts[:fqdn]}/pulp/api/v2",
' oauth_key: katello',
' oauth_secret: secret',
' qpid:',
" url: amqp:ssl:#{facts[:fqdn]}:5671",
' subscriptions_queue_address: katello_event_queue'
]
end
end

context 'when http proxy parameters are specified' do
let(:pre_condition) do
[
'include foreman',
'include certs',
'class {"katello":' \
'post_sync_token => "test_token",' \
'oauth_secret => "secret",' \
'proxy_url => "http://myproxy.org",' \
'proxy_port => 8888,' \
'proxy_username => "admin",' \
'proxy_password => "secret_password"' \
'}'
]
end

it 'should generate correct katello.yaml' do
should contain_file('/etc/foreman/plugins/katello.yaml')
content = catalogue.resource('file', '/etc/foreman/plugins/katello.yaml').send(:parameters)[:content]
content.split("\n").reject { |c| c =~ /(^#|^$)/ }.should == [
'common:',
' rest_client_timeout: 120',
' post_sync_url: https://localhost/katello/api/v2/repositories/sync_complete?token=test_token',
' candlepin:',
' url: https://localhost:8443/candlepin',
' oauth_key: katello',
' oauth_secret: secret',
' pulp:',
" url: https://#{facts[:fqdn]}/pulp/api/v2",
' oauth_key: katello',
' oauth_secret: secret',
' qpid:',
" url: amqp:ssl:#{facts[:fqdn]}:5671",
' subscriptions_queue_address: katello_event_queue',
' cdn_proxy:',
' host: http://myproxy.org',
' port: 8888',
' user: admin',
' password: secret_password'
]
end
end
end
5 changes: 0 additions & 5 deletions spec/classes/katello_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

it { should contain_class('katello::install') }
it { should contain_class('katello::config') }
it { should contain_class('katello::service') }

it "should configure a qpid client" do
should contain_class('qpid::client').
Expand Down Expand Up @@ -57,7 +56,6 @@

it { should contain_class('katello::install') }
it { should contain_class('katello::config') }
it { should contain_class('katello::service') }
end

context 'on oel' do
Expand All @@ -77,7 +75,6 @@

it { should contain_class('katello::install') }
it { should contain_class('katello::config') }
it { should contain_class('katello::service') }
end

context 'on fedora' do
Expand All @@ -97,7 +94,6 @@

it { should contain_class('katello::install') }
it { should contain_class('katello::config') }
it { should contain_class('katello::service') }
end

context 'on sl' do
Expand All @@ -117,7 +113,6 @@

it { should contain_class('katello::install') }
it { should contain_class('katello::config') }
it { should contain_class('katello::service') }
end

context 'on unsupported osfamily' do
Expand Down
48 changes: 3 additions & 45 deletions templates/katello.yml.erb
Original file line number Diff line number Diff line change
Expand Up @@ -12,43 +12,24 @@
# see /usr/share/katello/config.katello_defaults.yml for available options

common:
app_mode: 'katello'
<%- if @cdn_ssl_version && !@cdn_ssl_version.strip.empty?-%>
cdn_ssl_version: <%= @cdn_ssl_version %>
<%- end -%>

warden: <%= scope.lookupvar("katello::params::auth_method") %>
ldap_roles: <%= scope.lookupvar("katello::params::ldap_roles") %>
validate_ldap: <%= scope.lookupvar("katello::params::validate_ldap") %>
rest_client_timeout: 120

url_prefix: <%= @deployment_url %>
host: <%= has_variable?("fqdn") ? @fqdn : hostname %>
port:
use_ssl: true
use_foreman: <%= scope.lookupvar("katello::params::use_foreman") %>

post_sync_url: https://localhost<%= scope.lookupvar("katello::params::deployment_url") %>/api/v2/repositories/sync_complete?token=<%= scope.lookupvar("post_sync_token") %>
post_sync_url: https://localhost<%= @deployment_url %>/api/v2/repositories/sync_complete?token=<%= @post_sync_token %>

candlepin:
url: <%= scope.lookupvar("katello::params::candlepin_url") %>
url: <%= @candlepin_url %>
oauth_key: <%= @oauth_key %>
oauth_secret: <%= @oauth_secret %>

pulp:
url: <%= scope.lookupvar("katello::params::pulp_url") %>
url: <%= @pulp_url %>
oauth_key: <%= @oauth_key %>
oauth_secret: <%= @oauth_secret %>

foreman:
url: <%= scope.lookupvar("katello::params::foreman_url") %>
oauth_key: <%= scope.lookupvar("katello::params::foreman_oauth_key") %>
oauth_secret: <%= scope.lookupvar("katello::params::oauth_secret") %>

cloud_forms:
oauth_key: <%= scope.lookupvar("katello::params::oauth_key") %>
oauth_secret: <%= scope.lookupvar("katello::params::oauth_secret") %>

qpid:
url: <%= @qpid_url %>
subscriptions_queue_address: <%= @candlepin_event_queue %>
Expand All @@ -60,26 +41,3 @@ common:
user: <%= @proxy_username %>
password: <%= @proxy_password %>
<%- end -%>

ldap_fluff_config:
host: <%= scope.lookupvar("katello::params::ldap_server") %>
port: <%= scope.lookupvar("katello::params::ldap_port") %>
encryption: <%= scope.lookupvar("katello::params::ldap_encryption") %>
base_dn: <%= scope.lookupvar("katello::params::ldap_users_basedn") %>
group_base: <%= scope.lookupvar("katello::params::ldap_groups_basedn") %>
server_type: <%= scope.lookupvar("katello::params::ldap_server_type") %>
service_user: <%= scope.lookupvar("katello::params::ldap_service_user") %>
service_pass: <%= scope.lookupvar("katello::params::ldap_service_pass") %>
anon_queries: <%= scope.lookupvar("katello::params::ldap_anon_queries") %>
ad_domain: <%= scope.lookupvar("katello::params::ldap_ad_domain") %>

# authentication
sso:
<%- if scope.lookupvar("katello::params::deployment") == 'katello' -%>
enable: true
<%- end -%>
<%- if scope.lookupvar("katello::params::deployment") == 'headpin' -%>
enable: false
<%- end -%>
provider_url: https://<%= scope.lookupvar('fqdn') -%>/signo
logout_path: /logout

0 comments on commit ecd73be

Please # to comment.