Skip to content

Commit

Permalink
making multiple variables
Browse files Browse the repository at this point in the history
  • Loading branch information
eamonnfaherty committed Oct 15, 2024
1 parent 38f4b69 commit ec15db6
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 45 deletions.
2 changes: 1 addition & 1 deletion servicecatalog_puppet/commands/manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ def expand(f, puppet_account_id, regions, single_account, subset=None):
new_manifest = manifest_utils.parse_conditions(new_manifest)
new_manifest = manifest_utils.rewrite_c7n_cloudtrails(new_manifest)

if subset and subset.get("section"):
if subset and subset.get("single_action_section"):
click.echo(f"Filtering for subset: {subset}")
new_manifest = manifest_utils.isolate(new_manifest, subset)

Expand Down
21 changes: 0 additions & 21 deletions servicecatalog_puppet/commands/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,27 +89,6 @@ def wait_for_cloudformation_in(iam_role_arns):
logger.error(traceback.format_exc())


def is_a_parameter_override_execution() -> bool:
codepipeline_execution_id = os.getenv("EXECUTION_ID")
with betterboto_client.ClientContextManager("codepipeline") as codepipeline:
paginator = codepipeline.get_paginator("list_pipeline_executions")
pages = paginator.paginate(
pipelineName=constants.PIPELINE_NAME, PaginationConfig={"PageSize": 100,},
)
for page in pages:
for pipeline_execution_summary in page.get(
"pipelineExecutionSummaries", []
):
if codepipeline_execution_id == pipeline_execution_summary.get(
"pipelineExecutionId"
):
trigger_detail = pipeline_execution_summary.get("trigger").get(
"triggerDetail"
)
return trigger_detail == "ParameterisedSource"
return False


def wait_for_parameterised_run_to_complete(on_complete_url: str) -> bool:
with betterboto_client.ClientContextManager("s3") as s3:
paginator = s3.get_paginator("list_object_versions")
Expand Down
8 changes: 4 additions & 4 deletions servicecatalog_puppet/manifest_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1573,8 +1573,8 @@ def explode(expanded_manifest):


def isolate(expanded_manifest, subset):
section = subset["section"]
item = subset["item"]
section = subset["single_action_section"]
item = subset["single_action_item"]
uid = f"{section}|{item}"

m = create_minimal_manifest(expanded_manifest)
Expand All @@ -1585,7 +1585,7 @@ def isolate(expanded_manifest, subset):
del data["item_name"]
m[node.get("section")][node.get("item_name")] = data

if subset.get("include_dependencies", False):
if subset.get("single_action_include_dependencies", False):
click.echo("Including dependencies")
for dependency in nx.edge_dfs(G, uid, orientation="original"):
link, dependency_name, direction = dependency
Expand All @@ -1595,7 +1595,7 @@ def isolate(expanded_manifest, subset):
del data["item_name"]
m[node.get("section")][node.get("item_name")] = data

if subset.get("include_reverse_dependencies", False):
if subset.get("single_action_include_reverse_dependencies", False):
click.echo("Including reverse dependencies")
for reverse_dependency in nx.edge_dfs(G, uid, orientation="reverse"):
reverse_dependency_name, link, direction = reverse_dependency
Expand Down
19 changes: 0 additions & 19 deletions servicecatalog_puppet/template_builder/hub/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -548,22 +548,6 @@ def get_template(
source_stage = codepipeline.Stages(
Name="Source",
Actions=[
codepipeline.Actions(
RunOrder=1,
RoleArn=t.GetAtt("SourceRole", "Arn"),
ActionTypeId=codepipeline.ActionTypeId(
Category="Source", Owner="AWS", Version="1", Provider="S3",
),
OutputArtifacts=[
codepipeline.OutputArtifacts(Name="ParameterisedSource")
],
Configuration={
"S3Bucket": t.Ref(parameterised_source_bucket),
"S3ObjectKey": "parameters.zip",
"PollForSourceChanges": True,
},
Name="ParameterisedSource",
)
],
)

Expand Down Expand Up @@ -884,7 +868,6 @@ def get_template(
codepipeline.Actions(
InputArtifacts=[
codepipeline.InputArtifacts(Name="Source"),
codepipeline.InputArtifacts(Name="ParameterisedSource"),
],
Name="DryRun",
ActionTypeId=codepipeline.ActionTypeId(
Expand Down Expand Up @@ -919,7 +902,6 @@ def get_template(
codepipeline.Actions(
InputArtifacts=[
codepipeline.InputArtifacts(Name="Source"),
codepipeline.InputArtifacts(Name="ParameterisedSource"),
],
Name="Deploy",
ActionTypeId=codepipeline.ActionTypeId(
Expand All @@ -946,7 +928,6 @@ def get_template(
codepipeline.Actions(
InputArtifacts=[
codepipeline.InputArtifacts(Name="Source"),
codepipeline.InputArtifacts(Name="ParameterisedSource"),
],
Name="Deploy",
ActionTypeId=codepipeline.ActionTypeId(
Expand Down

0 comments on commit ec15db6

Please sign in to comment.