You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since Python3.11, the f-string f"{KubernetesResourceType.SERVICEACCOUNT}" evaluates to the literal "KubernetesResourceType.SERVICEACCOUNT" itself rather than the value of that enumerator (which is the string literal "serviceaccount"). As a result, creation of service account fails with the error.
An exception is raised. The following is the stack trace.
b'Error: must specify one of -f and -k\n\nerror: unknown command "KubernetesResourceType.SERVICEACCOUNT bikalpa"\nSee \'kubectl create -h\' for help and examples\n'
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/bikalpa/canonical/spark-k8s-toolkit-py/spark8t/services.py", line 1157, in create
self.kube_interface.create(
File "/home/bikalpa/canonical/spark-k8s-toolkit-py/spark8t/services.py", line 883, in create
self.exec(
File "/home/bikalpa/canonical/spark-k8s-toolkit-py/spark8t/services.py", line 730, in exec
else execute_command_output(base_cmd)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/bikalpa/canonical/spark-k8s-toolkit-py/spark8t/utils.py", line 285, in execute_command_output
raise e
File "/home/bikalpa/canonical/spark-k8s-toolkit-py/spark8t/utils.py", line 279, in execute_command_output
output = subprocess.check_output(
^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/subprocess.py", line 466, in check_output
return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/subprocess.py", line 571, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command 'kubectl --kubeconfig /home/bikalpa/.kube/config --namespace default --context microk8s create KubernetesResourceType.SERVICEACCOUNT bikalpa -o name ' returned non-zero exit status 1.
Since Python3.11, the f-string
f"{KubernetesResourceType.SERVICEACCOUNT}"
evaluates to the literal"KubernetesResourceType.SERVICEACCOUNT"
itself rather than the value of that enumerator (which is the string literal"serviceaccount"
). As a result, creation of service account fails with the error.Steps to reproduce
Use Python 3.11.x to reproduce.
Expected behavior
The service account should get created.
Actual behavior
An exception is raised. The following is the stack trace.
Versions
Operating system: Ubuntu 23.04
Additional context
https://blog.pecar.me/python-enum
The text was updated successfully, but these errors were encountered: