Skip to content

Commit

Permalink
Lint
Browse files Browse the repository at this point in the history
  • Loading branch information
juztas committed Dec 11, 2023
1 parent 2dd0732 commit 8baebbc
Show file tree
Hide file tree
Showing 5 changed files with 290 additions and 181 deletions.
2 changes: 1 addition & 1 deletion linter.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ for fname in $(git diff --name-only HEAD HEAD~1); do
echo "Checking $fname with python linters"
black "$fname"
isort "$fname"
pylint-3 "$fname" --rcfile standarts/pylintrc
pylint "$fname" --rcfile standarts/pylintrc
fi
if [[ $fname == *.yaml || $fname == *.yml ]]
then
Expand Down
24 changes: 17 additions & 7 deletions plugins/action/sonic.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,32 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
"""Wrapper to Action Module
Copyright: Contributors to the SENSE Project
GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
Title : sdn-sense/sonic
Author : Justas Balcas
Email : juztas (at) gmail.com
@Copyright : General Public License v3.0+
Date : 2023/12/11
"""
# Copyright: Contributors to the Ansible project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
import sys
import copy

from ansible_collections.ansible.netcommon.plugins.action.network import ActionModule as ActionNetworkModule
from ansible_collections.sense.sonic.plugins.module_utils.runwrapper import classwrapper
from ansible_collections.ansible.netcommon.plugins.action.network import \
ActionModule as ActionNetworkModule
from ansible_collections.sense.sonic.plugins.module_utils.runwrapper import \
classwrapper


@classwrapper
class ActionModule(ActionNetworkModule):
""" Ansible Action Module"""
"""Ansible Action Module"""

def run(self, tmp=None, task_vars=None):
"""SONiC Ansible Run"""

self._config_module = self._task.action.split('.')[-1] == 'sonic_config'
self._config_module = self._task.action.split(".")[-1] == "sonic_config"

result = super(ActionModule, self).run(task_vars=task_vars)
result = super().run(task_vars=task_vars)
return result
17 changes: 15 additions & 2 deletions plugins/doc_fragments/sonic.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,23 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""Wrapper to Documentation Module
Copyright: Contributors to the SENSE Project
GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
Title : sdn-sense/sonic
Author : Justas Balcas
Email : juztas (at) gmail.com
@Copyright : General Public License v3.0+
Date : 2023/12/11
"""
# Copyright: Contributors to the Ansible project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from ansible_collections.sense.sonic.plugins.module_utils.runwrapper import classwrapper
from ansible_collections.sense.sonic.plugins.module_utils.runwrapper import \
classwrapper


@classwrapper
class ModuleDocFragment(object):
class ModuleDocFragment:
"""Module Documentation Fragment"""

DOCUMENTATION = ""
1 change: 1 addition & 0 deletions plugins/module_utils/runwrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

def functionwrapper(func):
"""Function wrapper to print start/runtime/end"""

def wrapper(*args, **kwargs):
if display.verbosity > 5:
display.vvvvvv(
Expand Down
Loading

0 comments on commit 8baebbc

Please sign in to comment.