forked from RedHatQE/openshift-python-wrapper
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgeneral.py
More file actions
19 lines (15 loc) · 802 Bytes
/
general.py
File metadata and controls
19 lines (15 loc) · 802 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
from ocp_resources.namespace import Namespace
from ocp_resources.resource import get_client
client = get_client()
# The examples given below are relevant to all resources. For simplicity we will use the resource - Namespace.
ns = Namespace(client=client, name="namespace-example-1")
ns.deploy()
assert ns.exists
ns.clean_up()
# We can also use the ``with`` statement which ensures automatic clean-up of the code executed:
# teardown=False`` - Disables clean-up after execution
with Namespace(client=client, name="namespace-example-2") as ns:
# Wait for Namespace to be in status ``Active``:
# Will raise a ``TimeoutExpiredError`` if Namespace is not in the desired status.
ns.wait_for_status(status=Namespace.Status.ACTIVE, timeout=120)
# Checks if Namespace exists on the server: