From 9332388879ff54659531ec8f324ade049efef62f Mon Sep 17 00:00:00 2001 From: John Jarvis <john@jarv.org> Date: Fri, 24 Jan 2014 13:27:41 -0500 Subject: [PATCH] creating arg for configuration-secure and adding role path --- playbooks/edx-east/ansible.cfg | 1 - playbooks/edx-east/ansible.cfg | 10 ++++++++++ util/vpc-tools/abbey.py | 22 +++++++++++++--------- 3 files changed, 23 insertions(+), 10 deletions(-) delete mode 120000 playbooks/edx-east/ansible.cfg create mode 100644 playbooks/edx-east/ansible.cfg diff --git a/playbooks/edx-east/ansible.cfg b/playbooks/edx-east/ansible.cfg deleted file mode 120000 index 61278e8..0000000 --- a/playbooks/edx-east/ansible.cfg +++ /dev/null @@ -1 +0,0 @@ -../ansible.cfg \ No newline at end of file diff --git a/playbooks/edx-east/ansible.cfg b/playbooks/edx-east/ansible.cfg new file mode 100644 index 0000000..68c89f7 --- /dev/null +++ b/playbooks/edx-east/ansible.cfg @@ -0,0 +1,10 @@ +# config file for ansible -- http://ansible.github.com +# nearly all parameters can be overridden in ansible-playbook or with command line flags +# ansible will read ~/.ansible.cfg or /etc/ansible/ansible.cfg, whichever it finds first + +[defaults] + +jinja2_extensions=jinja2.ext.do +hash_behaviour=merge +host_key_checking=False +roles_path=../../../ansible-roles diff --git a/util/vpc-tools/abbey.py b/util/vpc-tools/abbey.py index 497e850..74e4724 100644 --- a/util/vpc-tools/abbey.py +++ b/util/vpc-tools/abbey.py @@ -61,7 +61,7 @@ class MongoConnection: } try: self.mongo_ami.insert(query) - except DuplicateKeyError as e: + except DuplicateKeyError: if not args.noop: print "Entry already exists for {}".format(ami) raise @@ -71,11 +71,11 @@ class MongoConnection: Adds the built AMI to the deployment collection """ - query = { '_id': args.jenkins_build } + query = {'_id': args.jenkins_build} deployment = self.mongo_deployment.find_one(query) try: deployment['plays'][args.play]['amis'][args.environment] = ami - except KeyError as e: + except KeyError: msg = "Unexpected document structure, couldn't write " +\ "to path deployment['plays']['{}']['amis']['{}']" print msg.format(args.play, args.environment) @@ -95,6 +95,7 @@ class MongoConnection: self.mongo_deployment.save(deployment) + class Unbuffered: """ For unbuffered output, not @@ -121,8 +122,8 @@ def parse_args(): parser.add_argument('--secure-vars', required=False, metavar="SECURE_VAR_FILE", help="path to secure-vars from the root of " - "configuration-secure, defaults to ansible/" - "vars/DEPLOYMENT/ENVIRONMENT-DEPLOYMENT.yml") + "the secure repo (defaults to ansible/" + "vars/DEPLOYMENT/ENVIRONMENT-DEPLOYMENT.yml)") parser.add_argument('--stack-name', help="defaults to ENVIRONMENT-DEPLOYMENT", metavar="STACK_NAME", @@ -149,6 +150,9 @@ def parse_args(): parser.add_argument('--configuration-secure-version', required=False, help="configuration-secure repo branch(no hashes)", default="master") + parser.add_argument('--configuration-secure-repo', required=False, + default="git@github.com:edx-ops/prod-secure", + help="repo to use for the secure files") parser.add_argument('-j', '--jenkins-build', required=False, help="jenkins build number to update") parser.add_argument('-b', '--base-ami', required=False, @@ -271,9 +275,8 @@ instance_type=\\ $(curl http://169.254.169.254/latest/meta-data/instance-type 2>/dev/null) playbook_dir="$base_dir/configuration/playbooks/edx-east" git_repo_name="configuration" -git_repo_secure_name="configuration-secure" git_repo="https://github.com/edx/$git_repo_name" -git_repo_secure="git@github.com:edx/$git_repo_secure_name" +git_repo_secure="{configuration_secure_repo}" if $config_secure; then git_cmd="env GIT_SSH=$git_ssh git" @@ -349,6 +352,7 @@ rm -rf $base_dir """.format( configuration_version=args.configuration_version, configuration_secure_version=args.configuration_secure_version, + configuration_secure_repo=args.configuration_secure_repo, environment=args.environment, deployment=args.deployment, play=args.play, @@ -433,7 +437,7 @@ def poll_sqs_ansible(): to_disp['msg']['TS'] % 60, to_disp['msg']['PREFIX'], to_disp['msg']['START']), - + elif 'TASK' in to_disp['msg']: print "\n{:0>2.0f}:{:0>5.2f} {} : {}".format( to_disp['msg']['TS'] / 60, @@ -472,7 +476,7 @@ def poll_sqs_ansible(): to_disp['msg']['TS'] / 60, to_disp['msg']['TS'] % 60, to_disp['msg']['PREFIX']) - + # Since 3 ansible plays get run. # We see the COMPLETE message 3 times # wait till the last one to end listening -- libgit2 0.26.0