Bug 1426214 - Backport PassEnvironment= support in systemd.exec
Summary: Backport PassEnvironment= support in systemd.exec
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: systemd
Version: 7.3
Hardware: All
OS: Linux
unspecified
medium
Target Milestone: rc
: ---
Assignee: systemd-maint
QA Contact: Branislav Blaškovič
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-02-23 12:47 UTC by Robert Scheck
Modified: 2017-08-01 09:14 UTC (History)
5 users (show)

Fixed In Version: systemd-219-33.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-08-01 09:14:52 UTC


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2017:2297 normal SHIPPED_LIVE systemd bug fix and enhancement update 2017-08-01 12:40:16 UTC

Description Robert Scheck 2017-02-23 12:47:39 UTC
Description of problem:
The setting PassEnvironment= in systemd.exec was introduced in 2015 to allow
passing environment variables to daemons, which makes especially sense when the
system is inside a container. Upstream discussion:

  https://lists.freedesktop.org/archives/systemd-devel/2015-June/033130.html

Please backport the PassEnvironment= support in systemd.exec into RHEL 7.x.

Version-Release number of selected component (if applicable):
systemd-219-30.el7_3.6.x86_64

Actual results:
No PassEnvironment= support in systemd.exec.

Expected results:
PassEnvironment= support in systemd.exec ;-)

Comment 2 Robert Scheck 2017-02-23 12:50:06 UTC
Cross-filed case #01798185 on the Red Hat customer portal.

Comment 4 Jan Synacek 2017-02-28 10:52:33 UTC
A possible test scenario:

1)

# systemctl set-environment TEST_ENV=ttt1 TEST=t2t
# cat /etc/systemd/system/test.service 
[Unit]
Description=Test
[Service]
Environment=FOO=fffff BAR=bbbbb
PassEnvironment=TEST_ENV TEST I_DONT_EXIST TEST
ExecStart=/usr/bin/bash -c 'echo "$TEST_ENV::$TEST::$FOO::$BAR" ; /usr/bin/sleep 60'

# systemctl start test
# # Grep for expected/unexpected output in systemctl status

2)

# # Again, set some environment as in 1).
# systemd-run -p "PassEnvironment=TEST" /usr/bin/bash -c 'echo $TEST ; sleep 30'
# # Grep for expected/unexpected output in systemctl status


Ideally, it would be great to test for various combination of Environment and PassEnvironment, trying to set the values several times, passing nonexistent environment, etc.

Comment 5 Jan Synacek 2017-03-07 08:21:53 UTC
https://github.com/lnykryn/systemd-rhel/pull/98

Comment 11 errata-xmlrpc 2017-08-01 09:14:52 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, 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/RHBA-2017:2297


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