summaryrefslogtreecommitdiff
path: root/tests/charmhelpers/core/host.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/charmhelpers/core/host.py')
-rw-r--r--tests/charmhelpers/core/host.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/charmhelpers/core/host.py b/tests/charmhelpers/core/host.py
index 322ab2a..e9fd38a 100644
--- a/tests/charmhelpers/core/host.py
+++ b/tests/charmhelpers/core/host.py
@@ -972,6 +972,20 @@ def is_container():
972 972
973 973
974def add_to_updatedb_prunepath(path, updatedb_path=UPDATEDB_PATH): 974def add_to_updatedb_prunepath(path, updatedb_path=UPDATEDB_PATH):
975 """Adds the specified path to the mlocate's udpatedb.conf PRUNEPATH list.
976
977 This method has no effect if the path specified by updatedb_path does not
978 exist or is not a file.
979
980 @param path: string the path to add to the updatedb.conf PRUNEPATHS value
981 @param updatedb_path: the path the updatedb.conf file
982 """
983 if not os.path.exists(updatedb_path) or os.path.isdir(updatedb_path):
984 # If the updatedb.conf file doesn't exist then don't attempt to update
985 # the file as the package providing mlocate may not be installed on
986 # the local system
987 return
988
975 with open(updatedb_path, 'r+') as f_id: 989 with open(updatedb_path, 'r+') as f_id:
976 updatedb_text = f_id.read() 990 updatedb_text = f_id.read()
977 output = updatedb(updatedb_text, path) 991 output = updatedb(updatedb_text, path)