Skip to content

Import opengear

A modification workflow for migrating an ImportedOpengear to an Opengear subscription.

import_opengear_subscription(subscription_id)

Take an ImportedOpengear subscription, and turn it into an Opengear subscription.

Source code in gso/workflows/opengear/import_opengear.py
@step("Create new Opengear subscription")
def import_opengear_subscription(subscription_id: UUIDstr) -> State:
    """Take an ImportedOpengear subscription, and turn it into an Opengear subscription."""
    old_opengear = ImportedOpengear.from_subscription(subscription_id)
    product_id = get_product_id_by_name(ProductName.OPENGEAR)
    new_subscription = Opengear.from_other_product(old_opengear, product_id)  # type: ignore[arg-type]

    return {"subscription": new_subscription}

import_opengear()

Modify an ImportedOpengear subscription into an Opengear subscription to complete the import.

Source code in gso/workflows/opengear/import_opengear.py
@workflow("Import Opengear", target=Target.MODIFY, initial_input_form=wrap_modify_initial_input_form(None))
def import_opengear() -> StepList:
    """Modify an ImportedOpengear subscription into an Opengear subscription to complete the import."""
    return init >> store_process_subscription(Target.MODIFY) >> unsync >> import_opengear_subscription >> resync >> done