MCPcopy Create free account
hub / github.com/Keeper-Security/Commander / detect_kwargs

Function detect_kwargs

keepercommander/plugins/plugin_manager.py:107–122  ·  view source on GitHub ↗
(record, plugin_name, plugin_kwargs)

Source from the content-addressed store, hash-verified

105
106
107def detect_kwargs(record, plugin_name, plugin_kwargs):
108 # Look elsewhere in record if host or port parameter is missing
109 if 'host' in REQUIRED_PLUGIN_KWARGS.get(plugin_name, []) and 'host' not in plugin_kwargs:
110 host_field = get_host_field_dict(record)
111 if host_field:
112 plugin_kwargs['host'] = host_field['hostName']
113 if all((host_field['port'].isnumeric(),
114 'port' in REQUIRED_PLUGIN_KWARGS[plugin_name],
115 'port' not in plugin_kwargs)):
116 plugin_kwargs['port'] = int(host_field['port'])
117 elif 'url' in plugin_kwargs:
118 url = urlparse(plugin_kwargs['url'])
119 if url.netloc:
120 plugin_kwargs['host'] = url.netloc
121 if url.port and 'port' in REQUIRED_PLUGIN_KWARGS[plugin_name] and 'port' not in plugin_kwargs:
122 plugin_kwargs['port'] = host_field['port']
123
124
125def check_missing_kwargs(plugin_name, plugin_kwargs):

Callers 1

get_pluginFunction · 0.85

Calls 2

get_host_field_dictFunction · 0.85
getMethod · 0.80

Tested by

no test coverage detected