Sync charm-helpers to ensure Rocky support
Change-Id: I497ca6e056d5a0d1f0456ef351c247f1ba0bc0b0
This commit is contained in:
parent
3f01d3d5cb
commit
37e4bd5896
|
@ -972,6 +972,20 @@ def is_container():
|
|||
|
||||
|
||||
def add_to_updatedb_prunepath(path, updatedb_path=UPDATEDB_PATH):
|
||||
"""Adds the specified path to the mlocate's udpatedb.conf PRUNEPATH list.
|
||||
|
||||
This method has no effect if the path specified by updatedb_path does not
|
||||
exist or is not a file.
|
||||
|
||||
@param path: string the path to add to the updatedb.conf PRUNEPATHS value
|
||||
@param updatedb_path: the path the updatedb.conf file
|
||||
"""
|
||||
if not os.path.exists(updatedb_path) or os.path.isdir(updatedb_path):
|
||||
# If the updatedb.conf file doesn't exist then don't attempt to update
|
||||
# the file as the package providing mlocate may not be installed on
|
||||
# the local system
|
||||
return
|
||||
|
||||
with open(updatedb_path, 'r+') as f_id:
|
||||
updatedb_text = f_id.read()
|
||||
output = updatedb(updatedb_text, path)
|
||||
|
|
|
@ -315,7 +315,7 @@ def import_key(key):
|
|||
cmd = ['apt-key', 'adv', '--keyserver',
|
||||
'hkp://keyserver.ubuntu.com:80', '--recv-keys', key]
|
||||
try:
|
||||
subprocess.check_call(cmd)
|
||||
_run_with_retries(cmd)
|
||||
except subprocess.CalledProcessError:
|
||||
error = "Error importing PGP key '{}'".format(key)
|
||||
log(error)
|
||||
|
|
|
@ -972,6 +972,20 @@ def is_container():
|
|||
|
||||
|
||||
def add_to_updatedb_prunepath(path, updatedb_path=UPDATEDB_PATH):
|
||||
"""Adds the specified path to the mlocate's udpatedb.conf PRUNEPATH list.
|
||||
|
||||
This method has no effect if the path specified by updatedb_path does not
|
||||
exist or is not a file.
|
||||
|
||||
@param path: string the path to add to the updatedb.conf PRUNEPATHS value
|
||||
@param updatedb_path: the path the updatedb.conf file
|
||||
"""
|
||||
if not os.path.exists(updatedb_path) or os.path.isdir(updatedb_path):
|
||||
# If the updatedb.conf file doesn't exist then don't attempt to update
|
||||
# the file as the package providing mlocate may not be installed on
|
||||
# the local system
|
||||
return
|
||||
|
||||
with open(updatedb_path, 'r+') as f_id:
|
||||
updatedb_text = f_id.read()
|
||||
output = updatedb(updatedb_text, path)
|
||||
|
|
Loading…
Reference in New Issue