MCPcopy
hub / github.com/saltstack/salt / fetch

Method fetch

salt/utils/gitfs.py:941–980  ·  view source on GitHub ↗

Fetch the repo. If the local copy was updated, return True. If the local copy was already up-to-date, return False. This function requires that a _fetch() function be implemented in a sub-class.

(self)

Source from the content-addressed store, hash-verified

939 )
940
941 def fetch(self):
942 """
943 Fetch the repo. If the local copy was updated, return True. If the
944 local copy was already up-to-date, return False.
945
946 This function requires that a _fetch() function be implemented in a
947 sub-class.
948 """
949 try:
950 with self.gen_lock(lock_type="update"):
951 log.debug("Fetching %s remote '%s'", self.role, self.id)
952 # Run provider-specific fetch code
953 return self._fetch()
954 except GitLockError as exc:
955 if exc.errno == errno.EEXIST:
956 log.warning(
957 "Update lock file is present for %s remote '%s', "
958 "skipping. If this warning persists, it is possible that "
959 "the update process was interrupted, but the lock could "
960 "also have been manually set. Removing %s or running "
961 "'salt-run cache.clear_git_lock %s type=update' will "
962 "allow updates to continue for this remote.",
963 self.role,
964 self.id,
965 self._get_lock_file(lock_type="update"),
966 self.role,
967 )
968 else:
969 log.warning(
970 "Update lock file generated an unexpected exception for %s remote '%s', "
971 "The lock file %s for %s type=update operation, exception: %s .",
972 self.role,
973 self.id,
974 self._get_lock_file(lock_type="update"),
975 self.role,
976 str(exc),
977 )
978 return False
979 except NotImplementedError as exc:
980 log.warning("fetch got NotImplementedError exception %s", exc)
981
982 def _lock(self, lock_type="update", failhard=False):
983 """

Callers 15

fetch_request_checkMethod · 0.95
_get_cached_mine_dataMethod · 0.45
queryFunction · 0.45
checkoutMethod · 0.45
_fetchMethod · 0.45
checkoutMethod · 0.45
_fetchMethod · 0.45
checkoutMethod · 0.45
init_remotesMethod · 0.45

Calls 5

gen_lockMethod · 0.95
_fetchMethod · 0.95
_get_lock_fileMethod · 0.95
debugMethod · 0.80
warningMethod · 0.80

Tested by

no test coverage detected