This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository mum. See http://git.chorem.org/mum.git commit 5ba9e6882137261dd13ac4d821d621b6937d90e6 Author: Alexis Guilbaud <guilbaud@codelutin.com> Date: Fri May 22 17:50:06 2015 +0200 bugfix on shelve ("return_dict" attribute still present) + renamed run.sh to mum.sh + script now runs install if venv is not created + mum-daemon script added + notification page refounded --- app/modules/storage_modules/shelve_db.py | 2 - mum-daemon.sh | 52 ++++++++++++++++ mum.sh | 7 +++ run.sh | 3 - views/notifications.html | 104 ++++++++++++------------------- 5 files changed, 98 insertions(+), 70 deletions(-) diff --git a/app/modules/storage_modules/shelve_db.py b/app/modules/storage_modules/shelve_db.py index c51853c..1205b3a 100644 --- a/app/modules/storage_modules/shelve_db.py +++ b/app/modules/storage_modules/shelve_db.py @@ -76,7 +76,6 @@ class shelve_db: 'class_name': string, => the name of the class to instanciate 'compatible_os': [string1, string2, ...], => a list containing the compatibles os 'unit': string, => the unit type of return ('%', 'bool' or other) - 'return_dict': bool => true if the module return a dict of values 'block': string, => the monitoring block of the module 'external': bool => indicates if this modules comes from external directory } @@ -89,7 +88,6 @@ class shelve_db: if mod not in self.db['global_conf']: # adding a entry for every module loaded for the first time mod_conf = {} mod_conf['block'] = loaded_mod_moni[mod]['block'] - mod_conf['return_dict'] = loaded_mod_moni[mod]['return_dict'] # all modules are added if the os is compatible, we'll try at least # once the check, if it exists a connection that can lauch the module mod_conf['activated'] = True diff --git a/mum-daemon.sh b/mum-daemon.sh new file mode 100755 index 0000000..584fe3f --- /dev/null +++ b/mum-daemon.sh @@ -0,0 +1,52 @@ +#! /bin/sh -e + +DAEMON="/usr/lib/mum/run.sh" #ligne de commande du programme +daemon_OPT="/etc/mum/mum.conf" #argument à utiliser par le programme +DAEMONUSER="user" #utilisateur du programme +daemon_NAME="run.sh" #Nom du programme (doit être identique à l'exécutable) + +PATH="/sbin:/bin:/usr/sbin:/usr/bin" #Ne pas toucher + +test -x $DAEMON || exit 0 + +. /lib/lsb/init-functions + +d_start () { + log_daemon_msg "Starting system $daemon_NAME Daemon" + start-stop-daemon --background --name $daemon_NAME --start --quiet --chuid $DAEMONUSER --exec $DAEMON -- $daemon_OPT + log_end_msg $? +} + +d_stop () { + log_daemon_msg "Stopping system $daemon_NAME Daemon" + start-stop-daemon --name $daemon_NAME --stop --retry 5 --quiet --name $daemon_NAME + log_end_msg $? +} + +case "$1" in + + start|stop) + d_${1} + ;; + + restart|reload|force-reload) + d_stop + d_start + ;; + + force-stop) + d_stop + killall -q $daemon_NAME || true + sleep 2 + killall -q -9 $daemon_NAME || true + ;; + + status) + status_of_proc "$daemon_NAME" "$DAEMON" "system-wide $daemon_NAME" && exit 0 || exit $? + ;; + *) + echo "Usage: /etc/init.d/$daemon_NAME {start|stop|force-stop|restart|reload|force-reload|status}" + exit 1 + ;; +esac +exit 0 \ No newline at end of file diff --git a/mum.sh b/mum.sh new file mode 100755 index 0000000..6ba9a7b --- /dev/null +++ b/mum.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +if [ ! -d "venv" ]; then + echo "Preparing the virtual environment for the first launch (this may take several minutes)" + ./install.sh +fi +exec ./in-venv.sh python app/mum.py $* diff --git a/run.sh b/run.sh deleted file mode 100755 index a0599c6..0000000 --- a/run.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -exec ./in-venv.sh python app/mum.py $* diff --git a/views/notifications.html b/views/notifications.html index fbdddcb..7b04633 100644 --- a/views/notifications.html +++ b/views/notifications.html @@ -1,75 +1,49 @@ <div class="col-md-offset-2 main"> <h1 class="page-header">Who to notify? <small>{{subtitle}}</small></h1> - <h3 ng-repeat-start="(username, user) in all_subscriptions">{{username}}</h3> - <dl ng-repeat-end - ng-repeat-start="(addr_host, host) in user.hosts"> - <dt>{{addr_host}}</dt> - <dd ng-show="is_activated(host.major)">Major: {{get_activated(host.major)}}</dd> - <dd ng-show="is_activated(host.minor)">Minor: {{get_activated(host.minor)}}</dd> - </dl> - <dl ng-repeat-end - ng-repeat="(grp_name, grp) in user.groups"> - <dt>{{grp_name}}</dt> - <dd ng-show="is_activated(grp.major)">Major: {{get_activated(grp.major)}}</dd> - <dd ng-show="is_activated(grp.minor)">Minor: {{get_activated(grp.minor)}}</dd> - </dl> - <!--<table class="table table-hover" ng-repeat="(username, user) in all_subscriptions"> + <accordion close-others="false"> + <accordion-group heading="Subscriptions summary"> + <h3 ng-repeat-start="(username, user) in all_subscriptions">{{username}}</h3> + <dl ng-repeat-end + ng-repeat-start="(addr_host, host) in user.hosts"> + <dt>{{addr_host}}</dt> + <dd ng-show="is_activated(host.major)">Major: {{get_activated(host.major)}}</dd> + <dd ng-show="is_activated(host.minor)">Minor: {{get_activated(host.minor)}}</dd> + </dl> + <dl ng-repeat-end + ng-repeat="(grp_name, grp) in user.groups"> + <dt>{{grp_name}}</dt> + <dd ng-show="is_activated(grp.major)">Major: {{get_activated(grp.major)}}</dd> + <dd ng-show="is_activated(grp.minor)">Minor: {{get_activated(grp.minor)}}</dd> + </dl> + </accordion-group> + </accordion> - <thead> - <tr> - <th>Host</th> - <th>Notification service</th> - <th>Minor</th> - <th>Major</th> - </tr> - </thead> - <tbody> - <tr ng-repeat-start="(addr_host, host) in all_subscriptions.user.hosts"> - <td>{{addr_host}}</td> - </tr> - <tr ng-repeat-end - ng-repeat="(notif_mod_name, notif_mod) in host.minor"> - <td></td> - <td>{{notif_mod_name}}</td> - <td> - {{notif_mod.gzkf}} - {{notif_mod.priority}} - </td> - <td> - {{user_subscriptions.hosts[addr_host].major[notif_mod_name].priority}} - </td> - </tr> - </tbody> - </table>--> <form> <div class="row"> - <div class="col-lg-6"> - <div class="input-group"> - <span class="input-group-addon"> - <input type="radio" ng-model="option_selected" value="grp" - ng-change="selected_host=''"> - </span> - <label for="grp_choice">Select one group :</label> - <select class="form-control input-sm" id="grp_choice" - ng-model="selected_grp" - ng-options="item for item in allGroups() | unique:'group'" - ng-disabled="option_selected!='grp'" - ng-change="get_group_subscribers()"></select> - </div> + <div class="col-lg-12"> + <label for="choice_radio">Do you want to manage the notifications of:</label> + <input type="radio" ng-model="option_selected" value="grp" id="choice_radio" + ng-change="selected_host=''"> a whole group + <input type="radio" ng-model="option_selected" value="host" + ng-change="selected_grp=''"> a single host </div> <div class="col-lg-6"> - <div class="input-group"> - <span class="input-group-addon"> - <input type="radio" ng-model="option_selected" value="host" - ng-change="selected_grp=''"> - </span> - <label for="host_choice">or one host :</label> - <select class="form-control input-sm" id="host_choice" - ng-model="selected_host" - ng-options="host.addr group by host.group for host in items" - ng-disabled="option_selected!='host'" - ng-change="get_host_subscribers()"></select> - </div> + <label for="grp_choice" + ng-show="option_selected=='grp'">Select one group : + </label> + <select class="form-control input-sm" id="grp_choice" + ng-model="selected_grp" + ng-options="item for item in allGroups() | unique:'group'" + ng-show="option_selected=='grp'" + ng-change="get_group_subscribers()"></select> + + <label for="host_choice" + ng-show="option_selected=='host'">or one host :</label> + <select class="form-control input-sm" id="host_choice" + ng-model="selected_host" + ng-options="host.addr group by host.group for host in items" + ng-show="option_selected=='host'" + ng-change="get_host_subscribers()"></select> </div> </div> </form> -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.