示例#1
0
def resume(
    id: Optional[str],
    namespace: references.Namespace,
    peering_name: str,
) -> None:
    """ Resume the resource handling in the cluster. """
    identity = peering.Identity(id) if id else peering.detect_own_id(
        manual=True)
    registry = registries.SmartOperatorRegistry()
    settings = configuration.OperatorSettings()
    settings.peering.name = peering_name
    vault = credentials.Vault()
    auth.vault_var.set(vault)
    loop = asyncio.get_event_loop()
    loop.run_until_complete(
        asyncio.wait({
            activities.authenticate(registry=registry,
                                    settings=settings,
                                    vault=vault),
            peering.touch(
                identity=identity,
                settings=settings,
                namespace=namespace,
                lifetime=0,
            ),
        }))
示例#2
0
def freeze(
    id: Optional[str],
    message: Optional[str],
    lifetime: int,
    namespaces: Collection[references.NamespacePattern],
    clusterwide: bool,
    peering_name: str,
    priority: int,
) -> None:
    """ Freeze the resource handling in the cluster. """
    identity = peering.Identity(id) if id else peering.detect_own_id(
        manual=True)
    insights = references.Insights()
    settings = configuration.OperatorSettings()
    settings.peering.name = peering_name
    settings.peering.priority = priority
    return running.run(clusterwide=clusterwide,
                       namespaces=namespaces,
                       insights=insights,
                       identity=identity,
                       settings=settings,
                       _command=peering.touch_command(insights=insights,
                                                      identity=identity,
                                                      settings=settings,
                                                      lifetime=lifetime))