Exemple #1
0
 def it_globs_secure_files(self, tmpdir):
     tmpdir.ensure('a/file.1').chmod(0o444)
     tmpdir.ensure('b/file.2').chmod(0o666)
     tmpdir.ensure('c/junk.3').chmod(0o444)
     tmpdir.ensure('d/file.4').chmod(0o644)
     tmpdir.ensure('e/file.4').chmod(0o644)
     tmpdir.join('e').chmod(0o777)
     with tmpdir.as_cwd():
         assert list(configsearch.glob('*/file.*')) == ['a/file.1', 'd/file.4']
Exemple #2
0
 def it_globs_secure_files(self, tmpdir):
     tmpdir.ensure('a/file.1').chmod(0o444)
     tmpdir.ensure('b/file.2').chmod(0o666)
     tmpdir.ensure('c/junk.3').chmod(0o444)
     tmpdir.ensure('d/file.4').chmod(0o644)
     tmpdir.ensure('e/file.4').chmod(0o644)
     tmpdir.join('e').chmod(0o777)
     with tmpdir.as_cwd():
         assert list(
             configsearch.glob('*/file.*')) == ['a/file.1', 'd/file.4']
Exemple #3
0
    def from_glob(self, pattern):
        from pgctl.configsearch import glob
        results = []
        for fname in glob(pattern):
            try:
                config = self.from_file(fname)
            except UnrecognizedConfig:
                continue
            else:
                results.append(config)

        if len(results) == 1:
            return results[0]
        elif len(results) > 1:
            raise AmbiguousConfig('multiple configurations found at %s' % pattern)
Exemple #4
0
    def from_glob(self, pattern):
        from pgctl.configsearch import glob
        results = []
        for fname in glob(pattern):
            try:
                config = self.from_file(fname)
            except UnrecognizedConfig:
                continue
            else:
                results.append(config)

        if len(results) == 1:
            return results[0]
        elif len(results) > 1:
            raise AmbiguousConfig('multiple configurations found at %s' % pattern)