{ "info": { "author": "Sym Roe", "author_email": "sym.roe@democracyclub.org.uk", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Environment :: Other Environment", "Intended Audience :: Developers", "Intended Audience :: System Administrators", "License :: OSI Approved :: MIT License", "Operating System :: POSIX", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Topic :: Software Development :: Libraries :: Python Modules", "Topic :: System :: Systems Administration", "Topic :: Utilities" ], "description": "# EC2 Tag conditionals\n[![CircleCI](https://circleci.com/gh/DemocracyClub/ec2-tag-conditional/tree/master.svg?style=svg)](https://circleci.com/gh/DemocracyClub/ec2-tag-conditional/tree/master)\n[![Coverage Status](https://coveralls.io/repos/github/DemocracyClub/ec2-tag-conditional/badge.svg?branch=master)](https://coveralls.io/github/DemocracyClub/ec2-tag-conditional?branch=master)\n\n\n\nThis is a python library and shell command that answers the question:\n\n\"Is this instance tagged with the given tag and have a given value\"\n\nIt is designed to be run on AWS's EC2 instances.\n\nIt will always fail if it's not on AWS, so tags should only be tested for\ntruthiness, not falseness.\n\n\n\n## As a Library\n\n\n```python\n\nfrom ec2_tag_conditional import InstanceTags\n\ntags = InstanceTags()\n\nif tags['Env'] == 'prod':\n do_prod_thing()\n else:\n do_other_thing()\n\n```\n\n\n## As a command line script\n\n```shell\n\n> instance-tags \"Env=prod\"\n> echo $?\n0\n\n> instance-tags \"Madeup=NotThere\"\n> echo $?\n1\n\n> instance-tags \"Env=prod\" && do_prod_thing\n\n```\n\n## Example use cases\n\nThis code was written with the following use case in mind:\n\nYou have `n` servers in a auto scaling group, launched from a custom\nAMI (golden image). The nature of the application running on the\nservers is that, for some functions to work (backup, reporting),\na given set of tasks should only be run by one server.\n\nThis server is called a 'controller'. The script that created the ASG\nalso tags (in the AWS metadata) one (and only one) of the servers\nwith `controller=True`.\n\nWhen the AMI is baked, the images don't need to know if they are a\ncontroller or not, as cron tasks can be written like:\n\n`instance-tags \"controller=True\" && do_controller_only`\n\nOr for controllers in production (rather than dev or staging\nenvironments):\n\n`instance-tags \"controller=True\" && instance-tags \"Env=prod\" && do_controller_only`\n\nBecause the exit code of the `instance-tags` script is 1 if the tag\nwith the given value isn't found on the instance, the script wont\nrun on any server that isn't an EC2 instance with the given values.\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "ec2_tag_conditional", "package_url": "https://pypi.org/project/ec2_tag_conditional/", "platform": "", "project_url": "https://pypi.org/project/ec2_tag_conditional/", "project_urls": null, "release_url": "https://pypi.org/project/ec2_tag_conditional/0.1.2/", "requires_dist": [ "boto" ], "requires_python": ">=2.7", "summary": "Tests for EC2 tags", "version": "0.1.2" }, "last_serial": 4179415, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "5e5a7cfd00a1acd84000c497d326bed6", "sha256": "bddd77fe67dba70806fad1890befcaebd753d3ae9dca265878d9becaa2b31691" }, "downloads": -1, "filename": "ec2_tag_conditional-0.1.0.tar.gz", "has_sig": false, "md5_digest": "5e5a7cfd00a1acd84000c497d326bed6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3326, "upload_time": "2018-08-10T10:04:52", "url": "https://files.pythonhosted.org/packages/94/58/f74dcc6615d9b1b025df288458263fe1f2040987a0c5158ac831768bb1bd/ec2_tag_conditional-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "358ed160f65aa394be6f52639fd1800f", "sha256": "a53910a101f04488facb98c96dbc91fd75fb85366741bb9756110da48c719358" }, "downloads": -1, "filename": "ec2_tag_conditional-0.1.1-py3-none-any.whl", "has_sig": false, "md5_digest": "358ed160f65aa394be6f52639fd1800f", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6", "size": 3585, "upload_time": "2018-08-10T10:20:09", "url": "https://files.pythonhosted.org/packages/fc/11/e89a6e1151b83bead1546d80a37dfe10e7a7cdc2010e171f212967576ae4/ec2_tag_conditional-0.1.1-py3-none-any.whl" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "573d37259b7542eb8326738917721f25", "sha256": "d3f9c273a7f5c8af05a7dfec3e4c8b4a18435390dbd309c8934096a2bef57ded" }, "downloads": -1, "filename": "ec2_tag_conditional-0.1.2-py3-none-any.whl", "has_sig": false, "md5_digest": "573d37259b7542eb8326738917721f25", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=2.7", "size": 3589, "upload_time": "2018-08-17T09:02:00", "url": "https://files.pythonhosted.org/packages/6e/b7/416d97784625acbb64b7d9855fbcf25b13299138c51c265b2eedb2ed9409/ec2_tag_conditional-0.1.2-py3-none-any.whl" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "573d37259b7542eb8326738917721f25", "sha256": "d3f9c273a7f5c8af05a7dfec3e4c8b4a18435390dbd309c8934096a2bef57ded" }, "downloads": -1, "filename": "ec2_tag_conditional-0.1.2-py3-none-any.whl", "has_sig": false, "md5_digest": "573d37259b7542eb8326738917721f25", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=2.7", "size": 3589, "upload_time": "2018-08-17T09:02:00", "url": "https://files.pythonhosted.org/packages/6e/b7/416d97784625acbb64b7d9855fbcf25b13299138c51c265b2eedb2ed9409/ec2_tag_conditional-0.1.2-py3-none-any.whl" } ] }