def deploy_only(name, bytes_value, server_group): builder = OperationRequestBuilder() builder.content_reference(bytes_value) builder.target(server_group) builder.add() builder.payload(dict(enabled=True)) builder.deployment(name) return builder.build()
def deploy(name, src, server_group): add_builder = OperationRequestBuilder() add_builder.deployment(name) add_builder.content(src) add_builder.add() add_content = add_builder.build() deploy_builder = OperationRequestBuilder() deploy_builder.target(server_group) deploy_builder.deploy() deploy_builder.deployment(name) deploy_operation = deploy_builder.build() return [add_content, deploy_operation]
def test_composite_operation(): builder = OperationRequestBuilder() builder.add() add_operation = builder.build() builder = OperationRequestBuilder() builder.deploy() deploy_operation = builder.build() builder = OperationRequestBuilder() builder.composite([add_operation, deploy_operation]) request = builder.build() assert request == dict(address=[], operation='composite', steps=[add_operation, deploy_operation])
def test_add_operation(): builder = OperationRequestBuilder() builder.add() request = builder.build() assert request == dict(operation='add', address=[])
def add(path, attributes): builder = OperationRequestBuilder() builder.address_from(path) builder.add() builder.payload(attributes) return builder.build()