diff --git a/manifests/config.pp b/manifests/config.pp index 43f2f46a..7e3e5677 100644 --- a/manifests/config.pp +++ b/manifests/config.pp @@ -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'), @@ -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', - } - } diff --git a/manifests/init.pp b/manifests/init.pp index 76c24060..6c45e31a 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -113,8 +113,6 @@ class { 'certs::foreman': } - class { 'katello::service': } - Service['httpd'] -> Exec['foreman-rake-db:seed'] User<|title == apache|>{groups +> $user_groups} diff --git a/manifests/params.pp b/manifests/params.pp index 245c3b1a..771d5c68 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -47,16 +47,8 @@ $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)) @@ -64,19 +56,11 @@ # 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' } diff --git a/manifests/service.pp b/manifests/service.pp deleted file mode 100644 index 08e736e9..00000000 --- a/manifests/service.pp +++ /dev/null @@ -1,4 +0,0 @@ -# Katello Services -class katello::service { - include pulp::service -} diff --git a/spec/classes/katello_config_spec.rb b/spec/classes/katello_config_spec.rb index acf04afc..9dfa5d55 100644 --- a/spec/classes/katello_config_spec.rb +++ b/spec/classes/katello_config_spec.rb @@ -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 diff --git a/spec/classes/katello_spec.rb b/spec/classes/katello_spec.rb index 2e910441..26a5a30c 100644 --- a/spec/classes/katello_spec.rb +++ b/spec/classes/katello_spec.rb @@ -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'). @@ -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 @@ -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 @@ -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 @@ -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 diff --git a/templates/katello.yml.erb b/templates/katello.yml.erb index 83b9d4ff..de8a7278 100644 --- a/templates/katello.yml.erb +++ b/templates/katello.yml.erb @@ -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 %> @@ -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