forticlean


Nameforticlean JSON
Version 1.0.0 PyPI version JSON
download
home_pagehttps://github.com/ryanmerolle/forticlean
SummaryClean & sort FortiOS config files.
upload_time2023-10-14 04:32:28
maintainer
docs_urlNone
authorRyan Merolle
requires_python>=3.9,<4.0
license
keywords fortios python
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # FORTICLEAN

[![Build Tests](https://github.com/ryanmerolle/forticlean/actions/workflows/build-tests.yml/badge.svg?event=push)](https://github.com/ryanmerolle/forticlean/actions/workflows/build-tests.yml)
[![CodQL Analysis](https://github.com/ryanmerolle/forticlean/actions/workflows/codeql-analysis.yml/badge.svg?event=push)](https://github.com/ryanmerolle/forticlean/actions/workflows/codeql-analysis.yml)
[![Dependency Review](https://github.com/ryanmerolle/forticlean/actions/workflows/dependency-review.yml/badge.svg?event=push)](https://github.com/ryanmerolle/forticlean/actions/workflows/dependency-review.yml)
![PyPI - Downloads](https://img.shields.io/pypi/dm/forticlean)

## Description

FortiClean is a CLI tool designed for FortiOS configuration file management for better readability and comparision.
Built with Python & leverages the power of the typer library, this utility streamlines the process of:

- **Trimming Trailing Spaces**: Say goodbye to unwanted spaces at the end of your config lines that complicate diffs, but do not affect the configuration.
- **Removing Specific Sections**: Clean up your config file by specifying & deleting sections do not wish to save. A handy feature for decluttering and maintaining a streamlined configuration setup.
- **Sorting Config Sections & Subsections**: Enhance readability & structure by sorting specified config sections for enhanced readbility. It is recommended you do not sort config sections like firewall policy where order matters.

Unlike other network operatin systems, sections where config order does not matter is hapazardly saved in the order the config was entered making automated & manual diff operations challenging

## Features

- Trim spaces at the end of a line
- Delete config sections
- Sort config sections
- Sort config sections 1 level down
- Colored Logs
- Use jsonschemea to warn of config file errors
- Use jsonschema in tests
- Command line arguments to specify config, path, etc **COMING SOON**
- Prevent or WARN on the sorting of sections where order matters **COMING SOON**

## Getting Started

Clone the repo, move to the directory & run one of the below:

### Configuration

In order of precedence:
1.) .forticleaner in the directory you are running the script from
2.) .forticleaner in your home directory
3.) Default config file included with the package

### Usage

```console
main [OPTIONS] [SRC_FILE_PATH]
```

### Arguments

- `[SRC_FILE_PATH]`: Path to the source file

### Options

- `-d, --dst_file_path TEXT`: Path to the write file  [default: sorted_config.cfg]
- `-v, --verbose`: Enable level of verbose mode  [default: 0]
- `--install-completion`: Install completion for the current shell.
- `--show-completion`: Show completion for the current shell, to copy it or customize the installation.
- `--help`: Show this message and exit.

```bash
python3 src/main.py config.cfg
```

### Verbose Mode (1 level)

```bash
$ python3 src/main.py config.cfg -v
[13:42:07] INFO     Section 'config vpn certificate local' was DELETED.                                                                               main.py:27
           INFO     Removed trailing space(s) from 0 lines.                                                                                           main.py:40
           INFO     Section 'config system zone' was NOT SORTED                                                                                       main.py:70
           INFO     Section 'config system interface' was NOT SORTED                                                                                  main.py:70
           INFO     Section 'config firewall internet-service-name' was SORTED                                                                        main.py:70
```

## Verbose Mode (2 levels)

```bash
$ python3 src/main.py config.cfg -vv
[13:42:48] DEBUG    Config 'src/conf/default.yaml' opened successfully                                                                               utils.py:57
           DEBUG    Key 'FORTIOS_CONFIG_FILENAME_REGEX' NOT in the config file. Defaulting to (.*).cfg.                                              utils.py:63
           DEBUG    File 'config.cfg' opened successfully                                                                                            utils.py:26
           INFO     Section 'config vpn certificate local' was DELETED.                                                                               main.py:27
           INFO     Removed trailing space(s) from 0 lines.                                                                                           main.py:40
           INFO     Section 'config system zone' was NOT SORTED                                                                                       main.py:70
           INFO     Section 'config system interface' was NOT SORTED                                                                                  main.py:70
           INFO     Section 'config firewall internet-service-name' was SORTED                                                                        main.py:70
           DEBUG    File 'sorted_config.cfg' written successfully                                                                                    utils.py:38
```


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/ryanmerolle/forticlean",
    "name": "forticlean",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.9,<4.0",
    "maintainer_email": "",
    "keywords": "fortios,python",
    "author": "Ryan Merolle",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/e4/b4/d3b583d79df0b5141eb87b70f0a64b8995a278c31871122e3d0404f7bc34/forticlean-1.0.0.tar.gz",
    "platform": null,
    "description": "# FORTICLEAN\n\n[![Build Tests](https://github.com/ryanmerolle/forticlean/actions/workflows/build-tests.yml/badge.svg?event=push)](https://github.com/ryanmerolle/forticlean/actions/workflows/build-tests.yml)\n[![CodQL Analysis](https://github.com/ryanmerolle/forticlean/actions/workflows/codeql-analysis.yml/badge.svg?event=push)](https://github.com/ryanmerolle/forticlean/actions/workflows/codeql-analysis.yml)\n[![Dependency Review](https://github.com/ryanmerolle/forticlean/actions/workflows/dependency-review.yml/badge.svg?event=push)](https://github.com/ryanmerolle/forticlean/actions/workflows/dependency-review.yml)\n![PyPI - Downloads](https://img.shields.io/pypi/dm/forticlean)\n\n## Description\n\nFortiClean is a CLI tool designed for FortiOS configuration file management for better readability and comparision.\nBuilt with Python & leverages the power of the typer library, this utility streamlines the process of:\n\n- **Trimming Trailing Spaces**: Say goodbye to unwanted spaces at the end of your config lines that complicate diffs, but do not affect the configuration.\n- **Removing Specific Sections**: Clean up your config file by specifying & deleting sections do not wish to save. A handy feature for decluttering and maintaining a streamlined configuration setup.\n- **Sorting Config Sections & Subsections**: Enhance readability & structure by sorting specified config sections for enhanced readbility. It is recommended you do not sort config sections like firewall policy where order matters.\n\nUnlike other network operatin systems, sections where config order does not matter is hapazardly saved in the order the config was entered making automated & manual diff operations challenging\n\n## Features\n\n- Trim spaces at the end of a line\n- Delete config sections\n- Sort config sections\n- Sort config sections 1 level down\n- Colored Logs\n- Use jsonschemea to warn of config file errors\n- Use jsonschema in tests\n- Command line arguments to specify config, path, etc **COMING SOON**\n- Prevent or WARN on the sorting of sections where order matters **COMING SOON**\n\n## Getting Started\n\nClone the repo, move to the directory & run one of the below:\n\n### Configuration\n\nIn order of precedence:\n1.) .forticleaner in the directory you are running the script from\n2.) .forticleaner in your home directory\n3.) Default config file included with the package\n\n### Usage\n\n```console\nmain [OPTIONS] [SRC_FILE_PATH]\n```\n\n### Arguments\n\n- `[SRC_FILE_PATH]`: Path to the source file\n\n### Options\n\n- `-d, --dst_file_path TEXT`: Path to the write file  [default: sorted_config.cfg]\n- `-v, --verbose`: Enable level of verbose mode  [default: 0]\n- `--install-completion`: Install completion for the current shell.\n- `--show-completion`: Show completion for the current shell, to copy it or customize the installation.\n- `--help`: Show this message and exit.\n\n```bash\npython3 src/main.py config.cfg\n```\n\n### Verbose Mode (1 level)\n\n```bash\n$ python3 src/main.py config.cfg -v\n[13:42:07] INFO     Section 'config vpn certificate local' was DELETED.                                                                               main.py:27\n           INFO     Removed trailing space(s) from 0 lines.                                                                                           main.py:40\n           INFO     Section 'config system zone' was NOT SORTED                                                                                       main.py:70\n           INFO     Section 'config system interface' was NOT SORTED                                                                                  main.py:70\n           INFO     Section 'config firewall internet-service-name' was SORTED                                                                        main.py:70\n```\n\n## Verbose Mode (2 levels)\n\n```bash\n$ python3 src/main.py config.cfg -vv\n[13:42:48] DEBUG    Config 'src/conf/default.yaml' opened successfully                                                                               utils.py:57\n           DEBUG    Key 'FORTIOS_CONFIG_FILENAME_REGEX' NOT in the config file. Defaulting to (.*).cfg.                                              utils.py:63\n           DEBUG    File 'config.cfg' opened successfully                                                                                            utils.py:26\n           INFO     Section 'config vpn certificate local' was DELETED.                                                                               main.py:27\n           INFO     Removed trailing space(s) from 0 lines.                                                                                           main.py:40\n           INFO     Section 'config system zone' was NOT SORTED                                                                                       main.py:70\n           INFO     Section 'config system interface' was NOT SORTED                                                                                  main.py:70\n           INFO     Section 'config firewall internet-service-name' was SORTED                                                                        main.py:70\n           DEBUG    File 'sorted_config.cfg' written successfully                                                                                    utils.py:38\n```\n\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "Clean & sort FortiOS config files.",
    "version": "1.0.0",
    "project_urls": {
        "Documentation": "https://github.com/ryanmerolle/forticlean",
        "Homepage": "https://github.com/ryanmerolle/forticlean"
    },
    "split_keywords": [
        "fortios",
        "python"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "70df72ca09fb53f9de85523f0a6502e47b2f01ccd56daa66383118263b3dd925",
                "md5": "4c4f9ab4edc95a81a3225e0ff81c70f5",
                "sha256": "300996487173079d38e421de1e665a86c597f1d1ce9d76590e46e1f5def91f1e"
            },
            "downloads": -1,
            "filename": "forticlean-1.0.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "4c4f9ab4edc95a81a3225e0ff81c70f5",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9,<4.0",
            "size": 7155,
            "upload_time": "2023-10-14T04:32:26",
            "upload_time_iso_8601": "2023-10-14T04:32:26.404935Z",
            "url": "https://files.pythonhosted.org/packages/70/df/72ca09fb53f9de85523f0a6502e47b2f01ccd56daa66383118263b3dd925/forticlean-1.0.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e4b4d3b583d79df0b5141eb87b70f0a64b8995a278c31871122e3d0404f7bc34",
                "md5": "2337ea79babf752b8093e0244ff68f37",
                "sha256": "2cad0257d50fbc9ae7078935c8b2b38cb588475ce0b843d3fb3cc9da05aedb27"
            },
            "downloads": -1,
            "filename": "forticlean-1.0.0.tar.gz",
            "has_sig": false,
            "md5_digest": "2337ea79babf752b8093e0244ff68f37",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9,<4.0",
            "size": 6242,
            "upload_time": "2023-10-14T04:32:28",
            "upload_time_iso_8601": "2023-10-14T04:32:28.273600Z",
            "url": "https://files.pythonhosted.org/packages/e4/b4/d3b583d79df0b5141eb87b70f0a64b8995a278c31871122e3d0404f7bc34/forticlean-1.0.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-10-14 04:32:28",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "ryanmerolle",
    "github_project": "forticlean",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "forticlean"
}
        
Elapsed time: 0.55867s