Skip to content

Commit 6c6c87a

Browse files
committed
Marking references to api_url as deprecated
1 parent 263e9c3 commit 6c6c87a

File tree

2 files changed

+24
-9
lines changed

2 files changed

+24
-9
lines changed

packages/openshift/action.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,8 +232,8 @@ def oc_action(context, verb, cmd_args=None, all_namespaces=False, no_namespace=F
232232
if context.get_kubeconfig_path() is not None:
233233
cmds.append("--kubeconfig=%s" % context.get_kubeconfig_path())
234234

235-
if context.get_api_url() is not None:
236-
url = context.get_api_url()
235+
if context.get_api_server() is not None:
236+
url = context.get_api_server()
237237

238238
# If insecure:// is specified, skip TLS verification
239239
if url.startswith("insecure://"):

packages/openshift/context.py

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def __init__(self):
3535
self.parent = None
3636
self.oc_path = None
3737
self.kubeconfig_path = None
38-
self.api_url = None
38+
self.api_server = None
3939
self.token = None
4040
self.ca_cert_path = None
4141
self.project_name = None
@@ -121,12 +121,19 @@ def __exit__(self, type, value, traceback):
121121
context.stack.pop()
122122
self.close_ssh()
123123

124+
# TODO: deprecate this API (flagged on: 4/28/2023)
124125
def get_api_url(self):
126+
"""
127+
The API has been flagged for deprecation. Please use get_api_server instead
128+
"""
129+
return self.get_api_server()
125130

126-
if self.api_url is not None:
127-
return self.api_url
131+
def get_api_server(self):
132+
133+
if self.api_server is not None:
134+
return self.api_server
128135
if self.parent is not None:
129-
return self.parent.get_api_url()
136+
return self.parent.get_api_server()
130137
return context.default_api_server
131138

132139
def get_token(self):
@@ -195,7 +202,7 @@ def get_project(self):
195202
return self.project_name
196203
# if cluster is changing, don't check parent for project
197204
# with project must always be inside with cluster.
198-
if self.api_url is None and self.parent is not None:
205+
if self.api_server is None and self.parent is not None:
199206
return self.parent.get_project()
200207
return context.default_project
201208

@@ -335,8 +342,16 @@ def set_default_kubeconfig_path(path):
335342
context.default_kubeconfig_path = path
336343

337344

345+
# TODO: deprecate this API (flagged on: 4/28/2023)
338346
def set_default_api_url(url):
339-
context.default_api_url = url
347+
"""
348+
The API has been flagged for deprecation. Please use set_default_api_server instead
349+
"""
350+
set_default_api_server(url)
351+
352+
353+
def set_default_api_server(server):
354+
context.default_api_server = server
340355

341356

342357
def set_default_project(name):
@@ -429,7 +444,7 @@ def api_server(api_url=None, ca_cert_path=None, kubeconfig_path=None):
429444

430445
c = Context()
431446
c.kubeconfig_path = kubeconfig_path
432-
c.api_url = api_url
447+
c.api_server = api_url
433448
c.ca_cert_path = ca_cert_path
434449
return c
435450

0 commit comments

Comments
 (0)