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

Add support for environment varible fallback to all modules #480

Merged
merged 2 commits into from
Jan 8, 2025

Conversation

netgirard
Copy link
Contributor

Resolves #479

Add env_fallback to the NAUTOBOT_ARG_SPEC for URL and token
@joewesch joewesch marked this pull request as ready for review January 8, 2025 15:16
Copy link
Contributor

@joewesch joewesch left a comment

Choose a reason for hiding this comment

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

Tested locally, works great! Thanks.

export NAUTOBOT_URL="https://demo.nautobot.com"export NAUTOBOT_TOKEN="aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
❯ ansible localhost -m networktocode.nautobot.manufacturer -a "name=Cisco state=present"
[WARNING]: No inventory was parsed, only implicit localhost is available
localhost | SUCCESS => {
    "changed": false,
    "manufacturer": {
        "cloud_account_count": 0,
        "created": "2023-09-21T00:00:00Z",
        "custom_fields": {},
        "description": "",
        "device_type_count": 6,
        "display": "Cisco",
        "id": "b329ec0d-5ee7-47d8-b4a7-3951c28e2979",
        "inventory_item_count": 38,
        "last_updated": "2025-01-08T10:26:16.607619Z",
        "name": "Cisco",
        "natural_slug": "cisco_b329",
        "notes_url": "https://demo.nautobot.com/api/dcim/manufacturers/b329ec0d-5ee7-47d8-b4a7-3951c28e2979/notes/",
        "object_type": "dcim.manufacturer",
        "platform_count": 5,
        "url": "https://demo.nautobot.com/api/dcim/manufacturers/b329ec0d-5ee7-47d8-b4a7-3951c28e2979/"
    },
    "msg": "manufacturer Cisco already exists"
}

@joewesch joewesch merged commit fe69ccb into nautobot:develop Jan 8, 2025
7 checks passed
@netgirard netgirard deleted the support_env_fallback branch January 10, 2025 17:06
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.

Environment variable fallback for token and URL does not work
2 participants