StackStorm-Exchange / StackStorm-Exchange/stackstorm-netbox

netbox.get.ipam.prefixes.available_ips always gets 404s because of ID/url behavior in base action

Open
#55 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
14
Forks
19
Avg merge
1d 2h
Merged PRs (30d)
1

Description

Example issue:

st2 run netbox.get.ipam.prefixes.available_ips id=14162
id: 68333eeca62ad9d9e535f9c0
action.ref: netbox.get.ipam.prefixes.available_ips
context.user: dgeorge
parameters:
  id: 14162
status: succeeded
start_timestamp: Sun, 25 May 2025 16:01:48 UTC
end_timestamp: Sun, 25 May 2025 16:01:49 UTC
result:
  exit_code: 0
  result:
    raw: {}
    status: 404
  stderr: 'st2.actions.python.NetboxHTTPAction: DEBUG    endpoint_uri transformed to /ipam/prefixes/14162/available-ips/14162/ because id was passed
    st2.actions.python.NetboxHTTPAction: DEBUG    Calling base get to https://netbox-api.internal.digitalocean.com/api/ipam/prefixes/14162/available-ips/14162/ with kwargs: {''save_in_key_store_ttl'': 60, ''save_in_key_store_key_name'': None, ''save_in_key_store'': False}
    '
  stdout: '<Response [404]>
    '

(I've added stuff locally to print to stdout for debugging). This prefix+ID 100% exists, but note the URL is built here with the ID further APPENDED to the api path :( which, in this case, we aren't supposed to do???

I believe we may need to identify and add logic to handle the way the endpoint_uri is formed so we do not wind up breaking this functionality.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue with st2 run netbox.get.ipam.prefixes.available_ips id=14162 and inspect the base action's endpoint_uri formation and request logging. Trace why the ID is appended twice for this action, then verify that the resulting URL no longer includes the duplicate ID and that the existing prefix returns successfully instead of 404.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api, backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.