示例#1
0
    def test_load_yaml_with_yaml_error(self):
        tmpdir = py.test.ensuretemp('invalid_yaml_test')
        invalid_yaml_file = tmpdir.join('docker-compose.yml')
        invalid_yaml_file.write("""
            web:
              this is bogus: ok: what
        """)
        with pytest.raises(ConfigurationError) as exc:
            config.load_yaml(str(invalid_yaml_file))

        assert 'line 3, column 32' in exc.exconly()
示例#2
0
    def test_load_yaml_with_yaml_error(self):
        tmpdir = py.test.ensuretemp('invalid_yaml_test')
        invalid_yaml_file = tmpdir.join('docker-compose.yml')
        invalid_yaml_file.write("""
            web:
              this is bogus: ok: what
        """)
        with pytest.raises(ConfigurationError) as exc:
            config.load_yaml(str(invalid_yaml_file))

        assert 'line 3, column 32' in exc.exconly()
示例#3
0
 def _load(self, filename):
     working_dir = path.dirname(filename)
     loaded = config.load_yaml(filename)
     return config.load(config.find(working_dir, [path.basename(filename)]))
$
$V$]∞qх5Б_–
¤¤¤¤
$
$V$]∞qх5Б_–
"¤¤¤¤
$
$V$]∞q"х
"        long_running_services = al5Б_–=¤¤¤¤
$
$V$]∞q*х
=        long_running_services = self._remove_oneshot_services5Б_–.¤¤¤¤
$
$V$]∞q/хJ    def _remove_oneshot_services(long_running_services, oneshot_services):5Б_–¤¤¤¤
$
$V$]∞q4х1            long_running_services.remove(service)5Б_–>¤¤¤¤
$
$V$]∞q;х
?        long_running_services = self._remove_oneshot_services()5Б_–K¤¤¤¤
$
$V$]∞qHх
M        long_running_services = self._remove_oneshot_services(all_services, )х5Б_–`¤¤¤¤
$
$V$]∞qIх!from compose.config import configclass MinaryDockerCompose:)    def __init__(self, compose_filename):0        self.compose_filename = compose_filename$    def get_names_of_services(self):>        compose_dict = config.load_yaml(self.compose_filename)<        all_services = list(compose_dict["services"].keys())b        long_running_services = self._remove_oneshot_services(all_services, ["bootup_controller"])        return     @staticmethod=    def _remove_oneshot_services(services, oneshot_services):(        for service in oneshot_services:$            services.remove(service)5Б_–¤¤¤¤$$V$]∞qLх
        return5Б_–"¤¤¤¤$$V$]∞qzх	$    def get_names_of_services(self):5Б_–$¤¤¤¤$$V$]∞qГх	&    def get_names_of_services(self, ):5Б_–¤¤¤¤$$V$]∞qНх
/            all_services, ["bootup_controller"]5Б_–¤¤¤¤$$V$]∞qНх
            all_services, 5Б_– ¤¤¤¤$$V$]∞qнх
>        long_running_services = self._remove_oneshot_services(5Б_–¤¤¤¤$$V$]∞qрх!from compose.config import configclass MinaryDockerCompose:)    def __init__(self, compose_filename):0        self.compose_filename = compose_filename6    def get_names_of_services(self, oneshot_services):>        compose_dict = config.load_yaml(self.compose_filename)<        all_services = list(compose_dict["services"].keys())&        self._remove_oneshot_services(*            all_services, oneshot_services	        )$        return long_running_services    @staticmethod=    def _remove_oneshot_services(services, oneshot_services):(        for service in oneshot_services:$            services.remove(service)5Б_–<¤¤¤¤$$V$]∞rх        х5Б_–¤¤¤¤$$V$]∞rх
        servi5Б_– ¤¤¤¤$$V$]∞rх
$        return long_running_services5Б_– ¤¤¤¤$$V$]∞rх
        return 5Б_– ¤¤¤¤$$V$]∞quх        х        self5Бз™
示例#5
0
def read_services_from_compose_yaml(file):
    from compose.config import config
    out = config.load_yaml(file)
    # from beeprint import pp
    # pp(out)
    return out