Fixes the install of logrotate config for the debian pkg
by moving file to pkg/common/logrotate/salt-common. File
is installed via salt-common.install file, which can't
rename files, only copy them to a directory, so we need to
rename the file and put it in a subdir of pkg/common.
Adds /etc/logrotate.d/salt-common to salt.common.conffiles to
ensure that dpkg will not overwrite configs modified by users.
Also updates RPM spec file for new location of logrotate config.
Config needs to be /etc/logrotate.d/salt-common as that is what
is used by 3005.x packages.
Moves log creation for /var/log/salt/master and /var/log/salt/cloud
and setting ownership to salt:salt to the %posttrans scriplets.
Whilst using %post work fine for fresh installs, upgrading means that
the previous package %postun removes those files. Using %posttrans
ensures the logs are created at the end of the full install/upgrade
transaction.
Reduces the permissions granted to the salt user used to run the
salt-master:
* Under /etc/salt limit ownership to /etc/salt/pki/master and
/etc/salt/master.d
* Until #64219 is resolved also include /etc/salt/minion.d
* Under /var/cache/salt and /var/run/salt only give ownership on
master directories
* Under /var/log/salt, ensure /var/log/salt/master exists and give
ownership oof that. Also update logrotate config to create that with
correct ownership and perms and install that on debian packages.
Updates Debian and RPM packages so that /opt/saltstack/salt and the
python packages don't have to be owned by salt user.
It shouldn't be necessary for salt user, used to run salt-master to be
able to write/modify files in that directory hierarchy.
Add postinst scripts to call the python compileall module to create
byte-compiled python modules. This should preserve performance whilst
not requiring write access for salt user.
Also cleans up .pyc files and __pycache__ dirs on removal.