Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nilrt_ip: network module for older nilrt #48400

Merged
merged 1 commit into from Jul 12, 2018

Conversation

Projects
None yet
4 participants
@alexvasiu
Copy link
Contributor

commented Jul 2, 2018

Make nilrt_ip compatible with older nilrt. Since connman isn't pressent
in older nilrt distros, use available tools (nirtcfg, ip, ifconfig)
instead, to make this module partial compatible with newer nilrt part.
The functionality available for older nilrt distros is:
- enable/disable the interfaces
- get details about sigle interface
- information about all interfaces
- set dhcp with linklocal fallback
- set dhcp only
- set linklocal only
- set static configuration

Signed-off-by: Heghedus Razvan razvan.heghedus@ni.com
Signed-off-by: Alexandru Vasiu alexandru.vasiu@ni.com
Signed-off-by: Rares POP rares.pop@ni.com

from salt.ext import six
from salt.ext.six.moves import configparser
# pylint: enable=import-error,redefined-builtin,no-name-in-module
try:
import pyconnman

This comment has been minimized.

Copy link
@rares-pop

rares-pop Jul 4, 2018

Contributor

salt seems to standardize on a different way of doing this:
try:
..import pyconnman
except ImportError:
..pyconnman = None

and then instead of:
if not HAS_PYCONNMAN:
just do:
if not pyconnman:

We should fix all those imports

This comment has been minimized.

Copy link
@alexvasiu

alexvasiu Jul 5, 2018

Author Contributor

I changed all third-party imports

@alexvasiu alexvasiu force-pushed the alexvasiu:dev/avasiu/older_nilrt_ip branch from 96dfabd to a53e9d4 Jul 5, 2018

@alexvasiu

This comment has been minimized.

Copy link
Contributor Author

commented Jul 11, 2018

@gtmanfred May you please take a look at this ?

try:
import configparser
except ImportError:
configparser = None

This comment has been minimized.

Copy link
@gtmanfred

gtmanfred Jul 11, 2018

Contributor

This still needs to be imported from six.

from salt.ext.six.moves import configparser

Because the name changed between py2 and py3

@gtmanfred
Copy link
Contributor

left a comment

configparser needs to still be imported from salt.ext.six.moves.

Otherthan that, this looks fine

@alexvasiu alexvasiu force-pushed the alexvasiu:dev/avasiu/older_nilrt_ip branch from a53e9d4 to ecbbade Jul 11, 2018


# Import salt libs
import salt.exceptions
import salt.utils.files
import salt.utils.validate.net

# Import 3rd-party libs
# pylint: disable=import-error,redefined-builtin,no-name-in-module
from salt.ext.six.moves import map, range

This comment has been minimized.

Copy link
@gtmanfred

gtmanfred Jul 11, 2018

Contributor

so, you don't need a try except loop for configparser, it just needs to be added to the imports on this line.

try:
from salt.ext.six.moves import configparser
except ImportError:
configparser = None

This comment has been minimized.

Copy link
@gtmanfred

gtmanfred Jul 11, 2018

Contributor

This will be unneeded.

try:
msg = 'The nilrt_ip module could not be loaded: unsupported OS family'
_assume_condition(__grains__['os_family'] == 'NILinuxRT', msg)
_assume_condition(configparser, 'The python package configparser is not installed')

This comment has been minimized.

Copy link
@gtmanfred

gtmanfred Jul 11, 2018

Contributor

again, unneeded, because it will always be in salt.ext.six.moves

nilrt_ip: network module for older nilrt
Make nilrt_ip compatible with older nilrt. Since connman isn't pressent
in older nilrt distros, use available tools (nirtcfg, ip, ifconfig)
instead, to make this module partial compatible with newer nilrt part.
The functionality available for older nilrt distros is:
    - enable/disable the interfaces
    - get details about sigle interface
    - information about all interfaces
    - set dhcp with linklocal fallback
    - set dhcp only
    - set linklocal only
    - set static configuration

Signed-off-by: Heghedus Razvan <razvan.heghedus@ni.com>
Signed-off-by: Alexandru Vasiu <alexandru.vasiu@ni.com>
Signed-off-by: Rares POP <rares.pop@ni.com>

@alexvasiu alexvasiu force-pushed the alexvasiu:dev/avasiu/older_nilrt_ip branch from ecbbade to ffeab5e Jul 12, 2018

@alexvasiu

This comment has been minimized.

Copy link
Contributor Author

commented Jul 12, 2018

@gtmanfred I changed that import for configparser and I removed all checks for it

@rallytime rallytime merged commit 570f76d into saltstack:develop Jul 12, 2018

7 of 17 checks passed

continuous-integration/jenkins/pr-merge This commit cannot be built
Details
jenkins/PR/salt-pr-linode-ubuntu16-py3 Pull Requests » Salt PR - Linode Ubuntu16.04 - PY3 #11353 — ABORTED
Details
jenkins/PR/salt-pr-rs-cent7-n Pull Requests » Salt PR - RS CentOS 7 #20436 — ABORTED
Details
codeclimate 19 issues to fix
Details
default Build finished.
Details
jenkins/PR/salt-pr-linode-ubuntu14-n Pull Requests » Salt PR - Linode Ubuntu14.04 #24311 — FAILURE
Details
jenkins/pr/py2-centos-7 The py2-centos-7 job has failed
Details
jenkins/pr/py2-ubuntu-1604 The py2-ubuntu-1604 job has failed
Details
jenkins/pr/py3-centos-7 The py3-centos-7 job has failed
Details
jenkins/pr/py3-ubuntu-1604 running py3-ubuntu-1604...
Details
WIP ready for review
Details
jenkins/PR/salt-pr-clone Pull Requests » Salt PR - Clone #26598 — SUCCESS
Details
jenkins/PR/salt-pr-docs-n Pull Requests » Salt PR - Docs #18628 — SUCCESS
Details
jenkins/PR/salt-pr-linode-cent7-py3 Pull Requests » Salt PR - Linode CentOS 7 - PY3 #6383 — SUCCESS
Details
jenkins/PR/salt-pr-lint-n Pull Requests » Salt PR - Code Lint #23264 — SUCCESS
Details
jenkins/pr/docs The docs job has passed
Details
jenkins/pr/lint The lint job has passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.