我想lcnotification
在 WAS 中修改 HCL Connections 6.5/7 的默认邮件会话。由于这是使用 Ansible 自动完成的,因此我想检测所需的设置是否仍然存在或需要设置 - 包括节点的完全同步,以防有任何修改。我正在努力如何正确检测到这一点,因为既没有AdminConfig.modify
也没有AdminConfig.save
告诉我是否有任何改变。
所以我尝试获取MailSession
对象并检查我想要设置的每个属性是否匹配:
properties = [
["mailTransportHost", "{{ mail_host }}"],
["mailTransportUser", "{{ mail_user }}"],
["mailTransportPassword", "{{ mail_pw }}"],
["mailFrom", "{{ mail_sender }}"],
["debug", "{{ mail_debug | lower }}"]
]
session = AdminConfig.list('MailSession', 'lcnotification*')
existing = AdminConfig.showall(session)
isModified = 0
for line in existing.splitlines():
noBrackets = line[1:-1]
firstSpace = noBrackets.index(" ")
key = noBrackets[0:firstSpace]
val = noBrackets[firstSpace:].strip()
# print key + " -> " + val
for prop in properties:
propKey = prop[0]
propVal = prop[1]
if propKey == key and val != propVal:
print(propKey + " not maching:\n\tPresent: " + val + "\n\tWanted: " +
propVal)
isModified = 1
if isModified:
AdminConfig.modify(session, properties)
AdminConfig.save()
import shared
shared.synchAllNodes()
在 Ansible 调用中,我changed_when
用来检查not maching
标准输出中是否存在。这不能正常工作,因为 WAS 返回星星而不是mailTransportPassword
- 所以我无法检查它是否匹配:
stdout: |-
WASX7209I: Connected to process "dmgr" on node CnxCell-dmgr using SOAP connector; The type of process is: DeploymentManager
mailTransportPassword not maching:
Present: *****
Wanted: dummypw
Syncronizing nodeCnxNode01
-----------------------------------------------------------------------------------------
Full Resyncronization completed
我看不到解决此问题的干净方法。是否有另一种(甚至可能更清洁)方法来查看是否修改了任何内容并需要进行完全重新同步?