__netbox: small code and config handling improvements
fixed codestyle and detection if config files need to be copied.
This commit is contained in:
parent
e6e6dbcd00
commit
855843ea34
1 changed files with 7 additions and 4 deletions
|
@ -66,26 +66,29 @@ printf "%s\\n" "$VERSION" > '$install_dir/cdist/version'
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
# meta
|
# meta
|
||||||
printf "%s %s\n" "installed" "$VERSION" >> "$__messages_out"
|
printf "installed %s\n" "$VERSION" >> "$__messages_out"
|
||||||
changes=yes
|
changes=yes
|
||||||
|
|
||||||
# check if configuration changed
|
# check if configuration changed
|
||||||
elif grep -q "^__file/opt/netbox/" "$__messages_in"; then
|
elif grep -q "^__file/opt/netbox/" "$__messages_in"; then
|
||||||
cat <<EOF
|
# check if coping is required
|
||||||
|
if grep -q "^__file/opt/netbox/netbox/cdist/" "$__messages_in"; then
|
||||||
|
cat << EOF
|
||||||
# Copy configuration
|
# Copy configuration
|
||||||
cp '$install_dir/cdist/configuration.py' '$install_dir/netbox/configuration.py'
|
cp '$install_dir/cdist/configuration.py' '$install_dir/netbox/configuration.py'
|
||||||
cp '$install_dir/cdist/ldap_config.py' '$install_dir/netbox/ldap_config.py'
|
cp '$install_dir/cdist/ldap_config.py' '$install_dir/netbox/ldap_config.py'
|
||||||
EOF
|
EOF
|
||||||
|
fi
|
||||||
|
|
||||||
# meta
|
# meta
|
||||||
printf "%s\n" "configuration" >> "$__messages_out"
|
printf "configuration\n" >> "$__messages_out"
|
||||||
changes=yes
|
changes=yes
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
# check for changes
|
# check for changes
|
||||||
if [ "$changes" = "yes" ]; then
|
if [ "$changes" = "yes" ]; then
|
||||||
cat <<EOF
|
cat << EOF
|
||||||
# Restart services.
|
# Restart services.
|
||||||
service netbox restart
|
service netbox restart
|
||||||
service netbox-rq restart
|
service netbox-rq restart
|
||||||
|
|
Loading…
Reference in a new issue