Exemplo n.º 1
0
def make_container_fs_handler(pathconfig):
    """
    Factory function for making ContainerFSHandler. Uses the current project
    directory to retrieve all paths and info about whether certain files exist.
    :param pathconfig: PathConfig: Holds path/existence info
    :return: ContainerFSHandler
    """

    dockerrun_dict = dockerrun.get_dockerrun(pathconfig.dockerrun_path())
    return ContainerFSHandler(pathconfig=pathconfig, dockerrun=dockerrun_dict)
Exemplo n.º 2
0
    def do_command(self):
        dockerrun_location = os.path.join(os.getcwd(), DOCKERRUN_FILENAME)
        v1_json = dockerrun.get_dockerrun(dockerrun_location)
        if not v1_json:
            raise NotFoundError(
                'Dockerrun.aws.json file not found in current directory.')
        if v1_json['AWSEBDockerrunVersion'] == 2:
            raise NotSupportedError('Dockerrun file already at version 2')

        fileoperations.write_json_dict(v1_json, dockerrun_location + '_backup')
        io.echo('Version 1 file saved as Dockerrun.aws.json_backup.')

        v2_json = get_dockerrun_v2(v1_json)
        fileoperations.write_json_dict(v2_json, dockerrun_location)
        io.echo('Dockerrun.aws.json successfully converted to Version 2.')

        io.echo()
        io.echo('To change your default platform, type "eb platform select".')
Exemplo n.º 3
0
def smells_of_multi_container_docker():
    dockerrun_file = dockerrun.get_dockerrun('Dockerrun.aws.json')
    if dockerrun_file and dockerrun_file.get('AWSEBDockerrunVersion') in (2,
                                                                          '2'):
        return True
Exemplo n.º 4
0
def smells_of_multi_container_docker():
    dockerrun_file = dockerrun.get_dockerrun('Dockerrun.aws.json')
    if dockerrun_file and dockerrun_file.get('AWSEBDockerrunVersion') in (2, '2'):
        return True
Exemplo n.º 5
0
 def test_get_dockerrun_ioerror_case(self, get_json_dict):
     get_json_dict.side_effect = IOError
     self.assertIsNone(dr.get_dockerrun(MOCK_DOCKERRUN_PATH))
Exemplo n.º 6
0
 def test_get_dockerrun_happy_case(self, get_json_dict):
     get_json_dict.return_value = {}
     self.assertEqual({}, dr.get_dockerrun(MOCK_DOCKERRUN_PATH))