mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
import gate elementtree in artifactory module
This commit is contained in:
parent
f20f3f697b
commit
e321d60002
1 changed files with 19 additions and 1 deletions
|
@ -7,7 +7,6 @@ Module for fetching artifacts from Artifactory
|
|||
from __future__ import absolute_import
|
||||
import os
|
||||
import base64
|
||||
import xml.etree.ElementTree as ET
|
||||
import logging
|
||||
|
||||
# Import Salt libs
|
||||
|
@ -16,8 +15,27 @@ import salt.ext.six.moves.http_client # pylint: disable=import-error,redefined-
|
|||
from salt.ext.six.moves import urllib # pylint: disable=no-name-in-module
|
||||
from salt.ext.six.moves.urllib.error import HTTPError, URLError # pylint: disable=no-name-in-module
|
||||
|
||||
# Import 3rd party libs
|
||||
try:
|
||||
from salt._compat import ElementTree as ET
|
||||
HAS_ELEMENT_TREE = True
|
||||
except ImportError:
|
||||
HAS_ELEMENT_TREE = False
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
__virtualname__ = 'artifactory'
|
||||
|
||||
|
||||
def __virtual__():
|
||||
'''
|
||||
Only load if elementtree xml library is available.
|
||||
'''
|
||||
if not HAS_ELEMENT_TREE:
|
||||
return (False, 'Cannot load {0} module: ElementTree library unavailable'.format(__virtualname__))
|
||||
else:
|
||||
return True
|
||||
|
||||
|
||||
def get_latest_snapshot(artifactory_url, repository, group_id, artifact_id, packaging, target_dir='/tmp', target_file=None, classifier=None, username=None, password=None):
|
||||
'''
|
||||
|
|
Loading…
Add table
Reference in a new issue