[Backport/2.9/61283]Update ce_info_center_global to fix bugs (#62688)

* Update ce_info_center_global modified information

* Update ce_info_center_global to fix bugs (#61283)

* Update ce_info_center_global to fix bugs

* Update ce_info_center_global to fix bugs

* Update ce_info_center_global to fix bugs

(cherry picked from commit 2d85cb3ded)
pull/64281/head
yanzhangi 5 years ago committed by Toshio Kuratomi
parent e9ef022b5d
commit 59f33cde8b

@ -0,0 +1,2 @@
bugfixes:
- ce_info_center_global- update to fix some bugs - Add some update statements. (https://github.com/ansible/ansible/pull/61283)

@ -952,25 +952,28 @@ class InfoCenterGlobal(object):
cmd += " ipv6 %s" % self.server_ip cmd += " ipv6 %s" % self.server_ip
if self.server_domain: if self.server_domain:
cmd += " domain %s" % self.server_domain cmd += " domain %s" % self.server_domain
if self.channel_id:
cmd += " channel %s" % self.channel_id
if self.channel_name:
cmd += " channel %s" % self.channel_name
if self.vrf_name: if self.vrf_name:
if self.vrf_name != "_public_": if self.vrf_name != "_public_":
cmd += " vpn-instance %s" % self.vrf_name cmd += " vpn-instance %s" % self.vrf_name
if self.level: if self.source_ip:
cmd += " level %s" % self.level cmd += " source-ip %s" % self.source_ip
if self.server_port:
cmd += " port %s" % self.server_port
if self.facility: if self.facility:
cmd += " facility %s" % self.facility cmd += " facility %s" % self.facility
if self.channel_id: if self.server_port:
cmd += " channel %s" % self.channel_id cmd += " port %s" % self.server_port
if self.channel_name: if self.level:
cmd += " channel %s" % self.channel_name cmd += " level %s" % self.level
if self.timestamp: if self.timestamp:
cmd += " %s" % self.timestamp if self.timestamp == "localtime":
cmd += " local-time"
else:
cmd += " utc"
if self.transport_mode: if self.transport_mode:
cmd += " transport %s" % self.transport_mode cmd += " transport %s" % self.transport_mode
if self.source_ip:
cmd += " source-ip %s" % self.source_ip
if self.ssl_policy_name: if self.ssl_policy_name:
cmd += " ssl-policy %s" % self.ssl_policy_name cmd += " ssl-policy %s" % self.ssl_policy_name
self.updates_cmd.append(cmd) self.updates_cmd.append(cmd)
@ -1025,24 +1028,6 @@ class InfoCenterGlobal(object):
if self.vrf_name: if self.vrf_name:
if self.vrf_name != "_public_": if self.vrf_name != "_public_":
cmd += " vpn-instance %s" % self.vrf_name cmd += " vpn-instance %s" % self.vrf_name
if self.level:
cmd += " level %s" % self.level
if self.server_port:
cmd += " port %s" % self.server_port
if self.facility:
cmd += " facility %s" % self.facility
if self.channel_id:
cmd += " channel %s" % self.channel_id
if self.channel_name:
cmd += " channel %s" % self.channel_name
if self.timestamp:
cmd += " %s" % self.timestamp
if self.transport_mode:
cmd += " transport %s" % self.transport_mode
if self.source_ip:
cmd += " source-ip %s" % self.source_ip
if self.ssl_policy_name:
cmd += " ssl-policy %s" % self.ssl_policy_name
self.updates_cmd.append(cmd) self.updates_cmd.append(cmd)
self.changed = True self.changed = True
@ -1217,13 +1202,13 @@ class InfoCenterGlobal(object):
if self.state == "present": if self.state == "present":
if self.packet_priority: if self.packet_priority:
if self.packet_priority != "0" and self.cur_global_info["packetPriority"] != self.packet_priority: if self.cur_global_info["packetPriority"] != self.packet_priority:
cmd = "info-center syslog packet-priority %s" % self.packet_priority cmd = "info-center syslog packet-priority %s" % self.packet_priority
self.updates_cmd.append(cmd) self.updates_cmd.append(cmd)
self.changed = True self.changed = True
if self.state == "absent": if self.state == "absent":
if self.packet_priority: if self.packet_priority:
if self.packet_priority != "0" and self.cur_global_info["packetPriority"] == self.packet_priority: if self.cur_global_info["packetPriority"] == self.packet_priority:
cmd = "undo info-center syslog packet-priority %s" % self.packet_priority cmd = "undo info-center syslog packet-priority %s" % self.packet_priority
self.updates_cmd.append(cmd) self.updates_cmd.append(cmd)
self.changed = True self.changed = True
@ -1268,8 +1253,7 @@ class InfoCenterGlobal(object):
conf_str = CE_NC_MERGE_LOG_FILE_INFO_HEADER conf_str = CE_NC_MERGE_LOG_FILE_INFO_HEADER
if self.logfile_max_num: if self.logfile_max_num:
if self.state == "present": if self.state == "present":
if self.cur_logfile_info["maxFileNum"] != self.logfile_max_num: logfile_max_num = self.logfile_max_num
logfile_max_num = self.logfile_max_num
else: else:
if self.logfile_max_num != "200" and self.cur_logfile_info["maxFileNum"] == self.logfile_max_num: if self.logfile_max_num != "200" and self.cur_logfile_info["maxFileNum"] == self.logfile_max_num:
logfile_max_num = "200" logfile_max_num = "200"
@ -1278,8 +1262,7 @@ class InfoCenterGlobal(object):
if self.logfile_max_size: if self.logfile_max_size:
logfile_max_size = "32" logfile_max_size = "32"
if self.state == "present": if self.state == "present":
if self.cur_logfile_info["maxFileSize"] != self.logfile_max_size: logfile_max_size = self.logfile_max_size
logfile_max_size = self.logfile_max_size
else: else:
if self.logfile_max_size != "32" and self.cur_logfile_info["maxFileSize"] == self.logfile_max_size: if self.logfile_max_size != "32" and self.cur_logfile_info["maxFileSize"] == self.logfile_max_size:
logfile_max_size = "32" logfile_max_size = "32"
@ -1567,6 +1550,8 @@ class InfoCenterGlobal(object):
if self.server_domain_info: if self.server_domain_info:
self.end_state["server_domain_info"] = self.server_domain_info[ self.end_state["server_domain_info"] = self.server_domain_info[
"serverAddressInfos"] "serverAddressInfos"]
if self.end_state == self.existing:
self.changed = False
def work(self): def work(self):
"""worker""" """worker"""

Loading…
Cancel
Save