deploy
author Gregory Szorc <gps@mozilla.com>
Wed, 08 Apr 2015 15:33:48 -0700
changeset 360656 8bbac22f6b7c8fafdb86dc956ce51f9af50b2766
permissions -rwxr-xr-x
deploy: implement deploy driver Ansible commands take just enough arguments that typing them all in is annoying. Let's provide a driver script for automating common deployment tasks.

#!/usr/bin/env python
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

import os
import sys

HERE = os.path.abspath(os.path.dirname(__file__))

def main(args):
    if 'VIRTUAL_ENV' not in os.environ:
        activate = os.path.join(HERE, 'venv', 'bin', 'activate_this.py')
        execfile(activate, dict(__file__=activate))
        sys.executable = os.path.join(HERE, 'venv', 'bin', 'python')

    from mach.main import Mach

    m = Mach(os.getcwd())

    m.define_category('deploy', 'Deployment',
                      'Deploy changes to remote servers', 50)
    import vcttesting.deploy_mach_commands

    return m.run(args)


if __name__ == '__main__':
    sys.exit(main(sys.argv[1:]))