|
5 | 5 | import logging
|
6 | 6 | import re
|
7 | 7 | import subprocess
|
| 8 | + |
| 9 | +from importlib.metadata import version |
| 10 | + |
8 | 11 | import urllib3
|
9 | 12 | import shtab
|
10 |
| -from importlib.metadata import version |
11 | 13 |
|
12 | 14 | from pvecontrol import actions, node, vm, task, storage
|
13 | 15 | from pvecontrol.cluster import PVECluster
|
@@ -72,8 +74,8 @@ def filter_type(x):
|
72 | 74 |
|
73 | 75 | def _parser():
|
74 | 76 | parser = argparse.ArgumentParser(
|
75 |
| - description=f"Proxmox VE control CLI, version: {version(__name__)}", |
76 |
| - epilog="Made with love by Enix.io") |
| 77 | + description=f"Proxmox VE control CLI, version: {version(__name__)}", epilog="Made with love by Enix.io" |
| 78 | + ) |
77 | 79 | parser.add_argument("-v", "--verbose", action="store_true")
|
78 | 80 | parser.add_argument("--debug", action="store_true")
|
79 | 81 | parser.add_argument(
|
@@ -170,14 +172,31 @@ def run_auth_commands(clusterconfig):
|
170 | 172 | auth = {}
|
171 | 173 | regex = r"^\$\((.*)\)$"
|
172 | 174 |
|
173 |
| - for key in ("user", "password", "token_name", "token_value"): |
| 175 | + for key in ( |
| 176 | + "user", |
| 177 | + "password", |
| 178 | + "token_name", |
| 179 | + "token_value", |
| 180 | + "proxy_certificate_path", |
| 181 | + "proxy_certificate_key_path", |
| 182 | + ): |
174 | 183 | value = clusterconfig.get(key)
|
175 | 184 | if value is not None:
|
176 | 185 | result = re.match(regex, value)
|
177 | 186 | if result:
|
178 | 187 | value = _execute_command(result.group(1))
|
179 | 188 | auth[key] = value
|
180 | 189 |
|
| 190 | + proxy_certificate = auth.get("proxy_certificate_path") |
| 191 | + proxy_certificate_key = auth.get("proxy_certificate_key_path") |
| 192 | + if proxy_certificate != "" and proxy_certificate_key != "": |
| 193 | + auth["cert"] = (proxy_certificate, proxy_certificate_key) |
| 194 | + |
| 195 | + if "proxy_certificate_path" in auth: |
| 196 | + del auth["proxy_certificate_path"] |
| 197 | + if "proxy_certificate_key_path" in auth: |
| 198 | + del auth["proxy_certificate_key_path"] |
| 199 | + |
181 | 200 | logging.debug("Auth: %s", auth)
|
182 | 201 | # check for "incompatible" auth options
|
183 | 202 | if "password" in auth and ("token_name" in auth or "token_value" in auth):
|
|
0 commit comments