Revision ce66ae38

b/image_creator/os_type/__init__.py
85 85
        self.out = output
86 86
        self.meta = {}
87 87

  
88
        # Many guestfs compilations don't support scrub
89
        self._scrub_support = True
90
        try:
91
            self.g.available(['scrub'])
92
        except RuntimeError:
93
            self._scrub_support = False
94

  
88 95
    def collect_metadata(self):
89 96
        """Collect metadata about the OS"""
90 97
        try:
b/image_creator/os_type/unix.py
139 139
            self.out.output("Removing sensitive user data under %s" %
140 140
                            " ".join(homedirs))
141 141

  
142
        action = self.g.rm_rf
143
        if self._scrub_support:
144
            action = self.g.scrub_file
145
        else:
146
            self.out.warn("Sensitive data won't be scrubbed (not supported)")
142 147
        for homedir in homedirs:
143 148
            for data in self.sensitive_userdata:
144 149
                fname = "%s/%s" % (homedir, data)
145 150
                if self.g.is_file(fname):
146
                    self.g.scrub_file(fname)
151
                    action(fname)
147 152
                elif self.g.is_dir(fname):
148
                    self._foreach_file(fname, self.g.scrub_file, ftype='r')
153
                    self._foreach_file(fname, action, ftype='r')
149 154

  
150 155
# vim: set sta sts=4 shiftwidth=4 sw=4 et ai :

Also available in: Unified diff