File tree 2 files changed +18
-1
lines changed
2 files changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -147,6 +147,20 @@ def test_create_rbac_role_from_yaml(self):
147
147
rbac_api .delete_namespaced_role (
148
148
name = "pod-reader" , namespace = "default" , body = {})
149
149
150
+ def test_create_rbac_role_from_yaml_with_verbose_enabled (self ):
151
+ """
152
+ Should be able to create an rbac role with verbose enabled.
153
+ """
154
+ k8s_client = client .api_client .ApiClient (configuration = self .config )
155
+ utils .create_from_yaml (
156
+ k8s_client , self .path_prefix + "rbac-role.yaml" , verbose = True )
157
+ rbac_api = client .RbacAuthorizationV1Api (k8s_client )
158
+ rbac_role = rbac_api .read_namespaced_role (
159
+ name = "pod-reader" , namespace = "default" )
160
+ self .assertIsNotNone (rbac_role )
161
+ rbac_api .delete_namespaced_role (
162
+ name = "pod-reader" , namespace = "default" , body = {})
163
+
150
164
def test_create_deployment_non_default_namespace_from_yaml (self ):
151
165
"""
152
166
Should be able to create a namespace "dep",
Original file line number Diff line number Diff line change @@ -156,7 +156,10 @@ def create_from_yaml_single_item(
156
156
resp = getattr (k8s_api , "create_{0}" .format (kind ))(
157
157
body = yml_object , ** kwargs )
158
158
if verbose :
159
- print ("{0} created. status='{1}'" .format (kind , str (resp .status )))
159
+ msg = "{0} created." .format (kind )
160
+ if hasattr (resp , 'status' ):
161
+ msg += " status='{0}'" .format (str (resp .status ))
162
+ print (msg )
160
163
161
164
162
165
class FailToCreateError (Exception ):
You can’t perform that action at this time.
0 commit comments