Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does this PR do?
This PR adds the ability to define a proxy server, proxy port, proxy username, and proxy password to be used by yum/dnf to connect to the DataDog yum repository via a proxy connection on RedHat Enterprise Linux and similar distributions.
Four new variables are introduced to capture the necessary data when the module is invoked from hiera or via class parameters. These parameters are validated before they are handed down to the yumrepo resource in the redhat.pp class.
A proxy can be used without specifying a user and password. But to use a proxy, both server and port are required.
Motivation
The module does currently not allow to manage the yum repository for installing the client if a proxy is needed to connect to it. I would like to use the functionality of being able to manage the repo configuration and be able to specify a proxy server to use.
Additional Notes
What does this PR do?
This PR adds functionality to provide a proxy server, proxy port, proxy username, and proxy password when using the functionality to manage the RPM repo on RHEL based systems. These parameters are validated before they are handed down to the yumrepo resource in the redhat.pp class.
The new class parameters introduced via this pull request are:
Optional[String] $rpm_repo_proxy_url = undef,
Optional[Integer] $rpm_repo_proxy_port = undef,
Optional[String] $rpm_repo_proxy_password = undef,
Optional[String] $rpm_repo_proxy_username = undef,
Documentation has been added in the class description.
Validation of parameter values has been added.
Describe your test plan
The branch with my changes was tested and is currently used in a production environment. The proxy and port are successfully configured in the /etc/yum.repos.d/datadog.repo file on the hosts and Puppet was able to install the datadog-agent RPM using the proxy. Since our environment does not use proxy users or passwords, I am not able to fully test this. But the parameters were handed to the yumrepo resource in the redhat.pp class during testing.
Without the parameters provided to the datadog module, the datadog-agent RPM could not be installed due to the restrictions in our environment. This is the expected behavior.