Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix typo & Fix app_id requirement and default #124

Open
wants to merge 7 commits into
base: develop
Choose a base branch
from

Conversation

StevenH1901
Copy link

Per the section_module docs (and all other modules), app_id is not a required parameter and should default to 'ansible'.

When running version 1.7.0, I receive an error saying that 'app_id' is a required parameter. This error may be present in previous versions, but I have not verified.

Fixes #123

@cmeissner cmeissner self-requested a review January 11, 2025 10:16
Copy link
Member

@cmeissner cmeissner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

HI @StevenH1901,

Thank you for opening this PR, Some things need to be in place before we can merge it.

  1. combine all fix typo commits to a single commit
  2. add a test for checking the behavior of the app_id parameter, ideally for all common parameters
  3. extend the section test to check the list_order parameter.

@StevenH1901
Copy link
Author

@cmeissner - Not 100% sure if this is what you were expecting, but if not let me know and I can get it fixed.

I'm also not sure how to combine two commits that have different commits between them.

@cmeissner
Copy link
Member

@cmeissner - Not 100% sure if this is what you were expecting, but if not let me know and I can get it fixed.

I'm also not sure how to combine two commits that have different commits between them.

Thank you for adding/extending the requested tests. I did not find the time to run it on my system. May I ask you to enable the CI workflow in your account, to see the result of it. After that, I can allow PR of you to trigger workflow runs in the project.

I will try to review your PR completely on the weekend.

permissions=dict(type='json', required=False, default=None),
strict_mode=dict(type='bool', required=False),
subnet_ordering=dict(type='bool', required=False, phpipam_name='subnetOrdering'),
list_order=dict(type='bool', required=False, phpipam_name='order'),
list_order=dict(type='int', required=False, phpipam_name='order'),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From your test, I noticed that list_order accepts values from 1 to 3. Are there corresponding strings used in the UI?
Maybe you can point to the correct point in the UI. If there are strings in the UI, we need to provide it here to work with these words instead of int. And in background, we need to translate these strings to int's for talking to the API.

Copy link
Member

@cmeissner cmeissner Jan 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

From the section edit screen, I can find these Options to select. From this finding, two things came to my mind:

  1. Obviously, we need a combination of a order_by and how to order (asc, desc), to make it human-readable.
  2. Do we need to set up an obvious UI-only used property from Ansible?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I checked the result from the API, if I queried a section

$ curl -sk -XGET -H "phpipam-token: ${PHPIPAM_TOKEN}" ${PHPIPAM_API_URL}/sections/2 | jq
{
  "code": 200,
  "success": true,
  "data": {
    "id": "2",
    "name": "IPv6",
    "description": "Section for IPv6 addresses",
    "masterSection": "0",
    "permissions": "{\"2\":\"2\",\"3\":\"1\"}",
    "strictMode": "1",
    "subnetOrdering": "subnet,asc",
    "order": null,
    "editDate": "2025-01-22 14:55:26",
    "showVLAN": "0",
    "showVRF": "0",
    "showSupernetOnly": "0",
    "DNS": null
  },
  "time": 0.003
}

subnetOrdering is corresponding with the one I found in the UI. For order which corresponds with list_order, I was unable to find a UI element. Can you please guide me to the corresponding UI element to check different values available for that property?

On the other hand, I recognized that we do not handle subnetOrdering with this module and here we can open a follow-up issue to track and implement it later.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to put list_order in base_section_data to have it tested in test-section.

If you do so, the test shows no idempotency anymore. Please investigate further.

Copy link
Member

@cmeissner cmeissner Jan 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would suggest to split the list_order issue into another new issue. Cherry-pick the commits you made so far into another branch and remove them from this branch.

So we only handle here the app_id issue and the two typos.

I expect that the list_order issue would become greater, because of missing idempotency and the confusion between oder and list_order.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

app_id is a required parameter despite documentation saying otherwise
2 participants