Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# EditorConfig is awesome: https://EditorConfig.org

# top-most EditorConfig file
root = true

# Unix-style newlines with a newline ending every file
[*]
end_of_line = lf
insert_final_newline = true
charset = utf-8
trim_trailing_whitespace = true

# Python files
[*.py]
indent_style = space
indent_size = 4
max_line_length = 100

# YAML files
[*.{yml,yaml}]
indent_style = space
indent_size = 2

# TOML files
[*.toml]
indent_style = space
indent_size = 2

# Markdown files
[*.md]
trim_trailing_whitespace = false
max_line_length = 120

# Shell scripts
[*.sh]
indent_style = space
indent_size = 2

# JSON files
[*.json]
indent_style = space
indent_size = 2

# Configuration files
[*.conf]
indent_style = space
indent_size = 2
26 changes: 21 additions & 5 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,36 @@ on:
release:
types: [created]

permissions:
contents: read

jobs:
deploy:
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/project/hier-config-cli/
permissions:
id-token: write # Required for trusted publishing

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: '3.9'
python-version: '3.12'

- name: Install poetry
uses: snok/install-poetry@v1
with:
version: 1.5.1
- name: Build and publish to PyPI
version: 1.8.2

- name: Build package
run: |
poetry build

- name: Publish to PyPI
env:
TWINE_API_KEY: ${{ secrets.TWINE_API_KEY }}
run: |
Expand Down
62 changes: 51 additions & 11 deletions .github/workflows/test-app.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,30 +7,70 @@ on:
branches: [main]

jobs:
build:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version:
- "3.9"
- "3.10"
- "3.11"
- "3.12"
- "3.13"

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install poetry
uses: snok/install-poetry@v1
with:
version: 1.5.1
- name: Set PYTHONPATH
run: echo "PYTHONPATH=src" >> $GITHUB_ENV
- name: Run tests
version: 1.8.2

- name: Cache dependencies
uses: actions/cache@v4
with:
path: ~/.cache/pypoetry
key: ${{ runner.os }}-poetry-${{ hashFiles('**/poetry.lock') }}
restore-keys: |
${{ runner.os }}-poetry-

- name: Install dependencies
run: |
poetry install --no-interaction

- name: Run black formatter check
run: |
poetry run black --check src/ tests/

- name: Run ruff linter
run: |
poetry install --no-interaction --no-root
poetry run black --check .
poetry run pytest tests/
poetry run ruff check src/ tests/

- name: Run mypy type checker
run: |
poetry run mypy src/

- name: Run tests with coverage
run: |
poetry run pytest --cov=hier_config_cli --cov-report=xml --cov-report=term-missing

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
if: matrix.python-version == '3.12'
with:
file: ./coverage.xml
flags: unittests
name: codecov-umbrella
fail_ci_if_error: false

- name: Upload coverage reports
uses: actions/upload-artifact@v4
if: matrix.python-version == '3.12'
with:
name: coverage-report
path: htmlcov/
retention-days: 7
80 changes: 80 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

## [0.2.0] - 2026-01-25

### Added
- Added support for Fortinet FortiOS platform
- Added `--format` option to output results in JSON, YAML, or text formats
- Added `--output` / `-o` flag to save output to file
- Added `list-platforms` command to show all available platforms
- Added `version` command to display tool version
- Added comprehensive error handling for file operations and platform validation
- Added verbose logging support with `-v` (INFO) and `-vv` (DEBUG) flags
- Added complete type hints throughout codebase
- Added comprehensive test suite with 20+ test cases including:
- Error handling tests
- All platform tests
- Output format tests (text, JSON, YAML)
- File output tests
- Verbose logging tests
- Added comprehensive documentation:
- Detailed README with installation instructions and examples
- CONTRIBUTING.md with development guidelines
- SECURITY.md with security policy
- Examples directory with sample configurations
- Integration examples for Nornir, Ansible, and CI/CD
- Added development tools configuration:
- Black formatter configuration
- Ruff linter configuration
- Mypy type checker configuration
- Pytest with coverage reporting
- Added `py.typed` marker file for PEP 561 compliance

### Changed
- **BREAKING**: Converted to proper Python package structure with `__init__.py`
- **BREAKING**: Entry point now uses `hier_config_cli:cli` instead of module path
- Refactored duplicate code in commands into shared `process_configs()` function
- Fixed platform-specific output formatting (no longer hardcodes `cisco_style_text()` for all platforms)
- Improved command help text with detailed descriptions and examples
- Enhanced pyproject.toml with comprehensive metadata and classifiers
- Updated Python version support to 3.9-3.13
- Improved error messages to be more descriptive and actionable

### Fixed
- Fixed incorrect output format for Juniper JunOS configurations
- Fixed missing platform support for Fortinet FortiOS
- Fixed lack of error handling for missing or unreadable configuration files
- Fixed unused PyYAML dependency (now actively used for YAML output)

### Removed
- Removed code duplication across remediation, rollback, and future commands

## [0.1.0] - 2024-12-XX

### Added
- Initial release
- Basic remediation, rollback, and future commands
- Support for major network platforms:
- Cisco IOS
- Cisco NX-OS
- Cisco IOS XR
- Arista EOS
- Juniper JunOS
- VyOS
- HP Comware5
- HP ProCurve
- Generic platform
- GitHub Actions CI/CD pipeline
- Basic test coverage
- Apache 2.0 license

[Unreleased]: https://github.com/netdevops/hier-config-cli/compare/v0.2.0...HEAD
[0.2.0]: https://github.com/netdevops/hier-config-cli/compare/v0.1.0...v0.2.0
[0.1.0]: https://github.com/netdevops/hier-config-cli/releases/tag/v0.1.0
Loading