systemctl: print a warning when trying to import a nonexistent variable
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sun, 3 Jan 2021 20:53:38 +0000 (21:53 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 19 Jan 2021 13:18:33 +0000 (14:18 +0100)
commitc4899ea427fe93b5b2beac8ab10bfee7dfbf2021
tree8e2204293020a7ecd952006ceea2bd1191211fd7
parent7b5ed18779992a62ac705952b4dc63b783be93b8
systemctl: print a warning when trying to import a nonexistent variable

I was quite confused what is happening:
$ XXX=xxx
$ systemctl --user import-environment XXX
$ systemctl --user show-environment | grep XXX
(nothing)

Obviously, 'export XXX' was missing. Without any indication why the
export is not happening, this can be hard to figure out.

Another option would be to error out. But so far we didn't, and doing
that could break some script which optimistically tries to export some
variables, if present.
src/systemctl/systemctl-set-environment.c