Merge pull request #824 from tnqn/verbose
Fix AttributeError in create_from_yaml
This commit is contained in:
commit
1ad4afff35
@ -147,6 +147,20 @@ class TestUtils(unittest.TestCase):
|
||||
rbac_api.delete_namespaced_role(
|
||||
name="pod-reader", namespace="default", body={})
|
||||
|
||||
def test_create_rbac_role_from_yaml_with_verbose_enabled(self):
|
||||
"""
|
||||
Should be able to create an rbac role with verbose enabled.
|
||||
"""
|
||||
k8s_client = client.api_client.ApiClient(configuration=self.config)
|
||||
utils.create_from_yaml(
|
||||
k8s_client, self.path_prefix + "rbac-role.yaml", verbose=True)
|
||||
rbac_api = client.RbacAuthorizationV1Api(k8s_client)
|
||||
rbac_role = rbac_api.read_namespaced_role(
|
||||
name="pod-reader", namespace="default")
|
||||
self.assertIsNotNone(rbac_role)
|
||||
rbac_api.delete_namespaced_role(
|
||||
name="pod-reader", namespace="default", body={})
|
||||
|
||||
def test_create_deployment_non_default_namespace_from_yaml(self):
|
||||
"""
|
||||
Should be able to create a namespace "dep",
|
||||
|
||||
@ -156,7 +156,10 @@ def create_from_yaml_single_item(
|
||||
resp = getattr(k8s_api, "create_{0}".format(kind))(
|
||||
body=yml_object, **kwargs)
|
||||
if verbose:
|
||||
print("{0} created. status='{1}'".format(kind, str(resp.status)))
|
||||
msg = "{0} created.".format(kind)
|
||||
if hasattr(resp, 'status'):
|
||||
msg += " status='{0}'".format(str(resp.status))
|
||||
print(msg)
|
||||
|
||||
|
||||
class FailToCreateError(Exception):
|
||||
|
||||
Loading…
Reference in New Issue
Block a user