def _update_func_sempv1(self, ldap_profile_name, settings, delta_settings,
                         op):
     if not settings:
         return None
     combined_resps = {}
     # iterate over settings.keys and send 1 update after the other
     for key, val in settings.items():
         if val:
             if key == 'search' and isinstance(val, dict):
                 # iterate through sarch
                 for skey, sval in val.items():
                     _resp = self._send_sempv1_update(
                         ldap_profile_name, key, {skey: sval}, op)
                     _call_log = {
                         self.sempv1_api.getNextCallKey(): {
                             key: {
                                 skey: sval,
                                 'response': _resp
                             }
                         }
                     }
                     combined_resps = SolaceUtils.merge_dicts_recursive(
                         combined_resps, _call_log)
             else:
                 _resp = self._send_sempv1_update(ldap_profile_name, key,
                                                  val, op)
                 _call_log = {
                     self.sempv1_api.getNextCallKey(): {
                         key: val,
                         'response': _resp
                     }
                 }
                 combined_resps = SolaceUtils.merge_dicts_recursive(
                     combined_resps, _call_log)
     return combined_resps
예제 #2
0
 def get_remoteFormattedHostInventory(
         self,
         solace_cloud_service_facts: SolaceCloudBrokerFacts,
         search_dict: dict,
         remote_host_inventory: dict,
         remote_host_inventory_hostname: str,
         host_entry: str,
         api_token: str = None,
         meta: dict = None):
     remote_host_inventory_params = solace_cloud_service_facts.get_field(
         remote_host_inventory, remote_host_inventory_hostname)
     if not remote_host_inventory_params:
         raise SolaceParamsValidationError(
             "remote_host_inventory_hostname",
             remote_host_inventory_hostname,
             f"not found in remote_host_inventory: {remote_host_inventory}")
     _field, broker_inventory = self.get_formattedHostInventory(
         solace_cloud_service_facts, search_dict, host_entry, api_token,
         meta)
     del broker_inventory['all']['hosts'][host_entry]['ansible_connection']
     remote_inventory = {
         'all': {
             'hosts': {
                 host_entry: remote_host_inventory_params
             }
         }
     }
     inventory = SolaceUtils.merge_dicts_recursive(remote_inventory,
                                                   broker_inventory)
     return 'remoteFormattedHostInventory', inventory
 def _send_sempv1_update(self, ldap_profile_name, key, val, op):
     _rpc_update_dict = {'authentication': {'ldap-profile': {key: val}}}
     _rpc_dict = {
         'authentication': {
             'ldap-profile': {
                 'profile-name': ldap_profile_name
             }
         }
     }
     rpc_dict = SolaceUtils.merge_dicts_recursive(_rpc_dict,
                                                  _rpc_update_dict)
     return self.sempv1_api.make_post_request(
         self.get_config(),
         self.sempv1_api.convertDict2Sempv1RpcXmlString(rpc_dict), op)