Resolve merge conflicts

This commit is contained in:
rajvidhimar 2017-03-06 14:11:26 +05:30
commit a06d5e961d
4 changed files with 60 additions and 55 deletions

View File

@ -10,6 +10,7 @@ addons:
- python-dev
install:
<<<<<<< HEAD
- if [ "$TRAVIS_PYTHON_VERSION" == "2.6" ]; then pip install importlib; fi
- "pip install junos-eznc"
- "pip install jxmlease"
@ -18,3 +19,22 @@ install:
- "pip install nose"
script: nosetests -v tests/unit/modules/junos_test.py
=======
- pip install -r requirements/zeromq.txt -r requirements/cloud.txt
- pip install --allow-all-external -r requirements/opt.txt
before_script:
- "/home/travis/virtualenv/python${TRAVIS_PYTHON_VERSION}/bin/pylint --rcfile=.testing.pylintrc salt/ && echo 'Finished Pylint Check Cleanly' || echo 'Finished Pylint Check With Errors'"
- "/home/travis/virtualenv/python${TRAVIS_PYTHON_VERSION}/bin/pep8 --ignore=E501,E12 salt/ && echo 'Finished PEP-8 Check Cleanly' || echo 'Finished PEP-8 Check With Errors'"
script: "sudo -E /home/travis/virtualenv/python${TRAVIS_PYTHON_VERSION}/bin/python setup.py test --runtests-opts='--run-destructive --sysinfo -v --coverage'"
after_success:
- coveralls
notifications:
irc:
channels: "irc.freenode.org#salt-devel"
on_success: change
on_failure: change
>>>>>>> bdc8d2d196417a4ce9247d5ea9a9770ab5d1adae

View File

@ -48,7 +48,7 @@ def defaults():
def facts(proxy=None):
if proxy is None or proxy['junos.initialized']() is False:
return {}
return {'junos_facts': proxy['junos.grains']()}
return {'junos_facts': proxy['junos.get_serialized_facts']()}
def os_family():

View File

@ -77,16 +77,7 @@ def facts_refresh():
except Exception as exception:
ret['message'] = 'Execution failed due to "{0}"'.format(exception)
ret['out'] = False
ret['facts'] = dict(conn.facts)
ret['facts']['version_info'] = \
dict(ret['facts']['version_info'])
# For backward compatibility. 'junos_info' is present
# only of in newer versions of facts.
if 'junos_info' in ret['facts']:
ret['facts']['junos_info']['re0']['object'] = \
dict(ret['facts']['junos_info']['re0']['object'])
ret['facts']['junos_info']['re1']['object'] = \
dict(ret['facts']['junos_info']['re1']['object'])
ret['facts'] = __proxy__['junos.get_serialized_facts']()
try:
__salt__['saltutil.sync_grains']()
@ -107,19 +98,9 @@ def facts():
salt 'device_name' junos.facts
'''
conn = __proxy__['junos.conn']()
ret = dict()
try:
ret['facts'] = dict(conn.facts)
ret['facts']['version_info'] = \
dict(ret['facts']['version_info'])
# For backward compatibility. 'junos_info' is present
# only of in newer versions of facts.
if 'junos_info' in ret['facts']:
ret['facts']['junos_info']['re0']['object'] = \
dict(ret['facts']['junos_info']['re0']['object'])
ret['facts']['junos_info']['re1']['object'] = \
dict(ret['facts']['junos_info']['re1']['object'])
ret['facts'] = __proxy__['junos.get_serialized_facts']()
ret['out'] = True
except Exception as exception:
ret['message'] = 'Could not display facts due to "{0}"'.format(
@ -157,7 +138,7 @@ def rpc(cmd=None, dest=None, format='xml', **kwargs):
The format in which the rpc reply is received from the device.
(default = xml)
* kwargs: keyworded arguments taken by rpc call like-
* timeout:
* dev_timeout:
Set NETCONF RPC timeout. Can be used for commands which
take a while to execute. (default= 30 seconds)
* filter:
@ -400,8 +381,8 @@ def commit(**kwargs):
except Exception as exception:
ret['out'] = False
ret['message'] = \
'Commit check succeeded but actual commit failed with "{0}"'\
.format(exception)
'Commit check succeeded but actual commit failed with "{0}"' \
.format(exception)
else:
ret['out'] = False
ret['message'] = 'Pre-commit check failed.'
@ -424,7 +405,7 @@ def rollback(id=0, **kwargs):
* id:
The rollback id value [0-49]. (default = 0)
* kwargs: Keyworded arguments which can be provided like-
* timeout:
* dev_timeout:
Set NETCONF RPC timeout. Can be used for commands which
take a while to execute. (default = 30 seconds)
* comment:
@ -440,7 +421,7 @@ def rollback(id=0, **kwargs):
ret = dict()
conn = __proxy__['junos.conn']()
op = dict()
if '__pub_arg' in kwargs:
if kwargs['__pub_arg']:
@ -807,7 +788,7 @@ def install_config(path=None, **kwargs):
ret['out'] = True
if path is None:
ret['message'] =\
ret['message'] = \
'Please provide the salt path where the configuration is present'
ret['out'] = False
return ret
@ -817,7 +798,10 @@ def install_config(path=None, **kwargs):
template_vars = kwargs["template_vars"]
template_cached_path = files.mkstemp()
__salt__['cp.get_template'](path, template_cached_path, template_vars=template_vars)
__salt__['cp.get_template'](
path,
template_cached_path,
template_vars=template_vars)
if not os.path.isfile(template_cached_path):
ret['message'] = 'Invalid file path.'
@ -901,8 +885,13 @@ def install_config(path=None, **kwargs):
check = conn.cu.commit_check()
except Exception as exception:
ret['message'] = \
<<<<<<< HEAD
'Commit check threw the following exception: "{0}"'\
.format(exception)
=======
'Commit check threw the following exception: "{0}"' \
.format(exception)
>>>>>>> bdc8d2d196417a4ce9247d5ea9a9770ab5d1adae
ret['out'] = False
return ret
@ -912,8 +901,13 @@ def install_config(path=None, **kwargs):
ret['message'] = 'Successfully loaded and committed!'
except Exception as exception:
ret['message'] = \
<<<<<<< HEAD
'Commit check successful but commit failed with "{0}"'\
.format(exception)
=======
'Commit check successful but commit failed with "{0}"' \
.format(exception)
>>>>>>> bdc8d2d196417a4ce9247d5ea9a9770ab5d1adae
ret['out'] = False
return ret
else:
@ -1024,9 +1018,9 @@ def install_os(path=None, **kwargs):
try:
conn.sw.reboot()
except Exception as exception:
ret['message'] =\
'Installation successful but reboot failed due to : "{0}"'\
.format(exception)
ret['message'] = \
'Installation successful but reboot failed due to : "{0}"' \
.format(exception)
ret['out'] = False
return ret
ret['message'] = 'Successfully installed and rebooted!'
@ -1068,7 +1062,7 @@ def file_copy(src=None, dest=None, **kwargs):
if dest is None:
ret['message'] = \
'Please provide the absolute path of the destination where the file is to be copied.'
'Please provide the absolute path of the destination where the file is to be copied.'
ret['out'] = False
return ret

View File

@ -39,7 +39,6 @@ from __future__ import absolute_import
# Import python libs
import logging
import copy
# Import 3rd-party libs
try:
@ -123,27 +122,19 @@ def proxytype():
'''
return 'junos'
def grains():
thisproxy['grains'] = dict(thisproxy['conn'].facts)
if thisproxy['grains']:
thisproxy['grains']['version_info'] = dict(
thisproxy['grains']['version_info'])
# For backward compatibility. 'junos_info' is present
# only of in newer versions of facts.
if 'junos_info' in thisproxy['grains']:
thisproxy['grains']['junos_info']['re0']['object'] = \
dict(thisproxy['grains']['junos_info']['re0']['object'])
thisproxy['grains']['junos_info']['re1']['object'] = \
dict(thisproxy['grains']['junos_info']['re1']['object'])
else:
log.debug(
'Grains will not be populated by junos facts \
as the device returned an empty facts dictionary.')
return thisproxy['grains']
def get_serialized_facts():
facts = dict(thisproxy['conn'].facts)
if 'version_info' in facts:
facts['version_info'] = \
dict(facts['version_info'])
# For backward compatibility. 'junos_info' is present
# only of in newer versions of facts.
if 'junos_info' in facts:
facts['junos_info']['re0']['object'] = \
dict(facts['junos_info']['re0']['object'])
facts['junos_info']['re1']['object'] = \
dict(facts['junos_info']['re1']['object'])
return facts
def ping():
'''