Giuseppe Lavagetto has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/339415 )

Change subject: profile::conftool::client: first commit
......................................................................


profile::conftool::client: first commit

The current classes under the conftool:: hierarchy are an unholy mess.
This is the first patch to correct that situation.

Change-Id: I406af20dfe8c00bc9001147d531cbd492a076837
---
A modules/conftool/manifests/config.pp
M modules/etcd/templates/client_config.erb
A modules/profile/manifests/conftool/client.pp
3 files changed, 81 insertions(+), 1 deletion(-)

Approvals:
  Giuseppe Lavagetto: Verified; Looks good to me, approved
  jenkins-bot: Verified



diff --git a/modules/conftool/manifests/config.pp 
b/modules/conftool/manifests/config.pp
new file mode 100644
index 0000000..5a9090a
--- /dev/null
+++ b/modules/conftool/manifests/config.pp
@@ -0,0 +1,39 @@
+# == Class conftool::config
+#
+# Sets up the conftool configuration
+#
+# === Parameters
+#
+# [*namespace*] The namespace of the conftool keys.
+#
+# [*tcpircbot_host*] The host to connect to for tcpircbot
+#
+# [*tcprircbot_port*] The port to connect to for tcpircbot
+#
+# [*hosts*] List of etcd hosts (not needed if using srv discovery), empty by 
default
+#
+class conftool::config ($namespace, $tcpircbot_host, $tcpircbot_port, $hosts = 
[]) {
+    file { '/etc/conftool':
+        ensure => directory,
+        owner  => 'root',
+        group  => 'root',
+        mode   => '0755',
+    }
+
+    file { '/etc/conftool/config.yaml':
+        ensure  => present,
+        owner   => 'root',
+        group   => 'root',
+        mode    => '0444',
+        content => ordered_yaml({
+            hosts          => $hosts,
+            tcpircbot_host => $tcpircbot_host,
+            tcpircbot_port => $tcpircbot_port,
+            driver_options => {
+                allow_reconnect => true,
+            },
+            namespace      => $namespace,
+        }),
+    }
+
+}
diff --git a/modules/etcd/templates/client_config.erb 
b/modules/etcd/templates/client_config.erb
index 338c6bf..9d555bd 100644
--- a/modules/etcd/templates/client_config.erb
+++ b/modules/etcd/templates/client_config.erb
@@ -1,5 +1,5 @@
 <% @settings.keys.sort.each do |k| -%>
-<%- if @settings[k] != :undef -%>
+<%- if @settings[k] != :undef and @settings[k] != '' -%>
 <%= k %>: <%= @settings[k] %>
 <%- end -%>
 <% end %>
diff --git a/modules/profile/manifests/conftool/client.pp 
b/modules/profile/manifests/conftool/client.pp
new file mode 100644
index 0000000..c69d2d8
--- /dev/null
+++ b/modules/profile/manifests/conftool/client.pp
@@ -0,0 +1,41 @@
+#
+# == Class profile::conftool::client
+#
+# Configures a server to be a conftool client, setting up
+#
+# - The etcd client configuration in /etc/etcd/etcdrc
+# - The conftool client configuration
+# - The etcd credentials for the root user in /root/.etcdrc
+#
+class profile::conftool::client(
+    $srv_dns = hiera('etcd::srv_dns'),
+    $host = hiera('etcd::host'),
+    $port = hiera('etcd::port'),
+    $root_password = hiera('etcd::auth::common::root_password'),
+    $tcpircbot_host = hiera('profile::conftool::client::tcpircbot_host'),
+    $tcpircbot_port = hiera('profile::conftool::client::tcpircbot_port'),
+    $namespace      = hiera('profile::conftool::client::namespace'),
+) {
+    require_package('python-conftool')
+
+    class { '::etcd::client::globalconfig':
+        srv_dns  => $srv_dns,
+        host     => $host,
+        port     => $port,
+        protocol => 'https',
+    }
+
+    ::etcd::client::config { '/root/.etcdrc':
+        settings => {
+            username => 'root',
+            password => $root_password,
+        },
+    }
+
+    class  { '::conftool::config':
+        namespace      => $namespace,
+        tcpircbot_host => $tcpircbot_host,
+        tcpircbot_port => $tcpircbot_port,
+        hosts          => [],
+    }
+}

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I406af20dfe8c00bc9001147d531cbd492a076837
Gerrit-PatchSet: 6
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Giuseppe Lavagetto <[email protected]>
Gerrit-Reviewer: Giuseppe Lavagetto <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to