Ejemplo n.º 1
0
 def run(self):
     self.info(f"Launching and execution mode is: {self.execution_mode}")
     tasks = list()
     if self.execution_mode == constants.EXECUTION_MODE_SPOKE:
         for launch_name, launch_details in self.manifest.get(
                 "launches", {}).items():
             if launch_details.get(
                     "execution") == constants.EXECUTION_MODE_SPOKE:
                 tasks.append(
                     provisioning_tasks.LaunchTask(
                         launch_name=launch_name,
                         manifest_file_path=self.manifest_file_path,
                         puppet_account_id=self.puppet_account_id,
                         should_use_sns=self.should_use_sns,
                         should_use_product_plans=self.
                         should_use_product_plans,
                         include_expanded_from=self.include_expanded_from,
                         single_account=self.single_account,
                         is_dry_run=self.is_dry_run,
                         execution_mode=self.execution_mode,
                         cache_invalidator=self.cache_invalidator,
                     ))
     else:
         for launch_name, launch_details in self.manifest.get(
                 "launches", {}).items():
             if launch_details.get(
                     "execution") == constants.EXECUTION_MODE_SPOKE:
                 tasks.append(
                     provisioning_tasks.LaunchInSpokeTask(
                         launch_name=launch_name,
                         manifest_file_path=self.manifest_file_path,
                         puppet_account_id=self.puppet_account_id,
                         should_use_sns=self.should_use_sns,
                         should_use_product_plans=self.
                         should_use_product_plans,
                         include_expanded_from=self.include_expanded_from,
                         single_account=self.single_account,
                         is_dry_run=self.is_dry_run,
                         execution_mode=self.execution_mode,
                     ))
             else:
                 tasks.append(
                     provisioning_tasks.LaunchTask(
                         launch_name=launch_name,
                         manifest_file_path=self.manifest_file_path,
                         puppet_account_id=self.puppet_account_id,
                         should_use_sns=self.should_use_sns,
                         should_use_product_plans=self.
                         should_use_product_plans,
                         include_expanded_from=self.include_expanded_from,
                         single_account=self.single_account,
                         is_dry_run=self.is_dry_run,
                         execution_mode=self.execution_mode,
                         cache_invalidator=self.cache_invalidator,
                     ))
     yield tasks
     self.write_output(self.manifest.get("launches", {}))
def generate_launch_tasks(
    manifest,
    puppet_account_id,
    should_use_sns,
    should_use_product_plans,
    include_expanded_from=False,
    single_account=None,
    is_dry_run=False,
    execution_mode="hub",
):
    logger.info(f"m.generate_launch_tasks execution_mode is {execution_mode}")
    logger.info(f"execution_mode {execution_mode}")
    if execution_mode == constants.EXECUTION_MODE_SPOKE:
        return [
            provisioning.LaunchTask(
                launch_name=launch_name,
                manifest=manifest,
                puppet_account_id=puppet_account_id,
                should_use_sns=should_use_sns,
                should_use_product_plans=should_use_product_plans,
                include_expanded_from=include_expanded_from,
                single_account=single_account,
                is_dry_run=is_dry_run,
                execution_mode=execution_mode,
            ) for launch_name, launch_details in manifest.get(
                "launches", {}).items() if launch_details.get("execution") ==
            constants.EXECUTION_MODE_SPOKE
        ]
    else:
        return [
            provisioning.LaunchTask(
                launch_name=launch_name,
                manifest=manifest,
                puppet_account_id=puppet_account_id,
                should_use_sns=should_use_sns,
                should_use_product_plans=should_use_product_plans,
                include_expanded_from=include_expanded_from,
                single_account=single_account,
                is_dry_run=is_dry_run,
                execution_mode=execution_mode,
            ) for launch_name, launch_details in manifest.get("launches",
                                                              {}).items() if
            launch_details.get("execution") != constants.EXECUTION_MODE_SPOKE
        ]
Ejemplo n.º 3
0
def generate_launch_tasks(manifest,
                          puppet_account_id,
                          should_use_sns,
                          should_use_product_plans,
                          include_expanded_from=False,
                          single_account=None,
                          is_dry_run=False):
    return [
        provisioning.LaunchTask(
            launch_name=launch_name,
            manifest=manifest,
            puppet_account_id=puppet_account_id,
            should_use_sns=should_use_sns,
            should_use_product_plans=should_use_product_plans,
            include_expanded_from=include_expanded_from,
            single_account=single_account,
            is_dry_run=is_dry_run,
        ) for launch_name in manifest.get('launches', {}).keys()
    ]