Asher has submitted this change and it was merged.

Change subject: Parametrize and extend IPython Notebook class
......................................................................


Parametrize and extend IPython Notebook class

This change replaces hard-coded paths with class parameters and template
expansion. It also configures IPython Notebook to run under supervisord.

Also adds 'python-pexpect', which is a recommended package. (IPython Notebook
ships with an inferior process management library, but it will use pexpect if
available.)

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

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



diff --git a/modules/eventlogging/manifests/notebook.pp 
b/modules/eventlogging/manifests/notebook.pp
index eb8ac55..2263e7f 100644
--- a/modules/eventlogging/manifests/notebook.pp
+++ b/modules/eventlogging/manifests/notebook.pp
@@ -2,20 +2,41 @@
 # (like Mathematica), based on PyLab and IPython Notebook.
 # See <http://ipython.org/ipython-doc/dev/interactive/htmlnotebook.html>
 # and <http://www.scipy.org/PyLab>.
-class eventlogging::notebook {
+class eventlogging::notebook(
+       $ipython_dir = '/var/lib/ipython',
+       $ipython_user = 'ipython',
+       $notebook_dir = '/var/lib/ipython/notebooks'
+) {
 
        package { [
                'ipython-notebook',
                'python-matplotlib',
                'python-numpy',
                'python-pandas',
+               'python-pexpect',
                'python-scipy',
        ]:
                ensure => latest,
        }
 
-       systemuser { 'ipython':
-               name => 'ipython',
+       systemuser { $ipython_user:
+               name => $ipython_user,
+               home => $ipython_dir,
+       }
+
+       file { $notebook_dir:
+               ensure  => directory,
+               owner   => $ipython_user,
+               group   => $ipython_user,
+               mode    => '0555',
+               require => Systemuser[$ipython_user],
+       }
+
+       file { '/etc/supervisor/conf.d/notebook.conf':
+               content => template('/eventlogging/notebook.conf.erb'),
+               require => [ Package['ipython-notebook'], File[$notebook_dir] ],
+               notify  => Service['supervisor'],
+               mode    => '0444',
        }
 
 }
diff --git a/modules/eventlogging/templates/notebook.conf.erb 
b/modules/eventlogging/templates/notebook.conf.erb
new file mode 100644
index 0000000..a03ba20
--- /dev/null
+++ b/modules/eventlogging/templates/notebook.conf.erb
@@ -0,0 +1,8 @@
+[program:notebook]
+command = ipython notebook --profile nbserver
+user = <%= ipython_user %>
+directory = <%= ipython_dir %>
+redirect_stderr = true
+stdout_logfile = /var/log/supervisor/%(program_name)s.log
+stderr_logfile = NONE
+environment = IPYTHONDIR=<%= ipython_dir %>

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I0d0de6a4d00bb2bba512c2ae355b93028be7caff
Gerrit-PatchSet: 3
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Ori.livneh <[email protected]>
Gerrit-Reviewer: Asher <[email protected]>
Gerrit-Reviewer: jenkins-bot

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

Reply via email to