Don't fail if systemd override directory already exists
Fixes this issue I saw after a charm upgrade:
unit-scalebot-1: 15:33:45 ERROR unit.scalebot/1.juju-log Hook error:
Traceback (most recent call last):
File "/usr/local/lib/python3.8/dist-packages/charms/reactive/__init__.py", line 74, in main
bus.dispatch(restricted=restricted_mode)
File "/usr/local/lib/python3.8/dist-packages/charms/reactive/bus.py", line 379, in dispatch
_invoke(hook_handlers)
File "/usr/local/lib/python3.8/dist-packages/charms/reactive/bus.py", line 359, in _invoke
handler.invoke()
File "/usr/local/lib/python3.8/dist-packages/charms/reactive/bus.py", line 181, in invoke
self._action(*args)
File "/var/lib/juju/agents/unit-scalebot-1/charm/reactive/scalebot-jenkins.py", line 114, in configure_scalebot_env
os.makedirs(unit_override_dir)
File "/usr/lib/python3.8/os.py", line 223, in makedirs
mkdir(name, mode)
FileExistsError: [Errno 17] File exists: '/etc/systemd/system/jenkins.service.d'
Install juju from the snap, but execute it without the snap wrapper
Cut & pasting of the included comment:
New versions of juju are only distributed as a snap, but the jenkins
charm doesn't support running juju from a snap: https://github.com/jenkinsci/jenkins-charm/issues/59
Let's install juju via the snap, but purely as a way to get the juju
binary onto the system. Instead of executing it through the snap wrapper
(/snap/bin/juju), we install a symlink to the juju binary itself
(/snap/juju/current/bin/juju) into /usr/local/bin. /usr/local/bin
precedes the /snap/bin wrapper in $PATH. This method allows us to run
it without any of the snap confinement.
Remove the crumb workaround insertion for initscript-based jenkins installs
With this we can no longer support Jenkins debs prior to 2.335 where
they migrated to systemd. Doing so lets us get rid of an ugly hack
that will otherwise likely bit-rot.
with this file we will be able to complete the charm
migration from the charmstore to charmhub and upload/release
it as required.
This will keep the reactive-based charm type.