-
Notifications
You must be signed in to change notification settings - Fork 275
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(packaging): various issues + migration to JSON config file
- missing dependency on AlmaLinux - /etc/(default|sysconfig)/centreon_vmware was ignored - migrate the config file from .pm to .json
- Loading branch information
Showing
10 changed files
with
72 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
# centreon_vmware command line options | ||
OPTIONS="--logfile=/var/log/centreon_vmware.log --severity=error" | ||
OPTIONS="--config-extra=/etc/centreon/centreon_vmware.json --logfile=/var/log/centreon_vmware.log --severity=error" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
# centreon_vmware command line options | ||
OPTIONS="--logfile=/var/log/centreon/centreon_vmware.log --severity=error" | ||
OPTIONS="--config-extra=/etc/centreon/centreon_vmware.json --logfile=/var/log/centreon/centreon_vmware.log --severity=error" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,49 @@ | ||
#!/bin/sh | ||
#!/bin/bash | ||
|
||
if [ "$1" = "configure" ]; then # deb | ||
if [ ! -f "/etc/centreon/centreon_vmware.pm" ]; then | ||
mv /etc/centreon/centreon_vmware.pm.new /etc/centreon/centreon_vmware.pm | ||
fi | ||
json_config_file_path='/etc/centreon/centreon_vmware.json' | ||
perl_config_file_path='/etc/centreon/centreon_vmware.pm' | ||
|
||
function migrateConfigFromPmToJson() { | ||
# If the legacy config file exists, we migrate it into a JSON config file | ||
if [[ -f "$perl_config_file_path" ]] ; then | ||
/usr/bin/centreon_vmware_convert_config_file "$perl_config_file_path" > "$json_config_file_path" | ||
mv "$perl_config_file_path" "${perl_config_file_path}.deprecated" | ||
fi | ||
chown centreon: "$json_config_file_path" | ||
chmod 640 "$json_config_file_path" | ||
} | ||
|
||
function applyToSystemD() { | ||
systemctl daemon-reload | ||
systemctl restart centreon_vmware.service | ||
} | ||
|
||
action="$1" | ||
version="$2" | ||
|
||
if [[ "$1" == "configure" ]]; then # deb | ||
if [[ -z "$version" ]]; then | ||
# Alpine linux does not pass args, and deb passes $1=configure | ||
action="install" | ||
elif [[ -n "$version" ]]; then | ||
# deb passes $1=configure $2=<current version> | ||
action="upgrade" | ||
fi | ||
fi | ||
|
||
|
||
case "$action" in | ||
"1" | "install") | ||
migrateConfigFromPmToJson | ||
applyToSystemD | ||
;; | ||
"2" | "upgrade") | ||
migrateConfigFromPmToJson | ||
applyToSystemD | ||
;; | ||
*) | ||
# $1 == version being installed | ||
applyToSystemD | ||
;; | ||
esac | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters