Exemple #1
0
 def test_validate_instance_throws_on_ec2_instance(self):
     self.params.session = self.session
     self.params.region = self.region
     self.urlopen.side_effect = None
     with self.assertRaisesRegexp(
             RuntimeError, 'Amazon EC2 instances are not supported.'):
         validate_instance(self.params)
Exemple #2
0
 def test_validate_instance_throws_on_unsupported_system(self):
     self.system.return_value = 'Unsupported'
     with self.assertRaisesRegexp(
             RuntimeError,
             'Only Ubuntu Server and Windows Server operating systems are '
             'supported.'):
         validate_instance(self.params)
Exemple #3
0
 def test_validate_instance_throws_on_ec2_instance(self):
     self.params.session = self.session
     self.params.region = self.region
     self.urlopen.side_effect = None
     with self.assertRaisesRegexp(
             RuntimeError, 'Amazon EC2 instances are not supported.'):
         validate_instance(self.params)
Exemple #4
0
 def test_validate_instance_throws_on_unsupported_system(self):
     self.system.return_value = 'Unsupported'
     with self.assertRaisesRegexp(
             RuntimeError,
             'Only Ubuntu Server and Windows Server operating systems are '
             'supported.'):
         validate_instance(self.params)
Exemple #5
0
 def test_validate_instance_windows(self):
     self.urlopen.side_effect = timeout('Not EC2 instance')
     self.system.return_value = 'Windows'
     self.params.session = self.session
     self.params.region = self.region
     validate_instance(self.params)
     self.assertIn('system', self.params)
     self.assertTrue(isinstance(self.params.system, Windows))
Exemple #6
0
 def test_validate_instance_windows(self):
     self.urlopen.side_effect = timeout('Not EC2 instance')
     self.system.return_value = 'Windows'
     self.params.session = self.session
     self.params.region = self.region
     validate_instance(self.params)
     self.assertIn('system', self.params)
     self.assertTrue(isinstance(self.params.system, Windows))
Exemple #7
0
 def test_validate_instance_ubuntu(self):
     self.urlopen.side_effect = timeout('Not EC2 instance')
     self.system.return_value = 'Linux'
     self.linux_distribution.return_value = ('Ubuntu', None, None)
     self.params.session = self.session
     self.params.region = self.region
     validate_instance(self.params)
     self.assertIn('system', self.params)
     self.assertTrue(isinstance(self.params.system, Ubuntu))
Exemple #8
0
 def test_validate_instance_rhel(self):
     self.urlopen.side_effect = timeout('Not EC2 instance')
     self.system.return_value = 'Linux'
     self.linux_distribution.return_value = ('Red Hat Enterprise Linux Server', None, None)
     self.params.session = self.session
     self.params.region = self.region
     validate_instance(self.params)
     self.assertIn('system', self.params)
     self.assertTrue(isinstance(self.params.system, RHEL))
Exemple #9
0
 def test_validate_instance_ubuntu(self):
     self.urlopen.side_effect = timeout('Not EC2 instance')
     self.system.return_value = 'Linux'
     self.linux_distribution.return_value = ('Ubuntu', None, None)
     self.params.session = self.session
     self.params.region = self.region
     validate_instance(self.params)
     self.assertIn('system', self.params)
     self.assertTrue(isinstance(self.params.system, Ubuntu))
Exemple #10
0
 def test_validate_instance_rhel(self):
     self.urlopen.side_effect = timeout('Not EC2 instance')
     self.system.return_value = 'Linux'
     self.linux_distribution.return_value = ('Red Hat Enterprise Linux Server', None, None)
     self.params.session = self.session
     self.params.region = self.region
     validate_instance(self.params)
     self.assertIn('system', self.params)
     self.assertTrue(isinstance(self.params.system, RHEL))
    def _run_main(self, parsed_args, parsed_globals):
        params = parsed_args
        params.session = self._session
        validate_region(params, parsed_globals)
        validate_instance(params)
        params.system.validate_administrator()

        try:
            self._uninstall_agent(params)
            self._delete_config_file(params)
        except Exception as e:
            sys.stdout.flush()
            sys.stderr.write(
                'ERROR\n'
                '{0}\n'
                'Uninstall the AWS CodeDeploy Agent on the on-premises '
                'instance by following the instructions in "Configure '
                'Existing On-Premises Instances by Using AWS CodeDeploy" in '
                'the AWS CodeDeploy User Guide.\n'.format(e))
Exemple #12
0
    def _run_main(self, parsed_args, parsed_globals):
        params = parsed_args
        params.session = self._session
        validate_region(params, parsed_globals)
        validate_instance(params)
        params.system.validate_administrator()

        try:
            self._uninstall_agent(params)
            self._delete_config_file(params)
        except Exception as e:
            sys.stdout.flush()
            sys.stderr.write(
                'ERROR\n'
                '{0}\n'
                'Uninstall the AWS CodeDeploy Agent on the on-premises '
                'instance by following the instructions in "Configure '
                'Existing On-Premises Instances by Using AWS CodeDeploy" in '
                'the AWS CodeDeploy User Guide.\n'.format(e)
            )
Exemple #13
0
    def _run_main(self, parsed_args, parsed_globals):
        params = parsed_args
        params.session = self._session
        validate_region(params, parsed_globals)
        validate_instance(params)
        params.system.validate_administrator()
        self._validate_override_config(params)
        self._validate_agent_installer(params)

        try:
            self._create_config(params)
            self._install_agent(params)
        except Exception as e:
            sys.stdout.flush()
            sys.stderr.write(
                'ERROR\n'
                '{0}\n'
                'Install the AWS CodeDeploy Agent on the on-premises instance '
                'by following the instructions in "Configure Existing '
                'On-Premises Instances by Using AWS CodeDeploy" in the AWS '
                'CodeDeploy User Guide.\n'.format(e))
            return 255
        return 0
Exemple #14
0
 def test_validate_instance_throws_on_unsupported_system(self):
     self.system.return_value = 'Unsupported'
     with self.assertRaisesRegexp(RuntimeError,
                                  System.UNSUPPORTED_SYSTEM_MSG):
         validate_instance(self.params)
Exemple #15
0
 def test_validate_instance_throws_on_unsupported_system(self):
     self.system.return_value = 'Unsupported'
     with self.assertRaisesRegexp(
             RuntimeError, System.UNSUPPORTED_SYSTEM_MSG):
         validate_instance(self.params)