ab4d479e9d
After I8d90d33dc0a1c36ac4524f8f3b82223c23829126 a bug has been introduced in setting agent's config: it was only set if there was no 'muranoagent' binary in PATH. This patch fixes this behaviour. The patch also improves murano-agent detection, by setting PATH to a wider number of directories, when checking for murano-agent binary. It also improves support of different pre-built images by not restricting path to murano-agent binary to a specific path. Contains a bunch of comments with clarifications. Change-Id: Ie4c498b5546aabaab2070400452765c62cb561a3 Closes-Bug: #1570962
30 lines
1.2 KiB
Bash
30 lines
1.2 KiB
Bash
#!/bin/sh
|
|
|
|
# NOTE(kzaitsev): old dib elements installed murano-agent into a venv
|
|
# so if the image is an old one: symlink agent into /usr/local/bin
|
|
if [ -d /opt/stack/venvs/murano-agent ] && [ ! -f /usr/local/bin/muranoagent ]; then
|
|
ln -s /opt/stack/venvs/murano-agent/bin/muranoagent /usr/local/bin/muranoagent
|
|
fi
|
|
|
|
# NOTE(kzaitsev): for example on debian by default PATH would be /sbin:/usr/sbin:/bin:/usr/bin
|
|
# when this script is run. Our default DIB elements install it in /usr/local/bin.
|
|
# Expand path to some of those locations.
|
|
PATH="/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin:$PATH"
|
|
which muranoagent > /dev/null
|
|
if [ $? -eq 0 ]; then
|
|
echo "muranoagent binary is already installed"
|
|
else
|
|
# TODO(kzaitsev): use deb/rpm packages as soon as we can
|
|
echo "installing murano agent from pip"
|
|
echo "binary not found in PATH: $PATH"
|
|
pip install murano-agent
|
|
fi
|
|
|
|
muranoAgentConf='%MURANO_AGENT_CONF%'
|
|
echo $muranoAgentConf | base64 -d > /etc/init/murano-agent.conf
|
|
muranoAgentService='%MURANO_AGENT_SERVICE%'
|
|
echo $muranoAgentService | base64 -d > /etc/systemd/system/murano-agent.service
|
|
muranoAgent='%MURANO_AGENT%'
|
|
echo $muranoAgent | base64 -d > /etc/init.d/murano-agent
|
|
chmod +x /etc/init.d/murano-agent
|