Skip to content

Commit 038c6a7

Browse files
committed
Add slugify to dependencies and add slugify to cloud image deployment
1 parent b29f6d7 commit 038c6a7

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

ctfcli/core/deployment/cloud.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import time
44
from typing import Dict, Optional
55
from urllib.parse import urlparse
6+
from slugify import slugify
67

78
import click
89

@@ -118,7 +119,8 @@ def _get_or_create_service(self, image_location: str):
118119
return self.api.get(f"/api/v1/services/{service_data['id']}").json()["data"]
119120

120121
# Create the service if it doesn't exist
121-
return self.api.post("/api/v1/services", json={"name": self.image_name, "image": image_location}).json()["data"]
122+
image_name_slug = slugify(self.image_name)
123+
return self.api.post("/api/v1/services", json={"name": image_name_slug, "image": image_location}).json()["data"]
122124

123125
def _await_service_deployment(self, service_data, interval=10, timeout=180) -> Optional[Dict]:
124126
service_id = service_data["id"]

poetry.lock

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ appdirs = "^1.4.4"
2424
colorama = "^0.4.6"
2525
fire = "^0.7.0"
2626
typing-extensions = "^4.7.1"
27+
python-slugify = "^8.0.4"
2728

2829
[tool.poetry.group.dev.dependencies]
2930
black = "^23.7.0"

0 commit comments

Comments
 (0)