コード例 #1
0
def amazon_linux_test_battery():
    
    # create config helper
    ConfHelper = ConfigHelper(CONFIG_DIR, TEMPLATE_DIR) 
        
    # launch ec2
    ec2_conf = ConfHelper.get_config('test_amazon_linux')
    ec2_instance, ec2_connection = launch_new_ec2(ec2_conf, True)
    
    # do fab stuff to ec2 instance
    amzn_linux_fab = AmazonLinuxFab(ec2_conf, ec2_instance.public_dns_name)
    amzn_linux_fab.set_timezone('/usr/share/zoneinfo/America/Los_Angeles')
    amzn_linux_fab.update_system()
    amzn_linux_fab.install_custom_monitoring()
    amzn_linux_fab.install_git()
    amzn_linux_fab.install_jdk()
    amzn_linux_fab.install_maven()
    amzn_linux_fab.install_node()
    
    # pg setup
    init_sql_filename = 'init_test_db.sql'
    init_sql_path = os.path.join(TEMPLATE_DIR, init_sql_filename)
    amzn_linux_fab.install_pg(init_sql_path, init_sql_filename)

    # Terminate EC2 instance.
    tear_down(ec2_instance.id, ec2_connection)
コード例 #2
0
def centos6_test_battery():
    
    # create config helper
    ConfHelper = ConfigHelper(CONFIG_DIR, TEMPLATE_DIR) 
        
    # launch ec2
    ec2_conf = ConfHelper.get_config('test_centos6')
    ec2_instance, ec2_connection = launch_new_ec2(ec2_conf, True)
    
    # do fab stuff to ec2 instance
    centos6_fab = CentOS6Fab(ec2_conf, ec2_instance.public_dns_name)
    centos6_fab.set_timezone('/usr/share/zoneinfo/America/Los_Angeles')
    centos6_fab.update_system()
    centos6_fab.install_helpers()
    centos6_fab.setup_iptables_for_port()
    centos6_fab.install_git()
    centos6_fab.install_jdk()
    centos6_fab.install_maven()
    centos6_fab.install_node()
    
    # pg setup
    init_sql_filename = 'init_test_db.sql'
    init_sql_path = os.path.join(TEMPLATE_DIR, init_sql_filename)
    centos6_fab.install_postgis('test_db', init_sql_path, init_sql_filename)

    # Terminate EC2 instance.
    tear_down(ec2_instance.id, ec2_connection)
コード例 #3
0
class TestConfigHelper(TestCase):

    def setUp(self):
        self.conf_helper = ConfigHelper(CONFIG_DIR, TEMPLATE_DIR)
        self.conf_file = os.path.join(CONFIG_DIR, 'test_conf_helper.ini')
        try:
            os.remove(self.conf_file)
        except:
            pass

    def tearDown(self):

        for file_to_remove in [self.conf_file,
                               os.path.join(CONFIG_DIR, 'test_conf_helper_out.ini')]:
            try:
                os.remove(file_to_remove)
            except:
                pass

    def test_get_config(self):

        with open(self.conf_file, 'w') as f:
            f.write("[DEFAULT]\ntest_key = {test_val}")

        conf = self.conf_helper.get_config('test_conf_helper')
        assert isinstance(conf, DefaultConfig)
        assert '{test_val}' == conf.get('test_key')

    def test_setup(self):

        deploy_utils.config.input = lambda _: 'blah'
        self.conf_helper.setup('test_conf_helper')

        assert os.path.exists(self.conf_file)
        with open(self.conf_file) as f:
            contents = f.read()
            assert 'test_key = blah' in contents

    def test_write_template(self):

        for outfilename in [None, 'test_conf_helper_out.ini']:
            self.conf_helper.write_template(dict(test_key='blah blah'),
                                            'test_conf_helper.ini',
                                            outfilename)

            if outfilename is None:
                outfilename = 'test_conf_helper.ini'

            outpath = os.path.join(CONFIG_DIR, outfilename)

            assert os.path.exists(outpath)
            with open(outpath) as f:
                contents = f.read()
                assert 'test_key = blah blah' in contents
コード例 #4
0
ファイル: config.py プロジェクト: evansiroky/oba_deployer
def setup(config_type):
    """Master function for setting up each config type
    """

    # create config dir if not exists
    try:
        os.makedirs(CONFIG_DIR)
    except:
        pass

    conf = ConfigHelper(CONFIG_DIR, CONFIG_TEMPLATE_DIR)
    conf.setup(config_type)
コード例 #5
0
ファイル: ec2_base.py プロジェクト: evansiroky/deploy_utils
 def setUp(self):
     '''Create a new EC2 instance.'''
     
     if not self.conf_type:
         raise Exception('Conf Path Must Be Set')
     
     ConfHelper = ConfigHelper(CONFIG_DIR, TEMPLATE_DIR) 
     
     self.ec2_conf = ConfHelper.get_config(self.conf_type)
     ec2_instance, ec2_connection = launch_new_ec2(self.ec2_conf, True)
     self.ec2_instance = ec2_instance
     self.ec2_connection = ec2_connection
コード例 #6
0
 def setUp(self):
     self.conf_helper = ConfigHelper(CONFIG_DIR, TEMPLATE_DIR)
     self.conf_file = os.path.join(CONFIG_DIR, 'test_conf_helper.ini')
     try:
         os.remove(self.conf_file)
     except:
         pass