Skip to content

fix: Prefix names starting with numbers with an underscore#322

Open
johannwagner wants to merge 1 commit intonautobot:developfrom
wdzgmbh:johannwagner/fix-319
Open

fix: Prefix names starting with numbers with an underscore#322
johannwagner wants to merge 1 commit intonautobot:developfrom
wdzgmbh:johannwagner/fix-319

Conversation

@johannwagner
Copy link
Contributor

@johannwagner johannwagner commented Aug 22, 2025

Closes: #319

What's Changed

It prefixes names starting with a number with an underscore.

To Do

  • Explanation of Change(s)
  • Added change log fragment(s) (for more information see the documentation)
  • Attached Screenshots, Payload Example
  • Unit, Integration Tests
  • Documentation Updates (when adding/changing features)
  • Outline Remaining Work, Constraints from Design

@gsnider2195
Copy link
Contributor

It looks like the _slugify function is used on multiple capirca data models. Is this change appropriate for all of them?

dashes to single dashes. Remove characters that aren't alphanumerics,
underscores, or hyphens. Convert to lowercase. Also strip leading and
trailing whitespace, dashes, and underscores.
Also adds a trailing underscore to names starting with an number to circumvent a bug in the Capirca/Aerleon parser.
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this a documented bug? Can we add a link to it here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

They require a word at those places and a word cannot start with a number by definiton:
https://aerleon.readthedocs.io/en/latest/reference/yaml_reference/#value-types

Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
Also adds a trailing underscore to names starting with an number to circumvent a bug in the Capirca/Aerleon parser.
Also adds a leading underscore to names starting with an number to circumvent a bug in the Capirca/Aerleon parser.

@gsnider2195 gsnider2195 reopened this Sep 24, 2025
@github-actions
Copy link

Coverage report

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  nautobot_firewall_models/utils
  capirca.py 44
Project Total  

This report was generated by python-coverage-comment-action

@johannwagner
Copy link
Contributor Author

The slugify function is used in places, where Aerleon requires a word, which is not allowed to start with a number by definiton.
See https://aerleon.readthedocs.io/en/latest/reference/yaml_reference/#value-types.

I think, it is appropriate and also probably fixes some other unnoted bugs.

@@ -0,0 +1 @@
Fixed names starting with numbers by prefixing with an underscore. No newline at end of file
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
Fixed names starting with numbers by prefixing with an underscore.
Fixed an incompatibility when slugifying capirca names that start with a number by prefixing the name with an underscore.

@gsnider2195
Copy link
Contributor

Sorry it took me so long to get back to you. Just a couple of suggestions on the wording and we'll get this merged. Thank you!

nautobot-bot pushed a commit that referenced this pull request Dec 30, 2025
…r Tool

## [3.0.0 (2025-12-30)](https://github.com/nautobot/cookiecutter-nautobot-app/releases/tag/3.0.0)

### Added

- [#291](nautobot/cookiecutter-nautobot-app#291) - Added support for Python `3.13`.

### Changed

- [#291](nautobot/cookiecutter-nautobot-app#291) - Updated minimum Nautobot version to `3.0.0`.
- [#291](nautobot/cookiecutter-nautobot-app#291) - Updated maximum Nautobot version to `<4.0.0`.
- [#309](nautobot/cookiecutter-nautobot-app#309) - Change the tag-nautobot-app workflow to support multiple nautobot-app versions.
- [#320](nautobot/cookiecutter-nautobot-app#320) - Upstream testing now runs against selected branches.

### Documentation

- [#319](nautobot/cookiecutter-nautobot-app#319) - Fixed nav typo and added missing 2.7.2 release notes.

### Housekeeping

- [#322](nautobot/cookiecutter-nautobot-app#322) - Updated CI workflow to always regenerate poetry lockfile.

**Full Changelog**: nautobot/cookiecutter-nautobot-app@nautobot-app-v2.7.2...nautobot-app-v3.0.0
nautobot-bot pushed a commit that referenced this pull request Dec 30, 2025
…r Tool

- [#291](nautobot/cookiecutter-nautobot-app#291) - Added support for Python `3.13`.

- [#291](nautobot/cookiecutter-nautobot-app#291) - Updated minimum Nautobot version to `3.0.0`.
- [#291](nautobot/cookiecutter-nautobot-app#291) - Updated maximum Nautobot version to `<4.0.0`.
- [#309](nautobot/cookiecutter-nautobot-app#309) - Change the tag-nautobot-app workflow to support multiple nautobot-app versions.
- [#320](nautobot/cookiecutter-nautobot-app#320) - Upstream testing now runs against selected branches.

- [#319](nautobot/cookiecutter-nautobot-app#319) - Fixed nav typo and added missing 2.7.2 release notes.

- [#322](nautobot/cookiecutter-nautobot-app#322) - Updated CI workflow to always regenerate poetry lockfile.

**Full Changelog**: nautobot/cookiecutter-nautobot-app@nautobot-app-v2.7.2...nautobot-app-v3.0.0
gsnider2195 pushed a commit that referenced this pull request Jan 5, 2026
…r Tool (#368)

* Cookie updated targeting develop by NetworkToCode Cookie Drift Manager Tool

- [#291](nautobot/cookiecutter-nautobot-app#291) - Added support for Python `3.13`.

- [#291](nautobot/cookiecutter-nautobot-app#291) - Updated minimum Nautobot version to `3.0.0`.
- [#291](nautobot/cookiecutter-nautobot-app#291) - Updated maximum Nautobot version to `<4.0.0`.
- [#309](nautobot/cookiecutter-nautobot-app#309) - Change the tag-nautobot-app workflow to support multiple nautobot-app versions.
- [#320](nautobot/cookiecutter-nautobot-app#320) - Upstream testing now runs against selected branches.

- [#319](nautobot/cookiecutter-nautobot-app#319) - Fixed nav typo and added missing 2.7.2 release notes.

- [#322](nautobot/cookiecutter-nautobot-app#322) - Updated CI workflow to always regenerate poetry lockfile.

**Full Changelog**: nautobot/cookiecutter-nautobot-app@nautobot-app-v2.7.2...nautobot-app-v3.0.0

* Fix merge conflicts

* Disable mysql testing and add note.

* Fix merge conflicts

---------

Co-authored-by: bakebot <info@networktocode.com>
Co-authored-by: Stephen Kiely <stephenkiely87@gmail.com>
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.

Capirca configuration generation will crash if address object starts with a number

2 participants