Skip to content

Commit 4a31dde

Browse files
committed
fix detecting hostable resource types
1 parent 1d965d6 commit 4a31dde

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

.github/workflows/main.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,8 @@ jobs:
144144
- name: Build & Push Multi-Platform Container
145145
uses: docker/build-push-action@v2
146146
with:
147-
context: ./docker # build context is workspace so we can copy artifacts from ./dist/
147+
context: "{{defaultContext}}" # build context is workspace so we can copy artifacts from ./dist/
148+
file: docker/Dockerfile
148149
builder: ${{ steps.buildx.outputs.name }}
149150
platforms: linux/amd64,linux/arm64
150151
push: true

netfoundry/utility.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -254,11 +254,14 @@ def get_generic_resource(url: str, headers: dict, proxies: dict = dict(), verify
254254

255255
resource_type = get_resource_type_by_url(url)
256256
logging.debug(f"detected resource type {resource_type.name}")
257-
# always embed the host record if getting the base resource (not leaf operations like /session or /rotatekey)
258-
if resource_type.name in HOSTABLE_NET_RESOURCES.keys() and url.endswith(resource_type.name):
257+
# always embed the host record if getting the base resource by ID i.e. /{resource_type}/{uuid}, not leaf operations like /session or /rotatekey
258+
pattern = re.compile(f".*/{resource_type.name}/"+r'[a-f0-9]{8}-?[a-f0-9]{4}-?4[a-f0-9]{3}-?[89ab][a-f0-9]{3}-?[a-f0-9]{12}\Z', re.I)
259+
if resource_type.name in HOSTABLE_NET_RESOURCES.keys() and re.match(pattern, url):
259260
params['embed'] = "host"
260261
elif resource_type.name in ["process-executions"]:
261262
params['beta'] = str()
263+
else:
264+
logging.debug(f"no handlers specified for url '{url}'")
262265
response = http.get(
263266
url,
264267
headers=headers,

0 commit comments

Comments
 (0)