Changeset 1423 for trunk


Ignore:
Timestamp:
Oct 29, 2008, 12:44:46 AM (16 years ago)
Author:
price
Message:

use run-parts semantics in conf.d directory

Location:
trunk/packages/invirt-base
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/packages/invirt-base/debian/changelog

    r1422 r1423  
    44    invirt-getconf, so we can do what follows
    55  * look in /etc/invirt/conf.d/ as well as /etc/invirt/master.yaml
    6 
    7  -- Greg Price <price@mit.edu>  Tue, 28 Oct 2008 21:16:14 -0400
     6  * use run-parts semantics in /etc/invirt/conf.d/
     7
     8 -- Greg Price <price@mit.edu>  Wed, 29 Oct 2008 00:10:36 -0400
    89
    910invirt-base (0.0.1) unstable; urgency=low
  • trunk/packages/invirt-base/python/invirt/config.py

    r1422 r1423  
    88from contextlib import closing
    99import yaml
     10import re
    1011
    1112try:    loader = yaml.CSafeLoader
     
    3435    return d1
    3536
     37def run_parts_list(dirname):
     38    """Reimplements Debian's run-parts --list.
     39
     40    One difference from run-parts's behavior: run-parts --list /foo/
     41    will give output like /foo//bar, because Python code tends to expect this.
     42
     43    Matches documented behavior of run-parts in debianutils v2.28.2, dated 2007.
     44    """
     45    # From run-parts(8).
     46    lanana_re   = re.compile('^[a-z0-9]+$')
     47    lsb_re      = re.compile('^_?([a-z0-9_.]+-)+[a-z0-9]+$')
     48    deb_cron_re = re.compile('^[a-z0-9][a-z0-9-]*$')
     49    for name in os.listdir(dirname):
     50        if lanana_re.match(name) or lsb_re.match(name) or deb_cron_re.match(name):
     51            yield os.path.join(dirname, name)
     52
    3653def list_files():
    3754    yield src_path
    38     for name in os.listdir(src_dirpath):
    39         yield os.path.join(src_dirpath, name)
     55    for name in run_parts_list(src_dirpath):
     56        yield name
    4057
    4158def load_master():
Note: See TracChangeset for help on using the changeset viewer.