def ls(self, *paths, **kwargs): verb = kwargs.get('verb', self.verbosity) dryrun = kwargs.get('dry', False) filter = kwargs.get( 'filter', None) # filter with glob pattern, like '*' or '[0-9]' wildcards path = self.expandpath(*paths) retlist = self.execute("%s %s%s" % (self.lscmd, self.lsurl, path), fatal=False, dry=dryrun, verb=verb).split('\n') if retlist and 'No such file or directory' in retlist[0]: LOG.warning(retlist[0]) retlist = [] elif filter: for file in retlist[:]: if not fnmatch(file, filter): retlist.remove(file) return retlist