summaryrefslogtreecommitdiff
path: root/azurelinuxagent/common/utils/fileutil.py
diff options
context:
space:
mode:
authorƁukasz 'sil2100' Zemczak <lukasz.zemczak@ubuntu.com>2017-01-16 10:10:41 +0100
committerusd-importer <ubuntu-server@lists.ubuntu.com>2017-01-17 17:53:13 +0000
commitdd73af563850762aad64e7ed2a9897377830af10 (patch)
tree33f34ccce29a5a11227741dbe6a8fce20deeeaba /azurelinuxagent/common/utils/fileutil.py
parenta05019d9343d0fde153d75a8e61fb6f99d1d3ff3 (diff)
parent558111e33720eb8f1eaacf571cf4fadae2430286 (diff)
downloadvyos-walinuxagent-dd73af563850762aad64e7ed2a9897377830af10.tar.gz
vyos-walinuxagent-dd73af563850762aad64e7ed2a9897377830af10.zip
Import patches-applied version 2.2.2-0ubuntu1 to applied/ubuntu/zesty-proposed
Imported using git-ubuntu import. Changelog parent: a05019d9343d0fde153d75a8e61fb6f99d1d3ff3 Unapplied parent: 558111e33720eb8f1eaacf571cf4fadae2430286 New changelog entries: * New upstream release (LP: #1651128) - d/patches/fix-auto-update.patch, d/patches/lp1623570-adjust-walinuxagent-service-after-and-wants.patch: - Dropped as changes have been applied upstream - Refreshed debian/patches/disable_import_test.patch
Diffstat (limited to 'azurelinuxagent/common/utils/fileutil.py')
-rw-r--r--azurelinuxagent/common/utils/fileutil.py19
1 files changed, 15 insertions, 4 deletions
diff --git a/azurelinuxagent/common/utils/fileutil.py b/azurelinuxagent/common/utils/fileutil.py
index 7ef4fef..b0b6fb7 100644
--- a/azurelinuxagent/common/utils/fileutil.py
+++ b/azurelinuxagent/common/utils/fileutil.py
@@ -21,11 +21,11 @@
File operation util functions
"""
+import glob
import os
import re
import shutil
import pwd
-import tempfile
import azurelinuxagent.common.logger as logger
from azurelinuxagent.common.future import ustr
import azurelinuxagent.common.utils.textutil as textutil
@@ -111,9 +111,11 @@ def chmod(path, mode):
os.chmod(path, mode)
def rm_files(*args):
- for path in args:
- if os.path.isfile(path):
- os.remove(path)
+ for paths in args:
+ #Find all possible file paths
+ for path in glob.glob(paths):
+ if os.path.isfile(path):
+ os.remove(path)
def rm_dirs(*args):
"""
@@ -169,3 +171,12 @@ def findstr_in_file(file_path, pattern_str):
return None
+def get_all_files(root_path):
+ """
+ Find all files under the given root path
+ """
+ result = []
+ for root, dirs, files in os.walk(root_path):
+ result.extend([os.path.join(root, file) for file in files])
+
+ return result