def test_deployment_id_exists(self): # The function should return whatever run_with_timeout returns. host = 'boo' secret = 'baz' deployment_id_exists = True flexmock(AppControllerClient).should_receive('run_with_timeout')\ .and_return(deployment_id_exists) acc = AppControllerClient(host, secret) self.assertEqual(deployment_id_exists, acc.deployment_id_exists())
def appscale_has_deployment_id(cls, head_node, keyname): """ Try to retrieve a deployment ID from ZooKeeper to see if this deployment has already been registered. Args: head_node: A string containing the IP address of the head node. keyname: A string representing the SSH keypair name used for this AppScale deployment. Returns: A boolean indicating whether the deployment ID exists or not. """ # Check if head node has a deployment ID stored. secret = LocalState.get_secret_key(keyname) acc = AppControllerClient(head_node, secret) return acc.deployment_id_exists()