Skip to content

Commit

Permalink
Load from cache only when redo=False
Browse files Browse the repository at this point in the history
Add redo=False to load_from_cache so option to re-populate the cache
when layers are changed; default is to not redo the cache.
Resolves: #113   See: #27

Signed-off-by: Laurie Roy <[email protected]>
  • Loading branch information
laurieroy authored and Nisha Kumar committed Nov 15, 2018
1 parent 5107fbe commit a4bea09
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions common.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,16 @@ def get_shell_commands(shell_command_line):
return cleaned_list


def load_from_cache(layer):
def load_from_cache(layer, redo=False):
'''Given a layer object, check against cache to see if that layer id exists
if yes then get the package list and load it in the layer and return true.
If it doesn't exist return false
If it doesn't exist return false. Default operation is to not redo the cache.
Add notices to the layer's origins matching the origin_str'''
loaded = False
origin_layer = 'Layer: ' + layer.fs_hash[:10]
if not layer.packages:
# there are no packages in this layer
# try to get it from the cache
if not layer.packages and not redo:
# there are no packages in this layer and we are not repopulating the
# cache, try to get it from the cache
raw_pkg_list = cache.get_packages(layer.fs_hash)
if raw_pkg_list:
logger.debug('Loaded from cache: layer {}'.format(
Expand Down

0 comments on commit a4bea09

Please sign in to comment.