rpyc-pve-cloud 0.0.42__tar.gz → 0.1.1__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 (19) hide show
  1. {rpyc_pve_cloud-0.0.42/src/rpyc_pve_cloud.egg-info → rpyc_pve_cloud-0.1.1}/PKG-INFO +2 -2
  2. {rpyc_pve_cloud-0.0.42 → rpyc_pve_cloud-0.1.1}/requirements.txt +1 -1
  3. rpyc_pve_cloud-0.1.1/src/pve_cloud_rpc/_version.py +1 -0
  4. {rpyc_pve_cloud-0.0.42 → rpyc_pve_cloud-0.1.1}/src/pve_cloud_rpc/server.py +65 -40
  5. {rpyc_pve_cloud-0.0.42 → rpyc_pve_cloud-0.1.1/src/rpyc_pve_cloud.egg-info}/PKG-INFO +2 -2
  6. {rpyc_pve_cloud-0.0.42 → rpyc_pve_cloud-0.1.1}/src/rpyc_pve_cloud.egg-info/requires.txt +1 -1
  7. rpyc_pve_cloud-0.0.42/src/pve_cloud_rpc/_version.py +0 -1
  8. {rpyc_pve_cloud-0.0.42 → rpyc_pve_cloud-0.1.1}/LICENSE.md +0 -0
  9. {rpyc_pve_cloud-0.0.42 → rpyc_pve_cloud-0.1.1}/README.md +0 -0
  10. {rpyc_pve_cloud-0.0.42 → rpyc_pve_cloud-0.1.1}/pyproject.toml +0 -0
  11. {rpyc_pve_cloud-0.0.42 → rpyc_pve_cloud-0.1.1}/setup.cfg +0 -0
  12. {rpyc_pve_cloud-0.0.42 → rpyc_pve_cloud-0.1.1}/src/pve_cloud_rpc/protos/cloud_pb2.py +0 -0
  13. {rpyc_pve_cloud-0.0.42 → rpyc_pve_cloud-0.1.1}/src/pve_cloud_rpc/protos/cloud_pb2_grpc.py +0 -0
  14. {rpyc_pve_cloud-0.0.42 → rpyc_pve_cloud-0.1.1}/src/pve_cloud_rpc/protos/health_pb2.py +0 -0
  15. {rpyc_pve_cloud-0.0.42 → rpyc_pve_cloud-0.1.1}/src/pve_cloud_rpc/protos/health_pb2_grpc.py +0 -0
  16. {rpyc_pve_cloud-0.0.42 → rpyc_pve_cloud-0.1.1}/src/rpyc_pve_cloud.egg-info/SOURCES.txt +0 -0
  17. {rpyc_pve_cloud-0.0.42 → rpyc_pve_cloud-0.1.1}/src/rpyc_pve_cloud.egg-info/dependency_links.txt +0 -0
  18. {rpyc_pve_cloud-0.0.42 → rpyc_pve_cloud-0.1.1}/src/rpyc_pve_cloud.egg-info/entry_points.txt +0 -0
  19. {rpyc_pve_cloud-0.0.42 → rpyc_pve_cloud-0.1.1}/src/rpyc_pve_cloud.egg-info/top_level.txt +0 -0
@@ -1,10 +1,10 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: rpyc-pve-cloud
3
- Version: 0.0.42
3
+ Version: 0.1.1
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
7
- Requires-Dist: py-pve-cloud<0.14.0,>=0.13.23
7
+ Requires-Dist: py-pve-cloud<0.15.0,>=0.14.1
8
8
  Requires-Dist: grpcio==1.76.0
9
9
  Requires-Dist: asyncssh==2.21.0
10
10
  Requires-Dist: protobuf==6.33.2
@@ -1,5 +1,5 @@
1
1
  # pessimistic operator for local tdd installs (pip install -e .)
2
- py-pve-cloud>=0.13.23,<0.14.0
2
+ py-pve-cloud>=0.14.1,<0.15.0
3
3
  grpcio==1.76.0
4
4
  asyncssh==2.21.0
5
5
  protobuf==6.33.2
@@ -0,0 +1 @@
1
+ __version__ = "0.1.1"
@@ -1,14 +1,17 @@
1
- import asyncio, asyncssh
1
+ import asyncio
2
+ import socket
3
+ import sys
4
+
5
+ import asyncssh
2
6
  import grpc
7
+ import yaml
8
+ from pve_cloud.cli.pvclu import get_cluster_vars, get_ssh_master_kubeconfig
9
+ from pve_cloud.lib.inventory import *
10
+
3
11
  import pve_cloud_rpc.protos.cloud_pb2 as cloud_pb2
4
12
  import pve_cloud_rpc.protos.cloud_pb2_grpc as cloud_pb2_grpc
5
13
  import pve_cloud_rpc.protos.health_pb2 as health_pb2
6
14
  import pve_cloud_rpc.protos.health_pb2_grpc as health_pb2_grpc
7
- from pve_cloud.lib.inventory import *
8
- from pve_cloud.cli.pvclu import get_cluster_vars, get_ssh_master_kubeconfig
9
- import yaml
10
- import socket
11
- import sys
12
15
 
13
16
 
14
17
  class HealthServicer(health_pb2_grpc.HealthServicer):
@@ -18,14 +21,21 @@ class HealthServicer(health_pb2_grpc.HealthServicer):
18
21
  async def Check(self, request, context):
19
22
  target_pve = request.target_pve
20
23
  try:
21
- get_online_pve_host(target_pve, skip_py_cloud_check=False) # actually perform the check
22
- return health_pb2.HealthCheckResponse(status=health_pb2.HealthCheckResponse.SERVING)
24
+ get_online_pve_host(
25
+ target_pve, skip_py_cloud_check=False
26
+ ) # actually perform the check
27
+ return health_pb2.HealthCheckResponse(
28
+ status=health_pb2.HealthCheckResponse.SERVING
29
+ )
23
30
  except RuntimeError as e:
24
- return health_pb2.HealthCheckResponse(status=health_pb2.HealthCheckResponse.MISSMATCH, error_message=f"py-pve-cloud version check failed with: {e}") # go provider process will kill
31
+ return health_pb2.HealthCheckResponse(
32
+ status=health_pb2.HealthCheckResponse.MISSMATCH,
33
+ error_message=f"py-pve-cloud version check failed with: {e}",
34
+ ) # go provider process will kill
25
35
 
26
36
 
27
37
  class CloudServiceServicer(cloud_pb2_grpc.CloudServiceServicer):
28
-
38
+
29
39
  async def GetMasterKubeconfig(self, request, context):
30
40
  target_pve = request.target_pve
31
41
  stack_name = request.stack_name
@@ -33,8 +43,9 @@ class CloudServiceServicer(cloud_pb2_grpc.CloudServiceServicer):
33
43
  online_pve_host = get_online_pve_host(target_pve, skip_py_cloud_check=True)
34
44
  cluster_vars = get_cluster_vars(online_pve_host)
35
45
 
36
- return cloud_pb2.GetKubeconfigResponse(config=get_ssh_master_kubeconfig(cluster_vars, stack_name))
37
-
46
+ return cloud_pb2.GetKubeconfigResponse(
47
+ config=get_ssh_master_kubeconfig(cluster_vars, stack_name)
48
+ )
38
49
 
39
50
  async def GetClusterVars(self, request, context):
40
51
  target_pve = request.target_pve
@@ -44,71 +55,83 @@ class CloudServiceServicer(cloud_pb2_grpc.CloudServiceServicer):
44
55
 
45
56
  return cloud_pb2.GetClusterVarsResponse(vars=yaml.safe_dump(cluster_vars))
46
57
 
47
-
48
58
  async def GetCloudSecret(self, request, context):
49
59
  target_pve = request.target_pve
50
60
  secret_name = request.secret_name
51
61
 
52
62
  online_pve_host = get_online_pve_host(target_pve, skip_py_cloud_check=True)
53
- async with asyncssh.connect(online_pve_host, username='root', known_hosts=None) as conn:
54
- cmd = await conn.run(f"cat /etc/pve/cloud/secrets/{secret_name}", check=True)
63
+ async with asyncssh.connect(
64
+ online_pve_host, username="root", known_hosts=None
65
+ ) as conn:
66
+ cmd = await conn.run(
67
+ f"cat /etc/pve/cloud/secrets/{secret_name}", check=True
68
+ )
55
69
  catted_secret = cmd.stdout
56
-
70
+
57
71
  return cloud_pb2.GetCloudSecretResponse(secret=catted_secret)
58
-
59
72
 
60
73
  async def GetCephAccess(self, request, context):
61
74
  target_pve = request.target_pve
62
75
 
63
76
  online_pve_host = get_online_pve_host(target_pve, skip_py_cloud_check=True)
64
- async with asyncssh.connect(online_pve_host, username='root', known_hosts=None) as conn:
77
+ async with asyncssh.connect(
78
+ online_pve_host, username="root", known_hosts=None
79
+ ) as conn:
65
80
  cmd = await conn.run(f"cat /etc/ceph/ceph.conf", check=True)
66
81
  catted_conf = cmd.stdout
67
82
 
68
- cmd = await conn.run(f"cat /etc/pve/priv/ceph.client.admin.keyring", check=True)
69
- catted_keyring = cmd.stdout
70
-
71
-
72
- return cloud_pb2.GetCephAccessResponse(ceph_conf=catted_conf, admin_keyring=catted_keyring)
83
+ cmd = await conn.run(
84
+ f"cat /etc/pve/priv/ceph.client.admin.keyring", check=True
85
+ )
86
+ catted_keyring = cmd.stdout
73
87
 
88
+ return cloud_pb2.GetCephAccessResponse(
89
+ ceph_conf=catted_conf, admin_keyring=catted_keyring
90
+ )
74
91
 
75
92
  async def GetSshKey(self, request, context):
76
93
  target_pve = request.target_pve
77
94
 
78
95
  online_pve_host = get_online_pve_host(target_pve, skip_py_cloud_check=True)
79
- async with asyncssh.connect(online_pve_host, username='root', known_hosts=None) as conn:
96
+ async with asyncssh.connect(
97
+ online_pve_host, username="root", known_hosts=None
98
+ ) as conn:
80
99
  match request.key_type:
81
100
  case cloud_pb2.GetSshKeyRequest.PVE_HOST_RSA:
82
101
  cmd = await conn.run(f"cat /root/.ssh/id_rsa", check=True)
83
- catted_key = cmd.stdout
102
+ catted_key = cmd.stdout
84
103
  case cloud_pb2.GetSshKeyRequest.AUTOMATION:
85
- cmd = await conn.run(f"cat /etc/pve/cloud/automation_id_ed25519", check=True)
86
- catted_key = cmd.stdout
104
+ cmd = await conn.run(
105
+ f"cat /etc/pve/cloud/automation_id_ed25519", check=True
106
+ )
107
+ catted_key = cmd.stdout
87
108
 
88
109
  return cloud_pb2.GetSshKeyResponse(key=catted_key)
89
-
90
110
 
91
111
  async def GetProxmoxApi(self, request, context):
92
112
  target_pve = request.target_pve
93
113
 
94
114
  online_pve_host = get_online_pve_host(target_pve, skip_py_cloud_check=True)
95
- async with asyncssh.connect(online_pve_host, username='root', known_hosts=None) as conn:
115
+ async with asyncssh.connect(
116
+ online_pve_host, username="root", known_hosts=None
117
+ ) as conn:
96
118
  args_string = None
97
119
  if request.get_args:
98
120
  args_string = " ".join(f"{k} {v}" for k, v in request.get_args.items())
99
-
100
- cmd = await conn.run(f"pvesh get {request.api_path} {args_string} --output-format json", check=True)
101
- resp_json = cmd.stdout
121
+
122
+ cmd = await conn.run(
123
+ f"pvesh get {request.api_path} {args_string} --output-format json",
124
+ check=True,
125
+ )
126
+ resp_json = cmd.stdout
102
127
 
103
128
  return cloud_pb2.GetProxmoxApiResponse(json_resp=resp_json)
104
-
105
129
 
106
130
  async def GetProxmoxHost(self, request, context):
107
131
  target_pve = request.target_pve
108
132
  online_pve_host = get_online_pve_host(target_pve, skip_py_cloud_check=True)
109
133
 
110
134
  return cloud_pb2.GetProxmoxHostResponse(pve_host=online_pve_host)
111
-
112
135
 
113
136
  async def GetPveInventory(self, request, context):
114
137
  target_pve = request.target_pve
@@ -116,7 +139,9 @@ class CloudServiceServicer(cloud_pb2_grpc.CloudServiceServicer):
116
139
  cloud_domain = get_cloud_domain(target_pve)
117
140
  pve_inventory = get_pve_inventory(cloud_domain, skip_py_cloud_check=True)
118
141
 
119
- return cloud_pb2.GetPveInventoryResponse(inventory=yaml.safe_dump(pve_inventory), cloud_domain=cloud_domain)
142
+ return cloud_pb2.GetPveInventoryResponse(
143
+ inventory=yaml.safe_dump(pve_inventory), cloud_domain=cloud_domain
144
+ )
120
145
 
121
146
 
122
147
  def is_port_bound(port, host="0.0.0.0"):
@@ -126,8 +151,8 @@ def is_port_bound(port, host="0.0.0.0"):
126
151
  s.bind((host, port))
127
152
  return False # not bound
128
153
  except OSError:
129
- return True # bound
130
-
154
+ return True # bound
155
+
131
156
 
132
157
  async def serve():
133
158
  server = grpc.aio.server()
@@ -135,10 +160,10 @@ async def serve():
135
160
 
136
161
  health_servicer = HealthServicer()
137
162
  health_pb2_grpc.add_HealthServicer_to_server(health_servicer, server)
138
-
163
+
139
164
  socket_file = f"/tmp/pc-rpc-{sys.argv[1]}.sock"
140
165
 
141
- server.add_insecure_port(f"unix://{socket_file}")
166
+ server.add_insecure_port(f"unix://{socket_file}")
142
167
  await server.start()
143
168
 
144
169
  print(f"gRPC AsyncIO server running on {socket_file}")
@@ -155,4 +180,4 @@ async def serve():
155
180
 
156
181
 
157
182
  def main():
158
- asyncio.run(serve())
183
+ asyncio.run(serve())
@@ -1,10 +1,10 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: rpyc-pve-cloud
3
- Version: 0.0.42
3
+ Version: 0.1.1
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
7
- Requires-Dist: py-pve-cloud<0.14.0,>=0.13.23
7
+ Requires-Dist: py-pve-cloud<0.15.0,>=0.14.1
8
8
  Requires-Dist: grpcio==1.76.0
9
9
  Requires-Dist: asyncssh==2.21.0
10
10
  Requires-Dist: protobuf==6.33.2
@@ -1,4 +1,4 @@
1
- py-pve-cloud<0.14.0,>=0.13.23
1
+ py-pve-cloud<0.15.0,>=0.14.1
2
2
  grpcio==1.76.0
3
3
  asyncssh==2.21.0
4
4
  protobuf==6.33.2
@@ -1 +0,0 @@
1
- __version__ = "0.0.42"