4 from PyJobTransforms.trfExceptions
import TransformAMIException
8 msg = logging.getLogger(__name__)
15 import pyAMI.exception
16 except ImportError
as e:
17 raise TransformAMIException(AMIerrorCode,
'Import of pyAMI modules failed ({0})'.
format(e))
22 except pyAMI.exception.Error
as e:
23 msg.warning(
'An exception occured when connecting to primary AMI: {0}'.
format(e))
24 msg.error(
'Exception: {0}'.
format(e))
25 if 'please login' in e.message
or 'certificate expired' in e.message:
26 raise TransformAMIException(AMIerrorCode,
'Getting tag info from AMI failed with credential problem. '
27 'Please check your AMI account status.')
28 if 'Invalid amiTag' in e.message:
29 raise TransformAMIException(AMIerrorCode,
'Invalid AMI tag ({0}).'.
format(tag))
31 msg.error(
"Error may not be fatal - will try AMI replica catalog")
33 build, version = result[0][
"SWReleaseCache"].
split(
"_")
37 folder_path = os.path.dirname(os.path.realpath(__file__))
38 command = f
"{folder_path}/get_generator_versions.sh {build} {version} {tag}"
40 output, error = subprocess.Popen([
"/bin/bash",
"-c", command], stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()
41 output, error = output.decode(
"utf-8"), error.decode(
"utf-8")
43 error = [l
for l
in error.strip().
split(
"\n")
if l
and "manpath" not in l]
45 output = output.strip()