def provider_factory(provider_name, providers=None, credentials=None): if providers is None: cfme_data = load_cfme_data() providers = cfme_data['management_systems'] provider = providers[provider_name] if credentials is None: credentials_dict = load_credentials() credentials = credentials_dict[provider['credentials']] # Munge together provider dict and creds, # Let the provider do whatever they need with them provider_kwargs = provider.copy() provider_kwargs.update(credentials) provider_instance = provider_type_map[provider['type']](**provider_kwargs) return provider_instance
def provider_factory(provider_name, providers=None, credentials=None): if providers is None: cfme_data = load_cfme_data() providers = cfme_data['management_systems'] provider = providers[provider_name] if credentials is None: credentials_dict = load_credentials() credentials = credentials_dict[provider['credentials']] provider_instance = provider_type_map[provider['type']]( provider['ipaddress'], credentials['username'], credentials['password'] ) return provider_instance