diff --git a/.eggs/README.txt b/.eggs/README.txt new file mode 100644 index 0000000..5d01668 --- /dev/null +++ b/.eggs/README.txt @@ -0,0 +1,6 @@ +This directory contains eggs that were downloaded by setuptools to build, test, and run plug-ins. + +This directory caches those eggs to prevent repeated downloads. + +However, it is safe to delete this directory. + diff --git a/bootstrap_cfn/config.py b/bootstrap_cfn/config.py index 42b2011..18e9562 100644 --- a/bootstrap_cfn/config.py +++ b/bootstrap_cfn/config.py @@ -81,8 +81,9 @@ def process(self): data.update(s3) for i in elb: data.update(i) - for k,v in elb_sgs.items(): - data[k] = v + if 'elb_sgs' in locals(): + for k, v in elb_sgs.items(): + data[k] = v template = json.loads(pkgutil.get_data('bootstrap_cfn', 'stacks/base.json')) template['Resources'] = data diff --git a/tests/test.py b/tests/test.py index 6c92dfb..7a7fbf8 100644 --- a/tests/test.py +++ b/tests/test.py @@ -173,7 +173,7 @@ def test_stack_wait_for_stack_not_done(self): with self.assertRaises(errors.CfnTimeoutError): print cloudformation.Cloudformation( self.env.aws_profile).wait_for_stack_done(self.stack_name, 1, 1) - + def test_wait_for_stack_done(self): stack_evt_mock = mock.Mock() rt = mock.PropertyMock(return_value='AWS::CloudFormation::Stack') @@ -484,7 +484,7 @@ def test_is_ssh_up(self): mock_client = mock.Mock() mock_config = {'connect.side_effect':AuthenticationException} mock_client.configure_mock(**mock_config) - mock_p.return_value = mock_client + mock_p.return_value = mock_client paramiko.SSHClient = mock_p self.assertTrue(ssh.is_ssh_up('1.1.1.1')) @@ -493,7 +493,7 @@ def test_is_ssh_not_up(self): mock_client = mock.Mock() mock_config = {'connect.side_effect':socket.error} mock_client.configure_mock(**mock_config) - mock_p.return_value = mock_client + mock_p.return_value = mock_client paramiko.SSHClient = mock_p self.assertFalse(ssh.is_ssh_up('1.1.1.1')) diff --git a/tests/tests.py b/tests/tests.py index 47ac715..6a16a1f 100644 --- a/tests/tests.py +++ b/tests/tests.py @@ -238,6 +238,15 @@ def test_elb(self): elb_cfg, elb_sgs = config.elb() compare(known, elb_cfg) + def test_elb_no_sgs(self): + from testfixtures import compare + project_config = ProjectConfig('tests/sample-project.yaml', 'dev') + # Assuming there's no ELB defined + project_config.config.pop('elb') + project_config.config.pop('rds') + config = ConfigParser(project_config.config, 'my-stack-name') + config.process() + def test_elb_missing_cert(self): from testfixtures import compare