Created
January 16, 2014 15:41
-
-
Save jlaska/8457025 to your computer and use it in GitHub Desktop.
Convenience script to assemble inventory artifacts from a Jenkins matrix job
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import sys | |
import requests | |
import StringIO | |
from ConfigParser import SafeConfigParser, RawConfigParser, ConfigParser | |
user = 'FIXME' | |
password = 'FIXME' | |
base_url = 'http://50.116.42.103/' | |
job_path = 'job/AWX_Nightly_Install/CLOUD_PROVIDER={cloud_provider},PLATFORM={platform},label={label}/lastBuild/' | |
artifact_path = 'artifact/playbooks/inventory.log/*view*/' | |
cfg = SafeConfigParser() | |
for cloud_provider in ['rax', 'ec2']: | |
for platform in ['rhel-6.4-x86_64', 'centos-6.4-x86_64', 'ubuntu-12.04-x86_64']: | |
for label in ['test']: | |
url = base_url + job_path + artifact_path | |
url = url.format(**dict(cloud_provider=cloud_provider, platform=platform, label=label)) | |
r = requests.get(url, verify=False, auth=(user, password), stream=True) | |
cfg.readfp(StringIO.StringIO(r.text)) | |
if cfg.sections(): | |
cfg.write(sys.stdout) | |
else: | |
print "No usable inventory found." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment