From bb027cd421887e96fd69576a1dcf9bda529d66bb Mon Sep 17 00:00:00 2001 From: Jerome Lebleu Date: Sat, 14 Dec 2013 15:48:04 +0100 Subject: [PATCH 1/2] Correct English in monitor --- action_map.yml | 4 ++-- yunohost_monitor.py | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/action_map.yml b/action_map.yml index 62860373..e1954685 100644 --- a/action_map.yml +++ b/action_map.yml @@ -539,7 +539,7 @@ monitor: ### monitor_updatestats() updatestats: - action_help: Update monitored statistics + action_help: Update monitoring statistics api: POST /monitor/updatestats arguments: period: @@ -551,7 +551,7 @@ monitor: ### monitor_showstats() showstats: - action_help: Show monitored statistics + action_help: Show monitoring statistics api: GET /monitor/showstats arguments: period: diff --git a/yunohost_monitor.py b/yunohost_monitor.py index be225d5b..52f92c2d 100644 --- a/yunohost_monitor.py +++ b/yunohost_monitor.py @@ -236,7 +236,7 @@ def monitor_system(units=None, human_readable=False): def monitor_updatestats(period): """ - Update monitored statistics + Update monitoring statistics Keyword argument: period -- Time period to update (day, week, month) @@ -250,7 +250,7 @@ def monitor_updatestats(period): stats = { 'disk': {}, 'network': {}, 'system': {}, 'timestamp': [] } monitor = None - # Get monitored stats + # Get monitoring stats if period == 'day': monitor = _monitor_all('day') else: @@ -261,7 +261,7 @@ def monitor_updatestats(period): else: monitor = _monitor_all(p, 0) if not monitor: - raise YunoHostError(1, _("No monitored statistics to update")) + raise YunoHostError(1, _("No monitoring statistics to update")) stats['timestamp'].append(time.time()) @@ -319,7 +319,7 @@ def monitor_updatestats(period): def monitor_showstats(period, date=None): """ - Show monitored statistics + Show monitoring statistics Keyword argument: period -- Time period to show (day, week, month) @@ -573,11 +573,11 @@ def _calculate_stats_mean(stats): def _append_to_stats(stats, monitor, statics=[]): """ - Append monitored statistics to current statistics + Append monitoring statistics to current statistics Keyword argument: stats -- Current stats dict - monitor -- Monitored statistics + monitor -- Monitoring statistics statics -- List of stats static keys """ From 2f0a08bc98d222fa2f33ee6f44d0a719392d2cd6 Mon Sep 17 00:00:00 2001 From: Jerome Lebleu Date: Sat, 14 Dec 2013 15:53:06 +0100 Subject: [PATCH 2/2] Split words with '-' in action name --- action_map.yml | 8 ++++---- yunohost.py | 2 +- yunohost.tac | 2 +- yunohost_monitor.py | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/action_map.yml b/action_map.yml index e1954685..9a0313ed 100644 --- a/action_map.yml +++ b/action_map.yml @@ -538,9 +538,9 @@ monitor: action: store_true ### monitor_updatestats() - updatestats: + update-stats: action_help: Update monitoring statistics - api: POST /monitor/updatestats + api: POST /monitor/update-stats arguments: period: help: Time period to update @@ -550,9 +550,9 @@ monitor: - month ### monitor_showstats() - showstats: + show-stats: action_help: Show monitoring statistics - api: GET /monitor/showstats + api: GET /monitor/show-stats arguments: period: help: Time period to show diff --git a/yunohost.py b/yunohost.py index c5b3b896..543b0d17 100644 --- a/yunohost.py +++ b/yunohost.py @@ -490,7 +490,7 @@ def parse_dict(action_map): # Set the action s related function parsers[category + '_' + action].set_defaults( func=str_to_func('yunohost_' + category + '.' - + category + '_' + action)) + + category + '_' + action.replace('-', '_'))) # Add arguments if 'arguments' in action_params: for arg_name, arg_params in action_params['arguments'].items(): diff --git a/yunohost.tac b/yunohost.tac index 6ece45d1..af917180 100755 --- a/yunohost.tac +++ b/yunohost.tac @@ -244,7 +244,7 @@ def main(): api.register(method, path, http_exec) api.register('OPTIONS', path, http_exec) action_dict[action_params['api']] = { - 'function': 'yunohost_'+ category +'.'+ category +'_'+ action, + 'function': 'yunohost_'+ category +'.'+ category +'_'+ action.replace('-', '_'), 'help' : action_params['action_help'] } if 'arguments' in action_params: diff --git a/yunohost_monitor.py b/yunohost_monitor.py index 52f92c2d..9fe84555 100644 --- a/yunohost_monitor.py +++ b/yunohost_monitor.py @@ -234,7 +234,7 @@ def monitor_system(units=None, human_readable=False): return result -def monitor_updatestats(period): +def monitor_update_stats(period): """ Update monitoring statistics @@ -317,7 +317,7 @@ def monitor_updatestats(period): _save_stats(stats, period) -def monitor_showstats(period, date=None): +def monitor_show_stats(period, date=None): """ Show monitoring statistics