def is_flamenco_project(self, project: pillarsdk.Project): """Returns whether the project is set up for Flamenco. Requires Flamenco extension properties. """ if not project.extension_props: return False try: pprops = project.extension_props[EXTENSION_NAME] except AttributeError: self._log.warning( "is_flamenco_project: Project url=%r doesn't have" " any extension properties.", project['url']) if self._log.isEnabledFor(logging.DEBUG): import pprint self._log.debug('Project: %s', pprint.pformat(project.to_dict())) return False except KeyError: return False if pprops is None: self._log.warning( "is_flamenco_project: Project url=%r doesn't have" " Flamenco extension properties.", project['url']) return False return True
def is_flamenco_project(self, project: pillarsdk.Project): """Returns whether the project is set up for Flamenco. Requires Flamenco extension properties. """ if not project.extension_props: return False try: pprops = project.extension_props[EXTENSION_NAME] except AttributeError: self._log.warning("is_flamenco_project: Project url=%r doesn't have" " any extension properties.", project['url']) if self._log.isEnabledFor(logging.DEBUG): import pprint self._log.debug('Project: %s', pprint.pformat(project.to_dict())) return False except KeyError: return False if pprops is None: self._log.warning("is_flamenco_project: Project url=%r doesn't have" " Flamenco extension properties.", project['url']) return False return True
def is_svnman_project(self, project: pillarsdk.Project) -> bool: """Checks whether the project is correctly set up for SVNman.""" try: if not project.extension_props: return False except AttributeError: self._log.warning("is_svnman_project: Project url=%r doesn't have" " any extension properties.", project['url']) if self._log.isEnabledFor(logging.DEBUG): import pprint self._log.debug('Project: %s', pprint.pformat(project.to_dict())) return False try: pprops = project.extension_props[EXTENSION_NAME] except KeyError: return False if pprops is None: self._log.warning("is_svnman_project: Project url=%r doesn't have" " %s extension properties.", EXTENSION_NAME, project['url']) return False return bool(pprops.repo_id)
def _get_prop_props(self, project: pillarsdk.Project) -> (dict, dict): """Gets the project as dictionary and the extension properties.""" proj = project.to_dict() eprops = proj.setdefault('extension_props', {}).setdefault(EXTENSION_NAME, {}) return eprops, proj