mirror of https://github.com/sipwise/ngcpcfg.git
If the output file has been replaced by a symlink then the permissions of the symlink's target are adjusted. This is clearly unwanted and unexpected behavior. This can happen e.g. when masking a service via systemd's systemctl, demonstration: | sipwise@sp1:~$ sudo rm /etc/systemd/system/ntp.service | sipwise@sp1:~$ sudo systemctl mask ntp | Created symlink /etc/systemd/system/ntp.service → /dev/null. | sipwise@sp1:~$ ls -la /dev/null | crw-rw-rw- 1 root root 1, 3 May 12 01:54 /dev/null | sipwise@sp1:~$ sudo ngcpcfg build /etc/systemd/system/ntp.service | 2018-05-15 16:06:47: Checking state of local storage: | 2018-05-15 16:06:47: OK: nothing to pull | 2018-05-15 16:06:47: configs were checked successfuly | 2018-05-15 16:06:47: No patchtt files found, nothing to patch. | Loading /etc/ngcp-config/config.yml in memory: OK | Loading /etc/ngcp-config/network.yml in memory: OK | Loading /etc/ngcp-config/constants.yml in memory: OK | 2018-05-15 16:06:48: Generating /etc/systemd/system/ntp.service: OK | sipwise@sp1:~$ ls -la /dev/null | cr--r--r-- 1 root root 1, 3 May 12 01:54 /dev/null Instead check whether the expected output file is a symlink and if so don't modify permissions at all, but warn instead. Change-Id: I1c1bb0941a8a2f599652b7c089efd63ff33ca455changes/21/21221/3
parent
3e7c22ca3a
commit
57701e3ed0
Loading…
Reference in new issue