Revision 3b2f6619 image_creator/os_type/__init__.py

b/image_creator/os_type/__init__.py
11 11

  
12 12

  
13 13
class OSBase(object):
14
    """Basic operating system class"""
14 15
    def __init__(self, rootdev, ghandler):
15 16
        self.root = rootdev
16 17
        self.g = ghandler
17 18

  
18 19
    @add_prefix
19 20
    def ls(self, directory):
21
        """List the name of all files under a directory"""
20 22
        return self.g.ls(directory)
21 23

  
22 24
    @add_prefix
23 25
    def find(self, directory):
26
        """List the name of all files recursively under a directory"""
24 27
        return self.g.find(directory)
25 28

  
26 29
    def foreach_file(self, directory, action, **kargs):
30
        """Perform an action recursively on all files under a directory.
27 31

  
32
        The following options are allowed:
33

  
34
        * maxdepth: If defined the action will not be performed on
35
          files that are below this level of directories under the
36
          directory parameter.
37

  
38
        * ftype: The action will only be performed on files of this
39
          type. For a list of all allowed filetypes, see here:
40
          http://libguestfs.org/guestfs.3.html#guestfs_readdir
41

  
42
        * exclude: Exclude all files that follow this pattern.
43
        """
28 44
        maxdepth = None if 'maxdepth' not in kargs else kargs['maxdepth']
29 45
        if maxdepth == 0:
30 46
            return
......
53 69
                action(full_path)
54 70

  
55 71
    def get_metadata(self):
72
        """Returnes some descriptive metadata of the OS."""
56 73
        meta = {}
57 74
        meta["OSFAMILY"] = self.g.inspect_get_type(self.root)
58 75
        meta["OS"] = self.g.inspect_get_distro(self.root)
......
61 78
        return meta
62 79

  
63 80
    def data_cleanup(self):
81
        """Cleanup sesitive data out of the OS image."""
64 82
        raise NotImplementedError
65 83

  
66 84
# vim: set sta sts=4 shiftwidth=4 sw=4 et ai :

Also available in: Unified diff