Skip to content
Merged
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
4 changes: 3 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,9 @@ jobs:
--certificate-bundle $(pwd)/.var/lib/foremanctl/proxy.example.com.tar.gz \
--foreman-fqdn quadlet.example.com \
--oauth-consumer-key $(cat .var/lib/foremanctl/foreman-oauth-consumer-key) \
--oauth-consumer-secret $(cat .var/lib/foremanctl/foreman-oauth-consumer-secret)
--oauth-consumer-secret $(cat .var/lib/foremanctl/foreman-oauth-consumer-secret) \
--templates-listen-on http \
--templates-url http://proxy.example.com:8000
- name: Run tests
run: |
./forge test --pytest-args="--server-hostname=proxy"
Expand Down
5 changes: 3 additions & 2 deletions docs/user/parameters.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,9 @@ There are multiple use cases from the users perspective that dictate what parame
| `--add-feature content/ostree` | Enable OSTree content type | `--foreman-proxy-content-enable-ostree` |
| `--bmc-ipmi-implementation` | IPMI implementation to use for BMC | `--foreman-proxy-bmc-default-provider` |
| `--bmc-redfish-verify-ssl` | Verify SSL certificates for Redfish BMC connections | `--foreman-proxy-bmc-redfish-verify-ssl` |
| `--add-feature templates` | Enable Templates feature on Smart Proxy | `--foreman-proxy-templates` |
Comment thread
shubhamsg199 marked this conversation as resolved.
| `--templates-listen-on` | Templates proxy to listen on https, http, or both | `--foreman-proxy-templates-listen-on` |
| `--templates-url` | URL that hosts will use to contact the proxy for provisioning templates | `--foreman-proxy-templates-url` |

### Undetermined

Expand Down Expand Up @@ -200,8 +203,6 @@ There are multiple use cases from the users perspective that dictate what parame
| `--foreman-proxy-realm-provider` | | | |
| `--foreman-proxy-registration` | | | |
| `--foreman-proxy-registration-url` | | | |
| `--foreman-proxy-templates` | | | |
| `--foreman-proxy-template-url` | | | |
| `--puppet-server` | | puppet | server |
| `--puppet-server-ca` | | puppet | server_ca |
| `--puppet-dns-alt-names` | | puppet | dns_alt_names |
Expand Down
4 changes: 4 additions & 0 deletions src/features.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,7 @@ webhooks:
foreman:
plugin_name: foreman_webhooks
hammer: foreman_webhooks
templates:
description: Templates feature for foreman-proxy
foreman_proxy:
plugin_name: templates
10 changes: 10 additions & 0 deletions src/playbooks/_foreman_proxy/metadata.obsah.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,13 @@ variables:
parameter: --bmc-redfish-verify-ssl
help: Verify SSL certificates for Redfish BMC connections.
type: Boolean
foreman_proxy_templates_listen_on:
parameter: --templates-listen-on
help: Templates proxy to listen on https, http, or both.
choices:
- http
- https
- both
Comment on lines +13 to +19

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why is it needed to expose this? In the old installer we exposed it because it was the way we did, but it was an advanced option. In foremanctl I think shouldn't expose this.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Addressed this in #706

foreman_proxy_templates_url:
parameter: --templates-url
help: URL that hosts will use to contact the proxy for provisioning templates (e.g. http://<proxy-fqdn>:8000). Required when templates feature is enabled.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

There is a default which implies it isn't required to specify.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Updated in #706

3 changes: 3 additions & 0 deletions src/roles/foreman_proxy/defaults/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ foreman_proxy_disabled_features: "{{ foreman_proxy_available_features | differen

foreman_proxy_foreman_server_url: "https://{{ ansible_facts['fqdn'] }}"

# Templates settings
foreman_proxy_templates_url: "http://{{ foreman_proxy_name }}:8000"

# BMC settings
foreman_proxy_bmc_ipmi_implementation: ipmitool
foreman_proxy_bmc_redfish_verify_ssl: true
Expand Down
4 changes: 4 additions & 0 deletions src/roles/foreman_proxy/templates/settings.d/templates.yml.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
:enabled: {% if foreman_proxy_templates_listen_on | default('both') == 'both' %}true{% else %}{{ foreman_proxy_templates_listen_on }}{% endif %}

:template_url: {{ foreman_proxy_templates_url }}
1 change: 1 addition & 0 deletions src/vars/flavors/foreman-proxy-content.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ flavor_features:
- content/container
- content/ansible
- content/python
- templates

pulp_mirror: true
pulp_rhsm_url: "https://{{ ansible_facts['fqdn'] }}/rhsm"
Expand Down
10 changes: 10 additions & 0 deletions tests/feature/foreman-proxy/base_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ def test_foreman_proxy_features(curl_request, proxy_base_url, enabled_features):
assert "bmc" in features
else:
assert "bmc" not in features
if 'templates' in enabled_features:
assert "templates" in features
else:
assert "templates" not in features


def test_foreman_proxy_service(server):
Expand Down Expand Up @@ -65,3 +69,9 @@ def test_bmc_capabilities(proxy_v2_features):
def test_bmc_default_provider(proxy_v2_features):
settings = proxy_v2_features['bmc'].get('settings', {})
assert settings.get('bmc_default_provider') == 'ipmitool'


@pytest.mark.feature('templates')
def test_templates_template_url(obsah_params, server_fqdn):

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

we'll need #703 (or similar) to make this test work

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This tests is currently passing

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

oh, because you changed it to read the params, not talk to the API to fetch the set value.

template_url = obsah_params.get('foreman_proxy_templates_url')
assert template_url == f'http://{server_fqdn}:8000'