def change_node_state(deployer, desired_configuration):
    state_persister = InMemoryStatePersister()

    def converge():
        d = deployer.discover_state(
            DeploymentState(nodes={
                NodeState(hostname=deployer.hostname, uuid=deployer.node_uuid,
                          applications=[],
                          manifestations={}, paths={}, devices={}),
            }),
            persistent_state=state_persister.get_state(),
        )

        def got_changes(local_state):
            changes = local_state.shared_state_changes()
            cluster_state = DeploymentState()
            for change in changes:
                cluster_state = change.update_cluster_state(cluster_state)
            return deployer.calculate_changes(
                desired_configuration, cluster_state, local_state)
        d.addCallback(got_changes)
        d.addCallback(lambda change: run_state_change(
            change, deployer=deployer,
            state_persister=state_persister))
        return d
    # Repeat a few times until things settle down:
    result = converge()
    result.addCallback(lambda _: converge())
    result.addCallback(lambda _: converge())
    return result
Fix up bad headers that cause problems for the wrapped WCS
dataset/ETHPy150Open ClusterHQ/flocker/flocker/node/functional/test_deploy.py/change_node_state--crossover with--dataset/ETHPy150Open ejeschke/ginga/ginga/util/wcsmod.py/BaseWCS.fix_bad_headers