Ori.livneh has uploaded a new change for review.
https://gerrit.wikimedia.org/r/166736
Change subject: trebuchet: derive the grain name from the repo name
......................................................................
trebuchet: derive the grain name from the repo name
It's a bit silly to have to configure a grain name for each Trebuchet-deployed
repository, and then have to look up the repository in the configuration to
derive the key. It buys you nothing except the ability to have a single grain
associated with multiple repositories, which isn't beneficial anyway: if the
repositories are part of some role, then they should be declared together in
the role class, rather than have their association declared in a giant hash
blob in manifests/role/deployment.pp.
Change-Id: I38443f3b582c4658f91f0f8d442a590a27aa5b68
---
M manifests/role/deployment.pp
M modules/deployment/files/runners/deploy.py
M modules/deployment/manifests/salt_master.pp
D modules/deployment/templates/deploy_runner.conf.erb
4 files changed, 3 insertions(+), 65 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/operations/puppet
refs/changes/36/166736/1
diff --git a/manifests/role/deployment.pp b/manifests/role/deployment.pp
index 3a94e63..c1d4b87 100644
--- a/manifests/role/deployment.pp
+++ b/manifests/role/deployment.pp
@@ -5,127 +5,100 @@
class role::deployment::config {
$repo_config = {
'integration/kss' => {
- 'grain' => 'contint-production-slaves',
'upstream' => 'https://gerrit.wikimedia.org/r/integration/kss',
},
'integration/mediawiki-tools-codesniffer' => {
- 'grain' => 'contint-production-slaves',
'upstream' =>
'https://gerrit.wikimedia.org/r/mediawiki/tools/codesniffer',
},
'integration/phpunit' => {
- 'grain' => 'contint-production-slaves',
'upstream' => 'https://gerrit.wikimedia.org/r/integration/phpunit',
},
'integration/phpcs' => {
- 'grain' => 'contint-production-slaves',
'upstream' => 'https://gerrit.wikimedia.org/r/integration/phpcs',
},
'integration/php-coveralls' => {
- 'grain' => 'contint-production-slaves',
'upstream' =>
'https://gerrit.wikimedia.org/r/integration/php-coveralls',
},
'integration/slave-scripts' => {
- 'grain' => 'contint-production-slaves',
'upstream' => 'https://gerrit.wikimedia.org/r/integration/jenkins',
'checkout_submodules' => true,
},
'gdash/gdash' => {
- 'grain' => 'gdash',
'upstream' =>
'https://gerrit.wikimedia.org/r/operations/software/gdash',
},
'jobrunner/jobrunner' => {
- 'grain' => 'jobrunner',
'upstream' =>
'https://gerrit.wikimedia.org/r/mediawiki/services/jobrunner',
'service_name' => 'jobrunner',
},
'grafana/grafana' => {
- 'grain' => 'grafana',
'upstream' =>
'https://gerrit.wikimedia.org/r/operations/software/grafana',
},
'parsoid/deploy' => {
- 'grain' => 'parsoid',
'upstream' =>
'https://gerrit.wikimedia.org/r/p/mediawiki/services/parsoid/deploy',
'checkout_submodules' => true,
'service_name' => 'parsoid',
},
'eventlogging/EventLogging' => {
- 'grain' => 'eventlogging',
'upstream' =>
'https://gerrit.wikimedia.org/r/mediawiki/extensions/EventLogging',
},
'ocg/ocg' => {
- 'grain' => 'ocg',
'upstream' =>
'https://gerrit.wikimedia.org/r/mediawiki/services/ocg-collection',
'service_name' => 'ocg',
'checkout_submodules' => true,
},
'mathoid/mathoid' => {
- 'grain' => 'mathoid',
'upstream' =>
'https://gerrit.wikimedia.org/r/mediawiki/services/mathoid',
'service_name' => 'mathoid',
'checkout_submodules' => true,
},
'citoid/deploy' => {
- 'grain' => 'citoid',
'upstream' =>
'https://gerrit.wikimedia.org/r/mediawiki/services/citoid/deploy',
'service_name' => 'citoid',
'checkout_submodules' => true,
},
'rcstream/rcstream' => {
- 'grain' => 'rcstream',
'upstream' =>
'https://gerrit.wikimedia.org/r/mediawiki/services/rcstream',
'service_name' => 'rcstream',
},
'fluoride/fluoride' => {
- 'grain' => 'eventlogging',
'upstream' =>
'https://gerrit.wikimedia.org/r/mediawiki/tools/fluoride',
},
'mwprof/mwprof' => {
- 'grain' => 'mwprof',
'upstream' =>
'https://gerrit.wikimedia.org/r/operations/software/mwprof',
},
'reporter/reporter' => {
- 'grain' => 'reporter',
'upstream' =>
'https://gerrit.wikimedia.org/r/operations/software/mwprof/reporter',
},
'test/testrepo' => {
- 'grain' => 'testrepo',
'service_name' => 'puppet',
'checkout_submodules' => true,
},
'elasticsearch/plugins' => {
- 'grain' => 'elasticsearchplugins',
'gitfat_enabled' => true,
'upstream' =>
'https://gerrit.wikimedia.org/r/operations/software/elasticsearch/plugins',
},
'analytics/kraken/deploy' => {
- 'grain' => 'analytics-kraken-deploy',
'gitfat_enabled' => true,
'checkout_submodules' => true,
'upstream' =>
'https://gerrit.wikimedia.org/r/p/analytics/kraken/deploy',
},
'analytics/refinery' => {
- 'grain' => 'analytics-refinery',
'gitfat_enabled' => true,
'upstream' =>
'https://gerrit.wikimedia.org/r/analytics/refinery',
},
'scholarships/scholarships' => {
- 'grain' => 'scholarships',
'upstream' =>
'https://gerrit.wikimedia.org/r/wikimedia/wikimania-scholarships',
},
'librenms/librenms' => {
- 'grain' => 'librenms',
'upstream' =>
'https://gerrit.wikimedia.org/r/operations/software/librenms',
},
'kibana/kibana' => {
- 'grain' => 'kibana',
'upstream' =>
'https://gerrit.wikimedia.org/r/operations/software/kibana',
},
'scap/scap' => {
- 'grain' => 'scap',
'upstream' => 'https://gerrit.wikimedia.org/r/mediawiki/tools/scap',
},
'servermon/servermon' => {
- 'grain' => 'servermon',
'service_name' => 'servermon',
},
}
diff --git a/modules/deployment/files/runners/deploy.py
b/modules/deployment/files/runners/deploy.py
index 9a5db48..5bfde5c 100755
--- a/modules/deployment/files/runners/deploy.py
+++ b/modules/deployment/files/runners/deploy.py
@@ -8,26 +8,11 @@
import yaml
-def __get_conf(repo, key):
- try:
- config = yaml.load(file('/etc/salt/deploy_runner.conf', 'r'))
- return config[key][repo]
- except IOError:
- return ''
- except yaml.YAMLError:
- return ''
- except KeyError:
- return ''
-
-
def fetch(repo):
'''
Fetch from a master, for the specified repo
'''
- grain = __get_conf(repo, 'deployment_repo_grains')
- if not grain:
- return "No grain defined for this repo."
- grain = "deployment_target:" + grain
+ grain = "deployment_target:" + repo
client = salt.client.LocalClient(__opts__['conf_file'])
cmd = 'deploy.fetch'
# comma in the tuple is a workaround for a bug in salt
@@ -41,10 +26,7 @@
'''
Checkout from a master, for the specified repo
'''
- grain = __get_conf(repo, 'deployment_repo_grains')
- if not grain:
- return "No grain defined for this repo."
- grain = "deployment_target:" + grain
+ grain = "deployment_target:" + repo
client = salt.client.LocalClient(__opts__['conf_file'])
cmd = 'deploy.checkout'
arg = (repo, reset)
@@ -58,10 +40,7 @@
Restart the service associated with this repo. If no service is associated
this call will do nothing.
'''
- grain = __get_conf(repo, 'deployment_repo_grains')
- if not grain:
- return "No grain defined for this repo."
- grain = "deployment_target:" + grain
+ grain = "deployment_target:" + repo
client = salt.client.LocalClient(__opts__['conf_file'])
cmd = 'deploy.restart'
# comma in the tuple is a workaround for a bug in salt
diff --git a/modules/deployment/manifests/salt_master.pp
b/modules/deployment/manifests/salt_master.pp
index d45706b..da117c4 100644
--- a/modules/deployment/manifests/salt_master.pp
+++ b/modules/deployment/manifests/salt_master.pp
@@ -8,14 +8,6 @@
$deployment_config
) {
- file { '/etc/salt/deploy_runner.conf':
- content => template('deployment/deploy_runner.conf.erb'),
- mode => '0444',
- owner => 'root',
- group => 'root',
- require => [Package['salt-master']],
- }
-
file { "${state_dir}/deploy":
ensure => directory,
mode => '0555',
diff --git a/modules/deployment/templates/deploy_runner.conf.erb
b/modules/deployment/templates/deploy_runner.conf.erb
deleted file mode 100644
index bc8ddd3..0000000
--- a/modules/deployment/templates/deploy_runner.conf.erb
+++ /dev/null
@@ -1,6 +0,0 @@
-<%
-_deployment_grains = {}
-@repo_config.each do |repo, config|
- _deployment_grains[repo] = config['grain']
-end
-%>deployment_repo_grains: {<% _deployment_grains.sort.each do |repo, grain|
%>'<%= repo %>': '<%= grain %>',<% end %>}
--
To view, visit https://gerrit.wikimedia.org/r/166736
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I38443f3b582c4658f91f0f8d442a590a27aa5b68
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Ori.livneh <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits