Tim Landscheidt has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/326892 )
Change subject: Tools: Make tools-clush-generator project-agnostic ...................................................................... Tools: Make tools-clush-generator project-agnostic Change-Id: I7ec7bac459e9e256f24e0636e1d540081cfca13e --- M modules/role/files/toollabs/clush/tools-clush-generator 1 file changed, 8 insertions(+), 5 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/operations/puppet refs/changes/92/326892/1 diff --git a/modules/role/files/toollabs/clush/tools-clush-generator b/modules/role/files/toollabs/clush/tools-clush-generator index 4fbf845..2b8f7cb 100644 --- a/modules/role/files/toollabs/clush/tools-clush-generator +++ b/modules/role/files/toollabs/clush/tools-clush-generator @@ -46,21 +46,21 @@ } -def get_hostgroups(classifier): +def get_hostgroups(classifier, project_name): hostgroups = {name: [] for name in classifier.values()} api_url = 'https://wikitech.wikimedia.org/w/api.php' \ '?action=query&list=novainstances&niregion=eqiad&format=json' \ - '&niproject=tools' + '&niproject=' + project_name data = json.loads(urlopen(api_url).read().decode('utf-8')) for instance in data['query']['novainstances']: name = instance['name'] for prefix in classifier: - if name.startswith('tools-' + prefix): + if name.startswith('%s-%s' % (project_name, prefix)): role = classifier[prefix] - hostgroups[role].append(name + ".tools.eqiad.wmflabs") + hostgroups[role].append('%s.%s.eqiad.wmflabs' % (name, project_name)) return hostgroups @@ -73,6 +73,9 @@ ) args = parser.parse_args() - hostgroups = get_hostgroups(TOOLS_PREFIX_CLASSIFIER) + with open('/etc/wmflabs-project', 'r') as f: + project_name = f.read().rstrip('\n') + + hostgroups = get_hostgroups(TOOLS_PREFIX_CLASSIFIER, project_name) with open(args.outputpath, 'w') as f: f.write(yaml.safe_dump(hostgroups, default_flow_style=False)) -- To view, visit https://gerrit.wikimedia.org/r/326892 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I7ec7bac459e9e256f24e0636e1d540081cfca13e Gerrit-PatchSet: 1 Gerrit-Project: operations/puppet Gerrit-Branch: production Gerrit-Owner: Tim Landscheidt <t...@tim-landscheidt.de> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits