xenfra-sdk 0.1.8__py3-none-any.whl → 0.1.9__py3-none-any.whl

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.
xenfra_sdk/engine.py CHANGED
@@ -324,7 +324,7 @@ class InfraEngine:
324
324
  raise DeploymentError("Could not establish SSH connection.", stage="Polling")
325
325
 
326
326
  with conn:
327
- for i in range(30): # 5-minute timeout for cloud-init
327
+ for i in range(120): # 20-minute timeout for cloud-init (installing Docker, Caddy, etc.)
328
328
  if conn.run("test -f /root/setup_complete", warn=True).ok:
329
329
  logger(" - Cloud-init setup complete.")
330
330
  break
@@ -182,7 +182,13 @@ class DeploymentsManager(BaseManager):
182
182
  )
183
183
 
184
184
  # Parse SSE events
185
+ current_event = None # Initialize before loop
185
186
  for line in response.iter_lines():
187
+ # No need to explicitly decode if iter_lines is used on a decoded response,
188
+ # but if it returns bytes, we decode it.
189
+ if isinstance(line, bytes):
190
+ line = line.decode('utf-8', errors='ignore')
191
+
186
192
  line = line.strip()
187
193
  if not line:
188
194
  continue
@@ -193,13 +199,12 @@ class DeploymentsManager(BaseManager):
193
199
  elif line.startswith("data:"):
194
200
  data = line[5:].strip()
195
201
 
196
- # Get event type
197
- event_type = current_event if 'current_event' in locals() else "message"
202
+ # Get event type (default to "message" if no event line was sent)
203
+ event_type = current_event if current_event is not None else "message"
198
204
 
199
205
  # Skip keep-alive events (used to prevent proxy timeouts)
200
206
  if event_type == "keep-alive":
201
- if 'current_event' in locals():
202
- del current_event
207
+ current_event = None
203
208
  continue
204
209
 
205
210
  try:
@@ -210,9 +215,8 @@ class DeploymentsManager(BaseManager):
210
215
  # If not JSON, yield as plain text
211
216
  yield {"event": event_type, "data": data}
212
217
 
213
- # Reset current_event
214
- if 'current_event' in locals():
215
- del current_event
218
+ # Reset current_event after yielding
219
+ current_event = None
216
220
 
217
221
  except httpx.HTTPError as e:
218
222
  raise XenfraError(f"HTTP error during streaming deployment: {e}")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: xenfra-sdk
3
- Version: 0.1.8
3
+ Version: 0.1.9
4
4
  Summary: Xenfra SDK: Core engine and utilities for the Xenfra platform.
5
5
  Author: xenfra-cloud
6
6
  Author-email: xenfra-cloud <xenfracloud@gmail.com>
@@ -9,7 +9,7 @@ xenfra_sdk/db/models.py,sha256=oNT9UhYzr_SgzDJdPu5fF6IiiztWjm2tHZzpIAYVJ4Y,706
9
9
  xenfra_sdk/db/session.py,sha256=ul6tFBBDKU8UErJsZ-g7b8cryLr9-yA6jGY3d8fD15Q,853
10
10
  xenfra_sdk/dependencies.py,sha256=k7tiy_5dayr_iQx_i2klGeNjGWhxfivGVC38SpvQvzE,1250
11
11
  xenfra_sdk/dockerizer.py,sha256=hOXy6dKl3QGFamRN2WZ0rAh6Vguykhkdyal3grhGAOI,3146
12
- xenfra_sdk/engine.py,sha256=-EyDw5BrsyjgaH8NgYYi-UFWMRvPMm2UAou_TxRvRvY,17055
12
+ xenfra_sdk/engine.py,sha256=K9HVqG37HcTbLFE4DeknNv00ADyKL68olYA7IudRJj8,17090
13
13
  xenfra_sdk/exceptions.py,sha256=FaKctVJNMFIw09G8Lm2yd_DHhSngGcyh2j_BTgXMM60,496
14
14
  xenfra_sdk/mcp_client.py,sha256=GPsVJtWT87G7k_GxePATLfCqFkYFFNIbpW5AsZi4Bhk,5931
15
15
  xenfra_sdk/models.py,sha256=VDd41JxqyzrsNZugXe5IP9OKkNuGVRFSnoTrHBOSKjk,7185
@@ -18,7 +18,7 @@ xenfra_sdk/privacy.py,sha256=ksGf5L9PVtRP-xZS3T-Gj7MKfexTqIMgbFLoYkIESOE,5662
18
18
  xenfra_sdk/recipes.py,sha256=g_UKQIcdSokYh7zn186mzDTr08P034-KZ1iiDNELyP4,877
19
19
  xenfra_sdk/resources/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
20
20
  xenfra_sdk/resources/base.py,sha256=C6BuZfhR-oU5ecHSfkGG6ZLU6MHGXUyCWoy1F-yTIf8,84
21
- xenfra_sdk/resources/deployments.py,sha256=OEtvBevRj6alN1uyEIyZSxBstIhUhngbVpCZ3ryd_o0,8868
21
+ xenfra_sdk/resources/deployments.py,sha256=2GRF-BWwC8y-oM7Pje5YoHrlkKRduSWsC_3-erlw9V8,9174
22
22
  xenfra_sdk/resources/intelligence.py,sha256=Y11K6_iXfm2QKTbH1vUmt45MifLoVtZtlHEkqbzmTzs,3418
23
23
  xenfra_sdk/resources/projects.py,sha256=EsCVXmqkhWl_Guz_8WDQDi3kAm1Wyg1rjXcyAigPD6E,3712
24
24
  xenfra_sdk/security.py,sha256=Px887RRb1BUDXaPUrxmQITJ1mHyOyupCJqEDZ78F7Tk,1240
@@ -26,6 +26,6 @@ xenfra_sdk/templates/Dockerfile.j2,sha256=GXc0JiaF-HsxTQS15Gs2fcvsIhA1EHnwapdFVi
26
26
  xenfra_sdk/templates/cloud-init.sh.j2,sha256=NKIwtL9OgnlK2NnYRZI3gWC9aYl6wNPsS6r14g8eHQQ,2290
27
27
  xenfra_sdk/templates/docker-compose.yml.j2,sha256=qMHiatuZlxiYZ1pE_g2ag1M798MvQbeq0cVTVK07jkM,893
28
28
  xenfra_sdk/utils.py,sha256=d8eCjjV32QwqoJa759CEcETnnsjG5qVKDLQ84yYtlus,3898
29
- xenfra_sdk-0.1.8.dist-info/WHEEL,sha256=KSLUh82mDPEPk0Bx0ScXlWL64bc8KmzIPNcpQZFV-6E,79
30
- xenfra_sdk-0.1.8.dist-info/METADATA,sha256=Mt6YJ3ZJnGi2LenFkzTqqKVf0exC4AiSg4h5UDm7Rk4,3980
31
- xenfra_sdk-0.1.8.dist-info/RECORD,,
29
+ xenfra_sdk-0.1.9.dist-info/WHEEL,sha256=KSLUh82mDPEPk0Bx0ScXlWL64bc8KmzIPNcpQZFV-6E,79
30
+ xenfra_sdk-0.1.9.dist-info/METADATA,sha256=PAeq0SV1LWdfLDH9Ey3PeVnrXT-7rs5uINdjAcqELbA,3980
31
+ xenfra_sdk-0.1.9.dist-info/RECORD,,