Skip to content

Commit 0d946b4

Browse files
authored
Add slugify to dependencies and add slugify to cloud image deployment (#181)
* Add slugify to dependencies and add slugify to cloud image deployment * Fix lints
1 parent b29f6d7 commit 0d946b4

File tree

4 files changed

+6
-3
lines changed

4 files changed

+6
-3
lines changed

ctfcli/core/deployment/cloud.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
from urllib.parse import urlparse
66

77
import click
8+
from slugify import slugify
89

910
from ctfcli.core.api import API
1011
from ctfcli.core.config import Config
@@ -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.

preprocess.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33

44
def replace_symlinks():
5-
os.system("""find . -type l -exec sh -c 'target=$(readlink -f "$0"); rm "$0" && cp "$target" "$0"' {} \;""")
5+
os.system("""find . -type l -exec sh -c 'target=$(readlink -f "$0"); rm "$0" && cp "$target" "$0"' {} \\;""")
66

77

88
if __name__ == "__main__":

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)