1. Proposed title of this feature request
=>systemd unit condition DomainName
3. What are the nature and description of the request?
=> A sysadmin wants to setup a job on all hosts in the 'dhcp' subdomain (dhcp.example.com) or run a service on all hosts not in the 'dhcp' subdomain. The systems are cloud VMs and get their hostname dynamically.
4. Why does the customer need this? (List the business requirements here)
=>Systemd has unit file conditions for node name (gethostname/uname -n). However, the DNS Domain Name may not be set within the host's node name. It would be helpful if there was a way to query against the DNS Domain Name.
5. How would the customer like to achieve this? (List the functional requirements here)
=>Add a systemd.unit condition "ConditionDNSDomainName" (just a name suggestion) that performs the same set of calls as `dnsdomainname` from the 'hostname` rpm to return the value. Use of this condition should force a dependency on 'nss-lookup.target' to ensure the name service is rationally setup.
6. For each functional requirement listed, specify how Red Hat and the customer can test to confirm the requirement is successfully implemented.
=> Customer dont have test machine.
7. Is there already an existing RFE upstream or in Red Hat Bugzilla?
=> Not found any.
8. Does the customer have any specific timeline dependencies and which release would they like to target (i.e. RHEL5, RHEL6)?
=> RHEL 8.2
9. Would the customer be able to assist in testing this functionality if implemented?
=> Customer dont have test server.
To be honest, I don't like this idea since it can easily get racy. If I am not mistaken, the dnsdomainname depends on the network, and it might not be available until very late into the boot.
Is there any reason the customer cannot use ExecCondition? E.g., something like
ExecCondition=/usr/bin/sh -c 'test `dnsdomainname` = dhcp.example.com'
Uh, I didn't notice ExecCondition= has only been added in v. 243. I'll backport it.
Let's generalize this bug into a backport request for ExecCondition. With ExecCondition available, the customer can easily run a check on DNS domain name as suggested in comment 4.
fix merged to github master branch -> https://github.com/systemd-rhel/rhel-8/pull/48
fix merged to github master branch -> https://github.com/systemd-rhel/rhel-8/pull/108
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.
For information on the advisory (Low: systemd security, bug fix, and enhancement update), and where to find the updated
files, follow the link below.
If the solution does not work for you, open a new bug report.