py-pve-cloud 3.4.1__tar.gz → 3.4.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. {py_pve_cloud-3.4.1/src/py_pve_cloud.egg-info → py_pve_cloud-3.4.3}/PKG-INFO +1 -1
  2. py_pve_cloud-3.4.3/src/pve_cloud/_version.py +1 -0
  3. {py_pve_cloud-3.4.1 → py_pve_cloud-3.4.3}/src/pve_cloud/cli/pxrpc.py +54 -0
  4. {py_pve_cloud-3.4.1 → py_pve_cloud-3.4.3}/src/pve_cloud/lib/backup_rpc.py +2 -1
  5. {py_pve_cloud-3.4.1 → py_pve_cloud-3.4.3/src/py_pve_cloud.egg-info}/PKG-INFO +1 -1
  6. py_pve_cloud-3.4.1/src/pve_cloud/_version.py +0 -1
  7. {py_pve_cloud-3.4.1 → py_pve_cloud-3.4.3}/LICENSE.md +0 -0
  8. {py_pve_cloud-3.4.1 → py_pve_cloud-3.4.3}/README.md +0 -0
  9. {py_pve_cloud-3.4.1 → py_pve_cloud-3.4.3}/pyproject.toml +0 -0
  10. {py_pve_cloud-3.4.1 → py_pve_cloud-3.4.3}/setup.cfg +0 -0
  11. {py_pve_cloud-3.4.1 → py_pve_cloud-3.4.3}/src/pve_cloud/cli/pvcli.py +0 -0
  12. {py_pve_cloud-3.4.1 → py_pve_cloud-3.4.3}/src/pve_cloud/cli/pvclu.py +0 -0
  13. {py_pve_cloud-3.4.1 → py_pve_cloud-3.4.3}/src/pve_cloud/lib/inventory.py +0 -0
  14. {py_pve_cloud-3.4.1 → py_pve_cloud-3.4.3}/src/pve_cloud/lib/ssh.py +0 -0
  15. {py_pve_cloud-3.4.1 → py_pve_cloud-3.4.3}/src/pve_cloud/orm/alchemy.py +0 -0
  16. {py_pve_cloud-3.4.1 → py_pve_cloud-3.4.3}/src/pve_cloud/orm/alembic.ini +0 -0
  17. {py_pve_cloud-3.4.1 → py_pve_cloud-3.4.3}/src/pve_cloud/orm/migrations/env.py +0 -0
  18. {py_pve_cloud-3.4.1 → py_pve_cloud-3.4.3}/src/pve_cloud/orm/migrations/versions/04398db10434_external_cp_extra_sans.py +0 -0
  19. {py_pve_cloud-3.4.1 → py_pve_cloud-3.4.3}/src/pve_cloud/orm/migrations/versions/0ad803c51325_machine_type_refactor.py +0 -0
  20. {py_pve_cloud-3.4.1 → py_pve_cloud-3.4.3}/src/pve_cloud/orm/migrations/versions/24a548bfce3e_len_rules_enforcements.py +0 -0
  21. {py_pve_cloud-3.4.1 → py_pve_cloud-3.4.3}/src/pve_cloud/orm/migrations/versions/27724e407e2b_proxy_fqdn.py +0 -0
  22. {py_pve_cloud-3.4.1 → py_pve_cloud-3.4.3}/src/pve_cloud/orm/migrations/versions/3c95509a5de9_fix.py +0 -0
  23. {py_pve_cloud-3.4.1 → py_pve_cloud-3.4.3}/src/pve_cloud/orm/migrations/versions/7496c3f3b2e8_fix_secrets_constraint.py +0 -0
  24. {py_pve_cloud-3.4.1 → py_pve_cloud-3.4.3}/src/pve_cloud/orm/migrations/versions/7868bcd05006_migrate_old.py +0 -0
  25. {py_pve_cloud-3.4.1 → py_pve_cloud-3.4.3}/src/pve_cloud/orm/migrations/versions/7dea8c4ee39f_init.py +0 -0
  26. {py_pve_cloud-3.4.1 → py_pve_cloud-3.4.3}/src/pve_cloud/orm/migrations/versions/944a8fd5d5bc_ext_ctrl_plns.py +0 -0
  27. {py_pve_cloud-3.4.1 → py_pve_cloud-3.4.3}/src/pve_cloud/orm/migrations/versions/9de11ef8ba39_vm_vars_and_cloud_secrets.py +0 -0
  28. {py_pve_cloud-3.4.1 → py_pve_cloud-3.4.3}/src/pve_cloud/orm/migrations/versions/d9b711555be8_ext_control_plane.py +0 -0
  29. {py_pve_cloud-3.4.1 → py_pve_cloud-3.4.3}/src/pve_cloud/orm/migrations/versions/e60b9cc63413_ingress_generic.py +0 -0
  30. {py_pve_cloud-3.4.1 → py_pve_cloud-3.4.3}/src/pve_cloud/orm/migrations/versions/e6ae1e138c1f_change_scope_cloud.py +0 -0
  31. {py_pve_cloud-3.4.1 → py_pve_cloud-3.4.3}/src/pve_cloud/orm/migrations/versions/ee4924ac4f60_secrets_plural_type.py +0 -0
  32. {py_pve_cloud-3.4.1 → py_pve_cloud-3.4.3}/src/pve_cloud/orm/migrations/versions/fdcb5aa33b76_slop_firewall_seperation.py +0 -0
  33. {py_pve_cloud-3.4.1 → py_pve_cloud-3.4.3}/src/py_pve_cloud.egg-info/SOURCES.txt +0 -0
  34. {py_pve_cloud-3.4.1 → py_pve_cloud-3.4.3}/src/py_pve_cloud.egg-info/dependency_links.txt +0 -0
  35. {py_pve_cloud-3.4.1 → py_pve_cloud-3.4.3}/src/py_pve_cloud.egg-info/entry_points.txt +0 -0
  36. {py_pve_cloud-3.4.1 → py_pve_cloud-3.4.3}/src/py_pve_cloud.egg-info/requires.txt +0 -0
  37. {py_pve_cloud-3.4.1 → py_pve_cloud-3.4.3}/src/py_pve_cloud.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: py-pve-cloud
3
- Version: 3.4.1
3
+ Version: 3.4.3
4
4
  Author-email: Tobias Huebner <tobias.huebner@vmzberlin.com>
5
5
  License-Expression: GPL-3.0-or-later
6
6
  License-File: LICENSE.md
@@ -0,0 +1 @@
1
+ __version__ = "3.4.3"
@@ -12,6 +12,7 @@ from concurrent.futures import ProcessPoolExecutor
12
12
  from contextlib import asynccontextmanager, contextmanager
13
13
  from enum import StrEnum
14
14
 
15
+ import asyncssh
15
16
  import dns.rcode
16
17
  import dns.resolver
17
18
  import dns.tsigkeyring
@@ -606,3 +607,56 @@ async def launch_pxrpc_async(
606
607
  list(
607
608
  pool.map(exit_worker, range(NUM_WORKERS))
608
609
  ) # list/() is critical to yield the generator
610
+
611
+
612
+ # make methods async callable for generic invoke
613
+ # this is so we can call pxrpc methods generically for a locally
614
+ # initialized instance
615
+ class PxrpcAsyncWrapper:
616
+
617
+ def __init__(self, pxservice):
618
+ self.pxservice = pxservice
619
+
620
+ def __getattr__(self, method_name):
621
+ async def async_wrapper(*args, **kwargs):
622
+ return getattr(self.pxservice, method_name)(*args, **kwargs)
623
+
624
+ return async_wrapper
625
+
626
+
627
+ async def get_cstr_cvars(online_pve_host):
628
+ async with asyncssh.connect(
629
+ online_pve_host, username="root", known_hosts=None
630
+ ) as conn:
631
+ cmd = await conn.run("cat /etc/pve/cloud/secrets/patroni.pass", check=True)
632
+ patroni_pass = cmd.stdout.rstrip()
633
+
634
+ # fetch cluster vars to get internal proxy ip
635
+ cmd = await conn.run("cat /etc/pve/cloud/cluster_vars.yaml", check=True)
636
+ cluster_vars = yaml.safe_load(cmd.stdout)
637
+ validate_cluster_vars(cluster_vars)
638
+
639
+ cmd = await conn.run("cat /etc/pve/cloud/secrets/internal.key", check=True)
640
+ internal_key = re.search(r'secret\s+"([^"]+)";', cmd.stdout).group(1)
641
+
642
+ # build the connection string
643
+ patroni_cstr = f"postgresql+psycopg2://postgres:{patroni_pass}@{cluster_vars['pve_haproxy_floating_ip_internal']}:5000/pve_cloud?sslmode=disable"
644
+
645
+ return patroni_cstr, cluster_vars, internal_key
646
+
647
+
648
+ # pve cloud context aware async get function for the pxrpc functions.
649
+ # this will either return a local wrapper or a remotely launched instance
650
+ # of our pxrpc service. This serves as a generic function launch endpoint
651
+ # to be able to interact with a proxmox cloud, regardless of configuration
652
+ # (local access / remote via jump host). This currently only exists as an async
653
+ # implementation.
654
+ @asynccontextmanager
655
+ async def get_simple_pxrpc(online_pve_host, jump_host):
656
+ if not jump_host:
657
+ cstr, cluster_vars, internal_key = await get_cstr_cvars(online_pve_host)
658
+ yield PxrpcAsyncWrapper(PxrpcService(cluster_vars, cstr, internal_key))
659
+ return
660
+
661
+ async with launch_pxrpc_async(jump_host, online_pve_host) as pxrpc:
662
+ yield pxrpc
@@ -7,4 +7,5 @@ class Command(Enum):
7
7
  NAMESPACE_SECRETS = 3
8
8
  LIST_BACKUPS = 4
9
9
  LIST_BACKUP_DETAILS = 5
10
- RESTORE_PROCEDURE = 6
10
+ INIT_RESTORE_PROCEDURE = 6
11
+ REQUEST_ARCHIVE = 7
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: py-pve-cloud
3
- Version: 3.4.1
3
+ Version: 3.4.3
4
4
  Author-email: Tobias Huebner <tobias.huebner@vmzberlin.com>
5
5
  License-Expression: GPL-3.0-or-later
6
6
  License-File: LICENSE.md
@@ -1 +0,0 @@
1
- __version__ = "3.4.1"
File without changes
File without changes
File without changes