Skip to main content

Python module to perform IP hostname registration and unregistration in BlueCat

Project description

bluecatipreg

Python module to perform IP hostname registration and unregistration in BlueCat.

Getting Started

Installation

Install from source (development)

# Clone the repository
git clone <repository-url>
cd bluecatipreggithub

# Create and activate virtual environment
python -m venv venv
# On Windows:
venv\Scripts\activate
# On Linux/Mac:
source venv/bin/activate

# Install in development mode
pip install -e .

# Or install with development dependencies
pip install -e ".[dev]"

Build and install package

# Build the package
pip install build
python -m build

# This creates:
# - dist/bluecatipreg-0.0.1.tar.gz (source distribution)
# - dist/bluecatipreg-0.0.1-py3-none-any.whl (wheel)

# Install from built package
pip install dist/bluecatipreg-0.0.1-py3-none-any.whl

Install from PyPI (when published)

pip install bluecatipreg

Usage

NOTE: Provided password should be base64 encrypted.

1. Register IP and host in Bluecat

python -m bluecatipreg add -url https://abc.com -user admin -passwd password -n test01 -fqdn test01.dev.abc.com -ipv4 6.6.6.6 -net 6.6.6.0/24 -conf playground -domain dev.abc.com -contact developer@abc.com -c "test01 dns entry"

2. Unregister IP from the Bluecat

python -m bluecatipreg delete -url https://abc.com -user admin -passwd password -conf playground -ipv4 6.6.6.6

Development

Running Unit Tests

Using pytest (recommended)

# Install test dependencies
pip install -r requirements_dev.txt
pip install pytest pytest-cov

# Run all tests
pytest bluecatipreg/tests -v

# Run with coverage
pytest bluecatipreg/tests -v --cov=bluecatipreg --cov-report=term-missing --cov-report=html

# Run specific test file
pytest bluecatipreg/tests/test_bluecat_utils.py -v

Using unittest (Python built-in)

python -m unittest discover -s bluecatipreg/tests -p "test_*.py" -v

Code Quality

Linting with flake8

flake8 bluecatipreg --count --select=E9,F63,F7,F82 --show-source --statistics
flake8 bluecatipreg --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics

Code formatting with black

# Check formatting
black --check bluecatipreg

# Format code
black bluecatipreg

CI/CD Pipeline

The project includes a GitHub Actions CI/CD pipeline (.github/workflows/ci.yml) that:

  1. Runs on: Push and pull requests to main, master, and develop branches
  2. Test Matrix: Tests on multiple Python versions (3.7-3.13) across Ubuntu, Windows, and macOS
  3. Steps:
    • Installs dependencies
    • Runs linting (flake8)
    • Checks code formatting (black)
    • Runs unit tests with coverage
    • Builds the package (on main/master branch)
    • Validates the built package

Viewing Pipeline Status

  • Go to the "Actions" tab in your GitHub repository
  • Click on a workflow run to see detailed logs
  • The pipeline will automatically run on every push and pull request

Package Structure

bluecatipreg/
├── __init__.py          # Package initialization
├── __main__.py          # CLI entry point
├── bluecat_utils.py     # Core BlueCat API functionality
├── options.py           # Command-line argument parsing
└── tests/               # Unit tests
    ├── __init__.py
    └── test_bluecat_utils.py

Requirements

  • Python 3.7+
  • requests

See requirements.txt for production dependencies and requirements_dev.txt for development dependencies.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bluecatipreg-0.0.1.tar.gz (9.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bluecatipreg-0.0.1-py3-none-any.whl (8.4 kB view details)

Uploaded Python 3

File details

Details for the file bluecatipreg-0.0.1.tar.gz.

File metadata

  • Download URL: bluecatipreg-0.0.1.tar.gz
  • Upload date:
  • Size: 9.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for bluecatipreg-0.0.1.tar.gz
Algorithm Hash digest
SHA256 292164fd657287eb28706a994b8fc2a92e11b2ccf6e7a2b6f2c195f4e40fd77d
MD5 14740da9d5948fb68c314d2654399429
BLAKE2b-256 ff7efdf82a4004b3639a5a9baa55d63c0736cf84df5198241cdef5ca34df4136

See more details on using hashes here.

File details

Details for the file bluecatipreg-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: bluecatipreg-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 8.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for bluecatipreg-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 190b60a60c54f5f0489c2583d7be36a3df4023a1b3c4fa9088e1662c90c14008
MD5 e54816ea7403d7ba10efbe5990b90ee1
BLAKE2b-256 c7a048f4d195cf3b4db02f9df0119fca45b1c7b9402c62537047aebd04c13677

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page