def __init__(self, job_name=None, build_number=None, master_ip=None, configs_directory=None, session=None): self.check_sit(configs_directory=configs_directory, session=session) sit_helper = SITHelper(configs_directory) self.configs_directory = configs_directory sit_configs = sit_helper.get_configs('sit') troposphere_configs = sit_helper.get_configs('troposphere') self.PROFILE = sit_configs['profile_name'] self.LOGICAL_AUTOSCALING_GROUP_NAME = troposphere_configs[ 'autoscaling_group_name'] self.LOGICAL_CLUSTER_NAME = troposphere_configs['cluster_name'] self.STACK_NAME = troposphere_configs['stack_name'] self.ROLES = sit_helper.get_roles() self.ATTEMPT_LIMIT = sit_configs['attempt_limit'] self.RESOURCES_ATTEMPT_LIMIT = sit_configs['resources_attempt_limit'] self.INITIAL_CLUSTER_SIZE = sit_configs['initial_cluster_size'] self.SAVE_LOGS = sit_configs['save_logs'] self.HIGHSTATE_LOG_DIR = sit_configs['highstate_log_dir'] self.REDIS_HOST = sit_configs.get('redis_host', None) self.cf_helper = CFHelper(configs_directory=configs_directory, session=session) self.family = self.join_items([job_name, build_number]) self.master_ip = master_ip self.is_build_successful = True self.instance_was_launched = False self.instance_was_terminated = False self.init_boto_clients(session=session) self.cluster = self.get_cluster() self.autoscaling_group = self.get_autoscaling_group() self.running_task_ids = []
def __init__(self, configs_directory=None, session=None): self.sit_helper = SITHelper(configs_directory) self.ROLES = self.sit_helper.get_roles() self.SIT_CONFIGS = self.sit_helper.get_configs('sit') self.TROPOSPHERE_CONFIGS = self.sit_helper.get_configs('troposphere') self.cf_helper = CFHelper(configs_directory=configs_directory, session=session)
def mock_cf_helper_true_responses(self): cf_helper = CFHelper(configs_directory=self.configs_directory, session=self.session) cf_helper.get_stack_info = MagicMock(return_value=False) cf_helper.validate_template = MagicMock(return_value=True) cf_helper.create_or_update_stack = MagicMock(return_value=True) cf_helper.create_stack = MagicMock(return_value=True) cf_helper.stack_was_created_successfully = MagicMock(return_value=True) self.sit_loader.cf_helper = cf_helper
def setUp(self): session = Session(region_name='us-west-1') current_dir = os.path.dirname(os.path.realpath(__file__)) test_dir = '{0}/test_data'.format(current_dir) pill = placebo.attach(session, test_dir) pill.playback() self.configs_directory = 'tests/sit/configs' self.cf_helper_placebo = CFHelper( configs_directory=self.configs_directory, session=session) self.sit_loader_placebo = SITLoader( configs_directory=self.configs_directory, session=session)
def __init__(self, configs_directory='configs', session=None): troposphere_configs = SITHelper(configs_directory).get_configs( 'troposphere') self.STACK_NAME = troposphere_configs['stack_name'] self.TAG_VALUE = troposphere_configs['tag_value'] self.AMI_ID = troposphere_configs['ami_id'] self.SUBNET = troposphere_configs['subnet'] self.SECURITY_GROUPS = troposphere_configs['security_groups'] self.KEY_NAME = troposphere_configs['key_name'] self.AMI_URL = troposphere_configs['ami_url'] self.cf_helper = CFHelper(configs_directory=configs_directory, session=session) self.sit_template = SITTemplate(configs_directory) self.template = self.sit_template.template self.template_json = self.template.to_json()