refactor the JSON key insertion
This commit is contained in:
parent
c05ea2ef78
commit
36c2ebf2a4
40
push.py
40
push.py
|
@ -262,41 +262,25 @@ for connector in config.sections():
|
||||||
logging.debug(f'API credentialid: {credential_types[connector_type]}')
|
logging.debug(f'API credentialid: {credential_types[connector_type]}')
|
||||||
body['credentialId'] = credential_types[connector_type]
|
body['credentialId'] = credential_types[connector_type]
|
||||||
|
|
||||||
if 'cxp' in body:
|
for key in ['cxp', 'size', 'group']:
|
||||||
logging.debug(f"JSON cxp: {body['cxp']}")
|
if key in body:
|
||||||
if 'cxp' in section:
|
logging.debug(f"JSON {key}: {body[key]}")
|
||||||
logging.debug(f"CONFIG cxp: {section['cxp']}")
|
if key in section:
|
||||||
body['cxp'] = section['cxp']
|
logging.debug(f"CONFIG {key}: {section[key]}")
|
||||||
|
body[key] = section[key]
|
||||||
|
|
||||||
if 'size' in body:
|
for key in ['segments', 'billingTags']:
|
||||||
logging.debug(f"JSON size: {body['size']}")
|
if key in body:
|
||||||
if 'size' in section:
|
logging.debug(f"JSON key: {body[key][0]}")
|
||||||
logging.debug(f"CONFIG size: {section['size']}")
|
if key in section:
|
||||||
body['size'] = section['size']
|
logging.debug(f"CONFIG key: {section[key]}")
|
||||||
|
body[key][0] = section[key]
|
||||||
if 'segments' in body:
|
|
||||||
logging.debug(f"JSON segments: {body['segments'][0]}")
|
|
||||||
if 'segments' in section:
|
|
||||||
logging.debug(f"CONFIG segments: {section['segments']}")
|
|
||||||
body['segments'][0] = section['segments']
|
|
||||||
|
|
||||||
if 'group' in body:
|
|
||||||
logging.debug(f"JSON group: {body['group']}")
|
|
||||||
if 'group' in section:
|
|
||||||
logging.debug(f"CONFIG group: {section['group']}")
|
|
||||||
body['group'] = section['group']
|
|
||||||
|
|
||||||
if 'group' not in body:
|
if 'group' not in body:
|
||||||
if 'group' in section:
|
if 'group' in section:
|
||||||
logging.debug(f"CONFIG group: {section['group']}")
|
logging.debug(f"CONFIG group: {section['group']}")
|
||||||
body['group'] = section['group']
|
body['group'] = section['group']
|
||||||
|
|
||||||
if 'billingTags' in body:
|
|
||||||
logging.debug(f"JSON billingtags: {body['billingTags'][0]}")
|
|
||||||
if 'billingtags' in section:
|
|
||||||
logging.debug(f"CONFIG billingtags: {section['billingtags']}")
|
|
||||||
body['billingTags'][0] = section['billingtags']
|
|
||||||
|
|
||||||
if 'services' in connector_name and 'credentialId' in body and 'service_credentialid' in locals():
|
if 'services' in connector_name and 'credentialId' in body and 'service_credentialid' in locals():
|
||||||
logging.debug(f'API credentialid: {service_credentialid}')
|
logging.debug(f'API credentialid: {service_credentialid}')
|
||||||
body['credentialId'] = service_credentialid
|
body['credentialId'] = service_credentialid
|
||||||
|
|
Loading…
Reference in New Issue