def prepare_launch_config(scaling_group_uuid, launch_config): """ Prepare a launch_config for the specified scaling_group. This is responsible for returning a copy of the launch config that has metadata and unique server names added. :param IScalingGroup scaling_group: The scaling group this server is getting launched for. :param dict launch_config: The complete launch_config args we want to build servers from. :return dict: The prepared launch config. """ launch_config = freeze(launch_config) lb_descriptions = json_to_LBConfigs(launch_config.get('loadBalancers', [])) launch_config = prepare_server_launch_config(scaling_group_uuid, launch_config, lb_descriptions) suffix = generate_server_name() launch_config = set_server_name(launch_config, suffix) return thaw(launch_config)
def prepare_launch_config(scaling_group_uuid, launch_config): """ Prepare a launch_config for the specified scaling_group. This is responsible for returning a copy of the launch config that has metadata and unique server names added. :param IScalingGroup scaling_group: The scaling group this server is getting launched for. :param dict launch_config: The complete launch_config args we want to build servers from. :return dict: The prepared launch config. """ launch_config = freeze(launch_config) lb_descriptions = json_to_LBConfigs(launch_config.get('loadBalancers', [])) launch_config = prepare_server_launch_config( scaling_group_uuid, launch_config, lb_descriptions) suffix = generate_server_name() launch_config = set_server_name(launch_config, suffix) return thaw(launch_config)
def test_with_clb_and_rackconnect(self): """ LB config with both CLBs and rackconnect. """ self.assertEqual( json_to_LBConfigs( [{'loadBalancerId': 20, 'port': 80}, {'loadBalancerId': 20, 'port': 800}, {'loadBalancerId': 20, 'type': 'RackConnectV3'}, {'loadBalancerId': 200, 'type': 'RackConnectV3'}, {'loadBalancerId': 21, 'port': 81}, {'loadBalancerId': 'cebdc220-172f-4b10-9f29-9c7e980ba41d', 'type': 'RackConnectV3'}]), pset([ CLBDescription(lb_id='20', port=80), CLBDescription(lb_id='20', port=800), CLBDescription(lb_id='21', port=81), RCv3Description(lb_id='20'), RCv3Description(lb_id='200'), RCv3Description(lb_id='cebdc220-172f-4b10-9f29-9c7e980ba41d') ]))