Ori.livneh has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/59782


Change subject: Create IPython config based on $ipython_profile
......................................................................

Create IPython config based on $ipython_profile

This change parametrizes the profile name and adds an exec resource that
creates a default config for that profile if one does not already exist.
Also documents parameters in RDoc format.

Change-Id: Ib4c6e662740fc9c56f5c29bb58ce1badd535c89e
---
M modules/eventlogging/manifests/notebook.pp
M modules/eventlogging/templates/notebook.conf.erb
2 files changed, 27 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/puppet 
refs/changes/82/59782/1

diff --git a/modules/eventlogging/manifests/notebook.pp 
b/modules/eventlogging/manifests/notebook.pp
index acbc04e..be5becc 100644
--- a/modules/eventlogging/manifests/notebook.pp
+++ b/modules/eventlogging/manifests/notebook.pp
@@ -1,9 +1,27 @@
+# == Class: eventlogging::notebook
+#
 # Configures an integrated, web-based numeric computation environment
 # (like Mathematica), based on PyLab and IPython Notebook.
 # See <http://ipython.org/ipython-doc/dev/interactive/htmlnotebook.html>
 # and <http://www.scipy.org/PyLab>.
+#
+# === Parameters
+#
+# [*ipython_dir*]
+#   IPython working directory.
+#
+# [*ipython_profile*]
+#   Name of IPython profile to create.
+#
+# [*ipython_user*]
+#   Create this user account and run IPython as this user.
+#
+# [*notebook_dir*]
+#   Specifies where IPython should archive notebooks.
+#
 class eventlogging::notebook(
        $ipython_dir = '/var/lib/ipython',
+       $ipython_profile = 'nbserver',
        $ipython_user = 'ipython',
        $notebook_dir = '/var/lib/ipython/notebooks'
 ) {
@@ -28,10 +46,17 @@
                ensure  => directory,
                owner   => $ipython_user,
                group   => $ipython_user,
-               mode    => '0555',
+               mode    => '0660',
                require => Systemuser[$ipython_user],
        }
 
+       exec { "ipython profile create ${ipython_profile}":
+               creates     => "${ipython_dir}/profile_${ipython_profile}",
+               environment => "IPYTHONDIR=${ipython_dir}",
+               user        => $ipython_user,
+               require     => [ Package['ipython-notebook'], 
Systemuser[$ipython_user] ],
+       }
+
        file { '/etc/supervisor/conf.d/notebook.conf':
                content => template('eventlogging/notebook.conf.erb'),
                require => [ Package['ipython-notebook'], File[$notebook_dir] ],
diff --git a/modules/eventlogging/templates/notebook.conf.erb 
b/modules/eventlogging/templates/notebook.conf.erb
index 34d5ca7..acd8952 100644
--- a/modules/eventlogging/templates/notebook.conf.erb
+++ b/modules/eventlogging/templates/notebook.conf.erb
@@ -1,5 +1,5 @@
 [program:notebook]
-command = ipython notebook --ipython-dir="<%= ipython_dir %>" --profile 
nbserver
+command = ipython notebook --ipython-dir="<%= ipython_dir %>" --profile="<%= 
ipython_profile %>"
 user = <%= ipython_user %>
 directory = <%= ipython_dir %>
 redirect_stderr = true

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib4c6e662740fc9c56f5c29bb58ce1badd535c89e
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

Reply via email to