ArielGlenn has submitted this change and it was merged.

Change subject: Revert "Remove deployment::target"
......................................................................


Revert "Remove deployment::target"

This reverts commit 7d05ab065cf9581a4399706ee99b0601067ef8ec.

The trebuchet provider sets the wrong deployment_target grain; until that's 
fixed, using this class is the workaround. Adding new hosts as targets of a 
repo for certain repos will trigger this bug.

Info on the bug:

Grains corresponding to repos are defined in role::deployment::config, see 
$repo_config.  Several repos under the same base might use the same grain or 
they might not; see integration and analytics as two examples.  The custom 
package provider always uses base (i.e. the parent dir) as the grain name, 
which matches some configs by luck but many it doesn't.

Those configs wind up in /etc/salt/deploy_runner.conf on the salt master, 
explicitly checked by the trebuchet runner. How the custom package provider is 
going to get at those, I really don't know.

Note that testing the custom provider on hosts already targets of a repo would 
have left the old correct grain in place, so the failure wouldn't have shown up.

Change-Id: I18b329fd2f35818167e3db6b3ab77f82d4cf4a94
---
A modules/deployment/manifests/target.pp
1 file changed, 41 insertions(+), 0 deletions(-)

Approvals:
  ArielGlenn: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/modules/deployment/manifests/target.pp 
b/modules/deployment/manifests/target.pp
new file mode 100644
index 0000000..d828e1d
--- /dev/null
+++ b/modules/deployment/manifests/target.pp
@@ -0,0 +1,41 @@
+define deployment::target($ensure=present) {
+    # Need packages before deploy.sync_all
+    # is run.  (git, git-fat, etc.)
+    require deployment::packages
+
+    salt::grain { "deployment_target_${name}":
+        ensure => $ensure,
+        grain  => 'deployment_target',
+        value  => $name,
+        notify => [
+            Exec['deployment_target_sync_all'],
+            Exec['deployment_target_refresh_pillars'],
+            Exec['deployment_target_deploy_all'],
+        ];
+    }
+    if ! defined(Exec['deployment_target_sync_all']){
+        exec { 'deployment_target_sync_all':
+            refreshonly => true,
+            path        => ['/usr/bin'],
+            command     => 'salt-call saltutil.sync_all';
+        }
+    }
+    if ! defined(Exec['deployment_target_refresh_pillars']){
+        exec { 'deployment_target_refresh_pillars':
+            refreshonly => true,
+            path        => ['/usr/bin'],
+            command     => 'salt-call saltutil.refresh_pillar';
+        }
+    }
+    if ! defined(Exec['deployment_target_deploy_all']){
+        exec { 'deployment_target_deploy_all':
+            refreshonly => true,
+            path        => ['/usr/bin'],
+            command     => 'salt-call deploy.sync_all',
+            require     => [
+                Exec['deployment_target_sync_all'],
+                Exec['deployment_target_refresh_pillars'],
+            ];
+        }
+    }
+}

-- 
To view, visit https://gerrit.wikimedia.org/r/166720
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I18b329fd2f35818167e3db6b3ab77f82d4cf4a94
Gerrit-PatchSet: 2
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: ArielGlenn <ar...@wikimedia.org>
Gerrit-Reviewer: ArielGlenn <ar...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to