def change_customer_for_apps_in_customer( original_customer, new_customer ): """Update the customer name for all apps in original customer. Args: current_customer (str): The name of the current customer. new_customer (str): The name of the new customer. Basic Usage: >>> from vFense.plugins.patching.patching import update_all_apps_for_customer >>> original_customer = 'default' >>> new_customer = 'test' >>> app_data = {'customer_name': 'test'} >>> update_all_apps_for_customer( original_customer, new_customer, app_data ) """ remove_customer = False agent_count = total_agents_in_customer(original_customer) if agent_count == 0: remove_customer = True app_data = {CommonAppKeys.CustomerName: new_customer} update_os_apps_for_agent_by_customer( original_customer, app_data ) update_customers_in_apps_by_customer( original_customer, new_customer, remove_customer ) update_supported_apps_for_agent_by_customer( original_customer, app_data ) update_customers_in_supported_apps( original_customer, new_customer, remove_customer ) update_custom_apps_for_agent_by_customer( original_customer, app_data ) update_customers_in_custom_apps( original_customer, new_customer, remove_customer ) update_vfense_apps_for_agent_by_customer( original_customer, app_data ) update_customers_in_vfense_apps( original_customer, new_customer, remove_customer )
def update_customers_in_vfense_apps( current_customer, new_customer, remove_customer=False, ): """ Update the customers list of all applications for the current customer. Args: current_customer (str): Name of the current customer. new_customer (str): Name of the new customer. Kwargs: remove_customer (bool): True or False default = False Basic Usage: >>> from vFense.plugins.patching.patching import update_customers_in_vfense_apps >>> current_customer = 'default' >>> new_customer = 'test' >>> remove_customer = True >>> update_customers_in_vfense_apps( current_customer, new_customer, remove_customer ) Returns: Tuple (status_code, count, error, generated ids) >>> (2001, 1, None, []) """ collection = AppCollections.vFenseApps return( update_customers_in_apps_by_customer( current_customer, new_customer, remove_customer, collection ) )