From 064825df30873db64cae9045a4bee2839ea5dc9b Mon Sep 17 00:00:00 2001 From: Christian Kotte Date: Fri, 21 Dec 2018 16:21:49 +0700 Subject: [PATCH] Revert changes in vmware_vcenter_statistics(#49537) --- .../cloud/vmware/vmware_vcenter_statistics.py | 37 ++++++++++--------- 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/lib/ansible/modules/cloud/vmware/vmware_vcenter_statistics.py b/lib/ansible/modules/cloud/vmware/vmware_vcenter_statistics.py index c59aa2d6e9f..6f5ffafa8ce 100644 --- a/lib/ansible/modules/cloud/vmware/vmware_vcenter_statistics.py +++ b/lib/ansible/modules/cloud/vmware/vmware_vcenter_statistics.py @@ -210,10 +210,10 @@ class VmwareVcenterStatistics(PyVmomi): for historical_interval in perf_manager.historicalInterval: # Statistics for past day if historical_interval.name == 'Past day' and ( - historical_interval.samplingPeriod != past_day_seconds or - historical_interval.length != past_day_save_for_seconds or - historical_interval.level != past_day_level or - historical_interval.enabled != past_day_enabled + historical_interval.samplingPeriod != past_day_seconds + or historical_interval.length != past_day_save_for_seconds + or historical_interval.level != past_day_level + or historical_interval.enabled != past_day_enabled ): changed = True changed_list.append("Past day interval") @@ -241,10 +241,10 @@ class VmwareVcenterStatistics(PyVmomi): ) # Statistics for past week if historical_interval.name == 'Past week' and ( - historical_interval.samplingPeriod != past_week_seconds or - historical_interval.length != past_week_save_for_seconds or - historical_interval.level != past_week_level or - historical_interval.enabled != past_week_enabled + historical_interval.samplingPeriod != past_week_seconds + or historical_interval.length != past_week_save_for_seconds + or historical_interval.level != past_week_level + or historical_interval.enabled != past_week_enabled ): changed = True changed_list.append("Past week interval") @@ -272,10 +272,10 @@ class VmwareVcenterStatistics(PyVmomi): ) # Statistics for past month if historical_interval.name == 'Past month' and ( - historical_interval.samplingPeriod != past_month_seconds or - historical_interval.length != past_month_save_for_seconds or - historical_interval.level != past_month_level or - historical_interval.enabled != past_month_enabled + historical_interval.samplingPeriod != past_month_seconds + or historical_interval.length != past_month_save_for_seconds + or historical_interval.level != past_month_level + or historical_interval.enabled != past_month_enabled ): changed = True changed_list.append("Past month interval") @@ -303,10 +303,10 @@ class VmwareVcenterStatistics(PyVmomi): ) # Statistics for past year if historical_interval.name == 'Past year' and ( - historical_interval.samplingPeriod != past_year_seconds or - historical_interval.length != past_year_save_for_seconds or - historical_interval.level != past_year_level or - historical_interval.enabled != past_year_enabled + historical_interval.samplingPeriod != past_year_seconds + or historical_interval.length != past_year_save_for_seconds + or historical_interval.level != past_year_level + or historical_interval.enabled != past_year_enabled ): changed = True changed_list.append("Past year interval") @@ -332,7 +332,7 @@ class VmwareVcenterStatistics(PyVmomi): enabled=past_year_enabled ) ) - message = "vCenter statistics already configured properly" + if changed: if self.module.check_mode: changed_suffix = ' would be changed' @@ -354,7 +354,8 @@ class VmwareVcenterStatistics(PyVmomi): # Loop in reverse order (start with past year interval) for statistic in change_statistics_list[::-1]: self.update_perf_interval(perf_manager, statistic) - + else: + message = "vCenter statistics already configured properly" result['changed'] = changed result['msg'] = message