RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1737283 - backport ExecCondition
Summary: backport ExecCondition
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: systemd
Version: 8.4
Hardware: Unspecified
OS: Linux
medium
medium
Target Milestone: rc
: 8.0
Assignee: David Tardon
QA Contact: Frantisek Sumsal
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-08-05 01:39 UTC by Aniket Bhavsar
Modified: 2023-12-15 16:40 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-11-04 02:02:06 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github systemd-rhel rhel-8 pull 108 0 None closed (#1737283) core: don't consider SERVICE_SKIP_CONDITION for abnormal or failure r… 2020-11-13 17:01:43 UTC
Github systemd systemd issues 10596 0 None closed ExecStartPre conditional service hook 2020-11-13 17:01:43 UTC
Github systemd systemd issues 16115 0 None closed ExecCondition= check triggers service restart for skipped service 2020-11-13 17:01:23 UTC
Red Hat Product Errata RHSA-2020:4553 0 None None None 2020-11-04 02:02:39 UTC

Description Aniket Bhavsar 2019-08-05 01:39:14 UTC
[RFE] Request.

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.

Comment 1 Lukáš Nykrýn 2019-08-05 08:21:45 UTC
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.

Comment 4 David Tardon 2019-11-25 08:55:16 UTC
Is there any reason the customer cannot use ExecCondition? E.g., something like

ExecCondition=/usr/bin/sh -c 'test `dnsdomainname` = dhcp.example.com'

Comment 5 David Tardon 2019-11-25 13:07:58 UTC
Uh, I didn't notice ExecCondition= has only been added in v. 243. I'll backport it.

Comment 6 David Tardon 2019-12-03 16:11:15 UTC
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.

Comment 7 David Tardon 2019-12-03 16:12:36 UTC
PR: https://github.com/systemd-rhel/rhel-8/pull/48

Comment 15 Lukáš Nykrýn 2020-05-26 09:12:42 UTC
fix merged to github master branch -> https://github.com/systemd-rhel/rhel-8/pull/48

Comment 20 Lukáš Nykrýn 2020-06-16 10:45:52 UTC
fix merged to github master branch -> https://github.com/systemd-rhel/rhel-8/pull/108

Comment 24 errata-xmlrpc 2020-11-04 02:02:06 UTC
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.

https://access.redhat.com/errata/RHSA-2020:4553


Note You need to log in before you can comment on or make changes to this bug.