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)
| 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 | """ |
no test coverage detected