Skip to content

Commit

Permalink
Merge pull request #122 from mikegrima/fixagain
Browse files Browse the repository at this point in the history
Moved IAMbic imports to local imports
  • Loading branch information
mikegrima authored Feb 21, 2024
2 parents 4bb274f + e1f3186 commit 2fe13c5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
7 changes: 5 additions & 2 deletions src/starfleet/worker_ships/plugins/iam/role_ship.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
make_iambic_variables,
)
from starfleet.worker_ships.ship_schematics import StarfleetWorkerShip, FanOutStrategy, AlertPriority
from starfleet.worker_ships.plugins.iam.iambic_imports import AWSAccount, AwsIamRoleTemplate, iambic_ctx


class IambicFailedError(Exception):
Expand Down Expand Up @@ -65,13 +64,17 @@ def render_iambic_template(self, commit: bool = False) -> Dict[str, Any]:
"""This will render the iambic template and return it back out."""
return render_iambic_template(self.payload, IambicTemplateTypes.IAM_ROLE, commit)

def prepare_iambic_template(self, rendered_template: Dict[str, Any]) -> AwsIamRoleTemplate:
def prepare_iambic_template(self, rendered_template: Dict[str, Any]) -> "AwsIamRoleTemplate":
"""This will perform the additional validation that is needed to load and generate the iambic template."""
from starfleet.worker_ships.plugins.iam.iambic_imports import AwsIamRoleTemplate

AwsIamRoleTemplate.update_forward_refs()
return AwsIamRoleTemplate(**rendered_template)

def execute(self, commit: bool = False) -> None:
"""Execute the payload to sync out."""
from starfleet.worker_ships.plugins.iam.iambic_imports import AWSAccount, iambic_ctx

config = self.configuration_template_class().load(STARFLEET_CONFIGURATION.config[self.worker_ship_name])

# Pull out the payload details for this account:
Expand Down
4 changes: 2 additions & 2 deletions src/starfleet/worker_ships/plugins/iam/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
from starfleet.utils.logging import LOGGER
from starfleet.worker_ships.base_payload_schemas import IncludeAccountsSpecificationSchema, AccountsSpecificationSchema, BaseAccountPayloadTemplate
from starfleet.worker_ships.ship_schematics import WorkerShipBaseConfigurationTemplate
from starfleet.worker_ships.plugins.iam.iambic_imports import Variable


class IambicTemplateTypes(Enum):
Expand Down Expand Up @@ -69,8 +68,9 @@ def render_iambic_template(template: Dict[str, Any], template_type: IambicTempla
return rendered_template


def make_iambic_variables(template_variables: List[Dict[str, str]]) -> List[Variable]:
def make_iambic_variables(template_variables: List[Dict[str, str]]) -> List["Variable"]:
"""This will make the iambic variable objects from the Starfleet template variables."""
from starfleet.worker_ships.plugins.iam.iambic_imports import Variable

iambic_variables = []
for variable in template_variables:
Expand Down

0 comments on commit 2fe13c5

Please sign in to comment.