def get_environment_id(default_ccv):
translation_table = string.maketrans('-','_')
CONVERT_CCV = DEFAULT_CONTENT_VIEW.translate(translation_table)
CONVERT_ORGANIZATION = ORGANIZATION.translate(translation_table)
PUPPET_ENV = str("KT_" + CONVERT_ORGANIZATION + "_" + ENVIRONMENT + "_" + CONVERT_CCV)
cmd_get_environment_id = hammer_cmd + " --csv environment list"
try:
perform_cmd = subprocess.Popen(cmd_get_environment_id, shell=True, stdout=subprocess.PIPE)
puppet_env_id = perform_cmd.stdout.read()
for line in islice(puppet_env_id.strip().split("\n"), 1, None): # print output without CSV header
if PUPPET_ENV in line:
return line.split(",")[0]
break
except:
print log.ERROR + "ERROR: Puppet environment id not found. Please ensure that the Puppet environment " + PUPPET_ENV + " is configured properly in Satellite." + log.END
sys.exit(1)
satellite6-automation.py 文件源码
python
阅读 27
收藏 0
点赞 0
评论 0
评论列表
文章目录