Skip to content

Commit

Permalink
Add function check_if_fallback_is_allowed back
Browse files Browse the repository at this point in the history
  • Loading branch information
PengpengSun committed Mar 28, 2024
1 parent c0cc12a commit 427c3b9
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions cloudinit/sources/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -348,10 +348,6 @@ def _unpickle(self, ci_pkl_version: int) -> None:
setattr(self, key, value)

if not hasattr(self, "check_if_fallback_is_allowed"):
# check_if_fallback_is_allowed checks if a cached ds is allowed to
# be restored when no valid ds is found in local mode by checking
# instance-id and searching valid data through ds list. If cached
# ds has no such attribute, it always returns False
setattr(self, "check_if_fallback_is_allowed", lambda: False)

if hasattr(self, "userdata") and self.userdata is not None:
Expand Down Expand Up @@ -933,6 +929,16 @@ def check_instance_id(self, sys_cfg):
# quickly (local check only) if self.instance_id is still
return False

def check_if_fallback_is_allowed(self):
"""check_if_fallback_is_allowed()
Checks if a cached ds is allowed to be restored when no valid ds is
found in local mode by checking instance-id and searching valid data
through ds list.
@return True if a ds allows fallback, False otherwise.
"""
return False

@staticmethod
def _determine_dsmode(candidates, default=None, valid=None):
# return the first candidate that is non None, warn if not valid
Expand Down

0 comments on commit 427c3b9

Please sign in to comment.