-
Notifications
You must be signed in to change notification settings - Fork 5.5k
/
nxos.py
43 lines (33 loc) · 1.01 KB
/
nxos.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# -*- coding: utf-8 -*-
'''
Grains for Cisco NX-OS minions
.. versionadded: 2016.11.0
For documentation on setting up the nxos proxy minion look in the documentation
for :mod:`salt.proxy.nxos<salt.proxy.nxos>`.
'''
# Import Python Libs
from __future__ import absolute_import, print_function, unicode_literals
# Import Salt Libs
import salt.utils.platform
import salt.utils.nxos
from salt.exceptions import NxosClientError
import logging
log = logging.getLogger(__name__)
__proxyenabled__ = ['nxos']
__virtualname__ = 'nxos'
def __virtual__():
try:
salt.utils.nxos.version_info()
except NxosClientError as err:
return False, err
return __virtualname__
def system_information(proxy=None):
if salt.utils.platform.is_proxy():
if proxy is None:
return {}
if proxy['nxos.initialized']() is False:
return {}
return {'nxos': proxy['nxos.grains']()}
else:
data = salt.utils.nxos.version_info()
return salt.utils.nxos.system_info(data)