Skip to content
Open
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
1 change: 1 addition & 0 deletions src/roles/foreman/defaults/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ foreman_database_ssl_mode: disable
foreman_database_ssl_ca:
foreman_database_ssl_ca_path: /etc/foreman/db-ca.crt

foreman_name: "{{ ansible_facts['fqdn'] }}"
foreman_url: "http://{{ ansible_facts['fqdn'] }}:3000"

# Puma threads calculation:
Expand Down
2 changes: 2 additions & 0 deletions src/roles/foreman/templates/settings.yaml.j2
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
---
:domain: {{ ansible_facts['domain'] }}
:fqdn: {{ foreman_name }}
:foreman_url: {{ foreman_url }}

:ssl_certificate: /etc/foreman/client_cert.pem
Expand Down
3 changes: 2 additions & 1 deletion src/vars/base.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ foreman_ca_certificate: "{{ ca_bundle }}"
foreman_client_key: "{{ client_key }}"
foreman_client_certificate: "{{ client_certificate }}"
foreman_plugins: "{{ enabled_features | features_to_foreman_plugins }}"
foreman_url: "https://{{ ansible_facts['fqdn'] }}"
foreman_name: "{{ ansible_facts['fqdn'] }}"
foreman_url: "https://{{ foreman_name }}"

httpd_server_ca_certificate: "{{ server_ca_certificate }}"
httpd_client_ca_certificate: "{{ client_ca_certificate }}"
Expand Down
14 changes: 14 additions & 0 deletions tests/foreman_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,20 @@ def test_foreman_recurring_services_exist(server, instance):
service = server.service(f"foreman-recurring@{instance}.service")
assert service.exists


def test_foreman_delivery_method_setting(foremanapi):
delivery_method_setting = foremanapi.list('settings', search='name=delivery_method')
assert delivery_method_setting[0]['value'] == 'smtp'


@pytest.mark.parametrize("setting", ["foreman_url", "unattended_url"])
def test_foreman_fqdn_in_url_settings(foremanapi, server_fqdn, setting):
settings = foremanapi.list('settings', search=f'name={setting}')
assert server_fqdn in settings[0]['value']


@pytest.mark.parametrize("setting", ["administrator", "email_reply_address"])
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I am referring to the administrator, should it search for a domain such as rhos-01.prod.psi.rdu2.redhat.com?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's what the test does. yeah

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I was testing this, but with the patch it was not showing the correct result—possibly due to some issues on my server. I tried it on a fresh server, and it works as expected.

def test_foreman_domain_in_mail_settings(foremanapi, server_fqdn, setting):
settings = foremanapi.list('settings', search=f'name={setting}')
domain = str.join('.', server_fqdn.split('.')[1:])
assert domain in settings[0]['value']