Skip to content

Commit

Permalink
ciscoconfparse2 initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
mpenning committed Dec 6, 2023
1 parent 6a68ecf commit 1a7b88d
Show file tree
Hide file tree
Showing 44 changed files with 24,616 additions and 0 deletions.
25 changes: 25 additions & 0 deletions .codacy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
engines:
duplication:
enabled: true
config:
languages:
- python
bandit:
enabled: true
fixme:
enabled: true
radon:
enabled: true
coverage:
enabled: true
excluded_paths:
- tests/**
exclude_paths:
- ".flake8"
- "**.md"
- "**.rst"
- "**.pdf"
- "**.jpg"
- "**.png"
- "**.gif"
Binary file added .coverage
Binary file not shown.
15 changes: 15 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[run]
source = ciscoconfparse
branch = True

[report]
exclude_lines =
pragma: no cover
def __repr__
raise AssertionError
raise NotImplementedError
if 0:
if __name__ == .__main__.:

omit =
ciscoconfparse/dev_tools/*
1 change: 1 addition & 0 deletions .github/CONTRIBUTING.md
168 changes: 168 additions & 0 deletions .github/ISSUE_TEMPLATE/bug-report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,168 @@
---
# https://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/configuring-issue-templates-for-your-repository
name: CiscoConfParse Bug Report
description: File a bug report
title: "[Bug]: "
labels: ["bug"]
assignees:
- octocat

body:
- type: markdown
attributes:
value: |
Please use this form to report a CiscoConfParse bug.
- Follow our guidance on <a href="https://meta.stackoverflow.com/q/260648/667301">How to Ask Good Questions</a>.
- Please include sufficient details and context.
- Describe the expected behavior that should have happened but didn't.
- If you find multiple bugs, please submit them in separate issues.
- CiscoConfParse is maintained by volunteers. Please be courteous and patient.
*Issues that do not include all the information requested in this form are subject to closure*.
- type: input
id: contact
attributes:
label: Contact Details
description: How can we get in touch with you if we need more info?
placeholder: [email protected]
validations:
required: false

- type: textarea
id: what-happened
attributes:
label: What happened?
description: What did you see? What did you expect?
placeholder: What did you see? What did you expect?
validations:
required: true

- type: input
id: ciscoconfparse-version
attributes:
label: CiscoConfParse Version
description: What ciscoconfparse2 version had the problem?
placeholder: Version x.y.z (e.g. Version 1.6.13)
validations:
required: true

- type: dropdown
id: operating-system
attributes:
label: What Operating System are you using?
multiple: true
options:
- Microsoft Windows
- MacOS
- Linux - Debian, Ubuntu, CentOS, RHEL or others
- OpenBSD, FreeBSD, NetBSD
- Other (please specify)
validations:
required: true

- type: dropdown
id: python-version
attributes:
label: What Python version(s) have this problem?
multiple: true
options:
- Python 3.10
- Python 3.9
- Python 3.8
- Python 3.7
- Python 3.6
- Python 3.5
- Python 3.x
- Python 2.7
- Python 2.x
- Other (please specify)
validations:
required: true

- type: textarea
id: reproduce-example
validations:
required: true
attributes:
label: Show us how to reproduce the problem. Please tell us if the problem is specific to certain inputs or situations.
description: Include a minimal reproducible example that demonstrates the bug
render: python
placeholder: |
import sys
from ciscoconfparse2 import CiscoConfParse
def parse_a_config():
config = """
hostname Router01
!
interface FastEthernet 0/4
switchport
switchport mode access
!
! Add any other relevant configuration...
!
"""
parse = CiscoConfParse(config.splitlines(), syntax='ios')
return parse
parser = parse_a_config()
- type: textarea
id: python-tracebacks
attributes:
label: Python tracebacks
description: Please include all tracebacks. If no traceback, please say so in the textarea box.
placeholder: |
Traceback (most recent call last):
File "/home/mpenning/fixme/ciscoconfparse2/ciscoconfparse2/ccp_util.py", line 445, in _get_ipv4
IPv4Network(val, strict=False)
File "/opt/python37/lib/python3.7/ipaddress.py", line 1528, in __init__
addr = self._ip_int_from_string(args[0])
File "/opt/python37/lib/python3.7/ipaddress.py", line 1140, in _ip_int_from_string
raise AddressValueError("%s in %r" % (exc, ip_str)) from None
ipaddress.AddressValueError: Only decimal digits permitted in '::ffff:192' in '::ffff:192.0.2.101'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/mpenning/fixme/ciscoconfparse2/ciscoconfparse2/ccp_util.py", line 528, in ip_factory
obj = _get_ipv4(val=val, stdlib=stdlib, debug=debug)
File "/home/mpenning/fixme/ciscoconfparse2/ciscoconfparse2/ccp_util.py", line 460, in _get_ipv4
raise ipaddress.AddressValueError(str(ee))
ipaddress.AddressValueError: Only decimal digits permitted in '::ffff:192' in '::ffff:192.0.2.101'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/mpenning/fixme/ciscoconfparse2/ciscoconfparse2/ccp_util.py", line 532, in ip_factory
raise ipaddress.AddressValueError(error_str)
ipaddress.AddressValueError: Cannot parse '::ffff:192.0.2.101' as ipv4
render: shell
validations:
required: true

- type: textarea
id: logs
attributes:
label: Relevant log output
description: Please copy and paste any relevant log output.
placeholder: |
# In /var/log/messages...
2022-02-19T14:41:16.492894-06:00 mySweetBread_Daemon.py started listening on 192.0.2.21 port tcp/9190
2022-02-19T14:43:44.690444-06:00 mySweetBread_Daemon.py went boom!
render: shell
validations:
required: false

- type: checkboxes
id: terms
attributes:
label: Code of Conduct
description: By submitting this issue, you agree to follow our [Code of Conduct](https://github.com/mpenning/ciscoconfparse2/blob/main/CONTRIBUTING.md) as found in [`CONTRIBUTING.md`](https://github.com/mpenning/ciscoconfparse2/blob/main/CONTRIBUTING.md)
options:
- label: I agree to follow this project's [Code of Conduct](https://github.com/mpenning/ciscoconfparse2/blob/main/CONTRIBUTING.md)
required: true
17 changes: 17 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
# Documentation reference
# https://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/manually-creating-a-single-issue-template-for-your-repository
#
# The titles of markdown (*.md) files in `.github/ISSUE_TEMPLATE/*.md`
# determine what buttons are shown when opening a github issue...
#
# yaml formatting checked with http://www.yamllint.com/
#
blank_issues_enabled: false
contact_links:
- name: "Security issue"
url: [email protected]
about: "Do not report security issues publicly. Please email our security contact."
- name: Questions
url: https://stackoverflow.com/questions/ask?title=How%20do%20I&tags=ciscoconfparse+python
about: "StackOverflow or reddit/r/Python are good places to ask programming questions, such as those involving CiscoConfParse(). We do not support python programming questions here."
15 changes: 15 additions & 0 deletions .github/ISSUE_TEMPLATE/feature-request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
name: Feature request
about: Suggest a new feature for ciscoconfparse2
---

<!--
Replace this comment with a description of what the feature should do.
Include details such as links to relevant specs or previous discussions.
-->

<!--
Replace this comment with an example of the problem which this feature
would resolve. Is this problem solvable without changes to ciscoconfparse, such
as by subclassing?
-->
20 changes: 20 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Build
on:
push:
branches:
- main
pull_request:
types: [opened, synchronize, reopened]
jobs:
sonarcloud:
name: SonarCloud
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
26 changes: 26 additions & 0 deletions .github/workflows/lock_issue_pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: 'Lock threads'
# Lock closed issues that have not received any further activity for
# three weeks. This does not close open issues, only humans may do that.
# We find that it is easier to respond to new issues with fresh examples
# rather than continuing discussions on old issues.

on:
schedule:
- cron: '0 0 * * *'

permissions:
issues: write
pull-requests: write

concurrency:
group: lock

jobs:
lock:
runs-on: ubuntu-latest
steps:
- uses: dessant/lock-threads@be8aa5be94131386884a6da4189effda9b14aa21
with:
exclude-any-issue-labels: 'accepted, documentation, work-in-progress, help-wanted'
issue-inactive-days: 21
pr-inactive-days: 21
50 changes: 50 additions & 0 deletions .github/workflows/stale-issue-action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# close-stale-issues ->
# - https://github.com/marketplace/actions/close-stale-issues
# - https://github.com/actions/stale
name: 'Close stale issues/PRs'
on:
schedule:
- cron: '0 1 * * *'

jobs:
stale:
runs-on: ubuntu-latest
steps:
- uses: actions/stale@v4
with:
close-issue-message: >
Due to inactivity, CiscoConfParse's maintainers are closing this
issue. Please refrain from further comments. In the future,
CiscoConfParse's maintainers may reopen it solely at their
own discretion. For more detailed information, please refer to
our CONTRIBUTING guidance ->
https://github.com/mpenning/ciscoconfparse2/blob/main/.github/CONTRIBUTING.md
close-pr-message: >
This PR has been automatically closed due to lack of activity.
For more detailed information, please refer to our
CONTRIBUTING guidance ->
https://github.com/mpenning/ciscoconfparse2/blob/main/.github/CONTRIBUTING.md
days-before-stale: 60
days-before-close: 30
exempt-issue-labels: 'status: accepted,status: blocked'
operations-per-run: 100
remove-stale-when-updated: false
stale-issue-label: 'stale-pending-close'
stale-issue-message: >
This issue has automatically been marked stale due to inactivity.
The issue will close unless further activity occurs. Please
understand that the CiscoConfParse team is not obligated to
comment on every issue. For more detailed information, please
refer to our CONTRIBUTING guidance ->
https://github.com/mpenning/ciscoconfparse2/blob/main/.github/CONTRIBUTING.md
stale-pr-label: 'stale-pending-close'
stale-pr-message: >
This PR has automatically been marked stale due to inactivity.
It will automatically close unless further action is taken.
Please understand that the CiscoConfParse team is not obligated
to comment on (or approve) every Pull Request. For more detailed
information, please refer to CONTRIBUTING guidance ->
https://github.com/mpenning/ciscoconfparse2/blob/main/.github/CONTRIBUTING.md
Loading

0 comments on commit 1a7b88d

Please sign in to comment.