>>> from unittest.mock import MagicMock >>> from wmflib.config import load_yaml_config >>> from spicerack.service import Catalog >>> catalog = Catalog(load_yaml_config('.../puppet/hieradata/common/service.yaml'), MagicMock(), MagicMock()) >>> catalog.service_names ['apertium', 'api-https', 'appservers-https', 'aqs', 'blubberoid', 'citoid', 'cloudelastic-chi-https', 'cloudelastic-chi-https-public', 'cloudelastic-omega-https', 'cloudelastic-omega-https-public', 'cloudelastic-psi-https', 'cloudelastic-psi-https-public', 'cxserver', 'datahubsearch', 'docker-registry', 'druid-public-broker', 'echostore', 'eventgate-analytics', 'eventgate-logging-external', 'eventgate-analytics-external', 'eventgate-main', 'eventstreams', 'eventstreams-internal', 'git-ssh', 'jobrunner', 'k8s-ingress-staging', 'k8s-ingress-wikikube', 'kartotherian', 'kartotherian-ssl', 'kibana7', 'kubemaster', 'labweb', 'labweb-ssl', 'ldap-ro', 'ldap-ro-ssl', 'mathoid', 'miscweb', 'ml-ctrl', 'ml-staging-ctrl', 'mobileapps', 'mwdebug', 'ncredir', 'ncredir-https', 'ores', 'parsoid-php', 'prometheus', 'proton', 'push-notifications', 'recommendation-api', 'restbase-backend', 'restbase-https', 'schema', 'search', 'search-https', 'search-omega-https', 'search-psi-https', 'sessionstore', 'shellbox', 'shellbox-constraints', 'shellbox-media', 'shellbox-syntaxhighlight', 'shellbox-timeline', 'swift', 'swift-https', 'tegola-vector-tiles', 'thanos-query', 'thanos-swift', 'termbox', 'text', 'text-https', 'thumbor', 'toolhub', 'upload', 'upload-https', 'videoscaler', 'wcqs', 'wdqs', 'wdqs-heavy-queries', 'wdqs-internal', 'wdqs-ssl', 'wikifeeds', 'zotero', 'helm-charts', 'releases', 'api-gateway', 'similar-users', 'linkrecommendation', 'linkrecommendation-external', 'apple-search', 'wikireplicas-a-s1', 'wikireplicas-a-s2', 'wikireplicas-a-s3', 'wikireplicas-a-s4', 'wikireplicas-a-s5', 'wikireplicas-a-s6', 'wikireplicas-a-s7', 'wikireplicas-a-s8', 'wikireplicas-b-s1', 'wikireplicas-b-s2', 'wikireplicas-b-s3', 'wikireplicas-b-s4', 'wikireplicas-b-s5', 'wikireplicas-b-s6', 'wikireplicas-b-s7', 'wikireplicas-b-s8', 'puppetdb-api', 'alertmanager', 'graphite', 'grafana', 'librenms', 'inference', 'apt', 'puppetboard'] >>> appservers = catalog.get('appservers-https') >>> appservers.description 'Main MediaWiki application server cluster, appservers.svc.%{::site}.wmnet (https)' >>> appservers.encryption True >>> appservers.port 443 >>> appservers.sites ['eqiad', 'codfw'] >>> appservers.state 'production' >>> appservers.aliases ['appservers'] >>> appservers.page False >>> appservers.probes [{'type': 'http', 'path': '/wiki/Special:Blankpage', 'host': 'en.wikipedia.org'}] >>> appservers.public_aliases [] >>> appservers.public_endpoint '' >>> appservers.role '' >>> appservers.ip.all [IPv4Address('10.2.1.1'), IPv4Address('10.2.2.1')] >>> appservers.ip.sites ['codfw', 'eqiad'] >>> appservers.ip.get('codfw') IPv4Address('10.2.1.1') >>> appservers.lvs.depool_threshold '.7' >>> appservers.lvs.enabled True >>> appservers.lvs.lvs_class 'low-traffic' >>> appservers.lvs.monitors {'IdleConnection': {'max-delay': 300, 'timeout-clean-reconnect': 3}, 'ProxyFetch': {'url': ['https://en.wikipedia.org/wiki/Special:BlankPage']}} >>> appservers.lvs.bgp True >>> appservers.lvs.protocol 'tcp' >>> appservers.lvs.scheduler 'wrr' >>> appservers.lvs.conftool ServiceLVSConftool(cluster='appserver', service='nginx') >>> appservers.lvs.conftool.cluster 'appserver' >>> appservers.lvs.conftool.service 'nginx' >>> appservers.monitoring.check_command 'check_https_url!en.wikipedia.org!/wiki/Special:BlankPage' >>> appservers.monitoring.sites ServiceMonitoringHostnames(data={'codfw': {'hostname': 'appservers.svc.codfw.wmnet'}, 'eqiad': {'hostname': 'appservers.svc.eqiad.wmnet'}}) >>> appservers.monitoring.sites.all ['appservers.svc.codfw.wmnet', 'appservers.svc.eqiad.wmnet'] >>> appservers.monitoring.sites.sites ['codfw', 'eqiad'] >>> appservers.monitoring.sites.get('codfw') 'appservers.svc.codfw.wmnet' >>> appservers.monitoring.contact_group '' >>> appservers.monitoring.notes_url '' >>> len(appservers.discovery) 2 >>> for i in appservers.discovery: ... print(i) ... ServiceDiscoveryRecord(active_active=True, dnsdisc='appservers-ro', instance=) ServiceDiscoveryRecord(active_active=False, dnsdisc='appservers-rw', instance=) >>> rec = appservers.discovery.get('appservers-ro') >>> rec.active_active True >>> rec.dnsdisc 'appservers-ro' >>> with disc.depooled('codfw', name='appservers-ro'): ... pass ... >>> with disc.depooled('codfw', name='appservers-ro', repool_on_error=True): ... pass ... >>> puppetboard = catalog.get('puppetboard') >>> puppetboard.discovery.get() # Just one discovery record, no need for the name ServiceDiscoveryRecord(active_active=True, dnsdisc='puppetboard', instance=) >>> with puppetboard.discovery.depooled('codfw'): # Just one discovery record, no need for the name ... pass ... >>>