-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #390 from arista-eosplus/release-2.0.0
Release 2.0.0
- Loading branch information
Showing
87 changed files
with
6,034 additions
and
5,798 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
name: Pylint | ||
|
||
on: [push] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: ["3.7", "3.8", "3.9"] | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install pylint | ||
pip install -r requirements.txt | ||
pip install -r requirements-node.txt | ||
- name: Analysing the code with pylint | ||
run: | | ||
make pylint |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
name: Unittest Node py2 | ||
|
||
on: [push] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
container: | ||
image: python:2.7.18-buster | ||
volumes: | ||
- /dev/log:/dev/log | ||
env: | ||
USER: root | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -r requirements.txt | ||
pip install -r requirements-node-py2.txt | ||
pip install -r requirements-dev.txt | ||
- name: Run client tests | ||
run: | | ||
make test_client | ||
- name: Run action tests | ||
run: | | ||
make test_actions |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
name: Unittest Node | ||
|
||
on: [push] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: ["3.7", "3.8", "3.9"] | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -r requirements.txt | ||
pip install -r requirements-node.txt | ||
pip install -r requirements-dev.txt | ||
- name: Run client tests | ||
run: | | ||
make test_client | ||
- name: Run action tests | ||
run: | | ||
make test_actions |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
name: Unittest server | ||
|
||
on: [push] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: ["3.7", "3.8", "3.9", "3.10"] | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -r requirements.txt | ||
pip install -r requirements-dev.txt | ||
- name: Run server tests | ||
run: | | ||
make test_server |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -53,3 +53,6 @@ rpm/rpms | |
|
||
# virtualenv | ||
venv | ||
|
||
# IDE | ||
.idea |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
repos: | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.4.0 | ||
hooks: | ||
- id: check-yaml | ||
- id: end-of-file-fixer | ||
- id: trailing-whitespace | ||
- repo: https://github.com/psf/black | ||
rev: 23.3.0 | ||
hooks: | ||
- id: black | ||
args: ["-l", "100"] | ||
- repo: https://github.com/pycqa/isort | ||
rev: 5.12.0 | ||
hooks: | ||
- id: isort | ||
name: isort (python) | ||
args: ["--profile", "black"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,9 +2,9 @@ | |
# docker run -P ztpserver | ||
# docker run -i -t --rm -p 80:80 nginx | ||
# | ||
FROM python:2 | ||
FROM python:3 | ||
|
||
LABEL version="0.1" | ||
LABEL version="0.2" | ||
LABEL maintainer="[email protected]" | ||
|
||
WORKDIR /src/ztpserver | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
1.6.0 | ||
2.0.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,23 +27,27 @@ | |
# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN | ||
# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
|
||
#pylint: disable=W0703,W0402,E1103 | ||
# pylint: disable=C0209 | ||
|
||
import io | ||
import os | ||
|
||
TEMP_CONFIG = '/tmp/tmp-add-config' | ||
from six import raise_from | ||
|
||
TEMP_CONFIG = "/tmp/tmp-add-config" | ||
|
||
|
||
def main(attributes): | ||
''' Appends config section to startup-config. | ||
"""Appends config section to startup-config. | ||
This action is dual-supervisor compatible. | ||
Attributes: | ||
url: path to source config/template | ||
substitution_mode: loose|strict (default: loose) | ||
variables: list of value substitutions | ||
Special_attributes: | ||
Special_attributes: | ||
NODE: API object - see documentation for details | ||
Example: | ||
|
@@ -60,41 +64,37 @@ def main(attributes): | |
onsuccess: "SUCCESS: ma1 configure" | ||
onfailure: "FAIL: IM [email protected] for help" | ||
''' | ||
""" | ||
|
||
node = attributes.get('NODE') | ||
url = attributes.get('url') | ||
node = attributes.get("NODE") | ||
url = attributes.get("url") | ||
|
||
if not url: | ||
raise Exception('Missing attribute(\'url\')') | ||
raise RuntimeError("Missing attribute('url')") | ||
|
||
|
||
substitution_mode = attributes.get('substitution_mode', 'loose') | ||
if substitution_mode not in ['loose', 'strict']: | ||
raise Exception('Invalid option specified for substitution_mode ' | ||
'attribute') | ||
substitution_mode = attributes.get("substitution_mode", "loose") | ||
if substitution_mode not in ["loose", "strict"]: | ||
raise RuntimeError("Invalid option specified for substitution_mode attribute") | ||
|
||
try: | ||
node.retrieve_url(url, TEMP_CONFIG) | ||
except Exception as exc: | ||
raise Exception('Unable to retrieve config from URL (%s)' % | ||
exc) | ||
raise_from(RuntimeError("Unable to retrieve config from URL"), exc) | ||
|
||
contents = open(TEMP_CONFIG, 'r').read() | ||
with io.open(TEMP_CONFIG, encoding="utf8") as fd: | ||
contents = fd.read() | ||
|
||
variables = attributes.get('variables') | ||
variables = attributes.get("variables") | ||
if not variables: | ||
variables = {} | ||
|
||
if not isinstance(variables, dict): | ||
node.log_msg('Variables: %s' % variables) | ||
raise Exception('Unable to perform variable substitution - ' | ||
'invalid variables') | ||
|
||
contents = node.substitute(contents, variables, | ||
substitution_mode == 'strict') | ||
node.append_startup_config_lines(contents.split('\n')) | ||
|
||
node.log_msg("Variables: {}".format(variables)) | ||
raise RuntimeError("Unable to perform variable substitution - invalid variables") | ||
|
||
contents = node.substitute(contents, variables, substitution_mode == "strict") | ||
node.append_startup_config_lines(contents.split("\n")) | ||
|
||
# Only remove this in case everything else succeeded | ||
# for debugging purposes | ||
os.remove(TEMP_CONFIG) |
Oops, something went wrong.