Commit 85de98bd authored by Hardik Juneja's avatar Hardik Juneja Committed by Alain Takoudjou

stack/monitor: fixes monitor password generation code

/reviewed-on !169
parent 57c83f61
...@@ -15,4 +15,4 @@ ...@@ -15,4 +15,4 @@
# not need these here). # not need these here).
[monitor2-template] [monitor2-template]
filename = instance-monitor.cfg.jinja2.in filename = instance-monitor.cfg.jinja2.in
md5sum = c963c43189a9b50e48ba27f2dd4e7b02 md5sum = b829a49a28bd5997d786514c462bb9e1
...@@ -100,7 +100,7 @@ parameter-file-path = ${monitor-instance-parameter:configuration-file-path} ...@@ -100,7 +100,7 @@ parameter-file-path = ${monitor-instance-parameter:configuration-file-path}
parameter-list = parameter-list =
raw monitor-user ${monitor-instance-parameter:username} raw monitor-user ${monitor-instance-parameter:username}
htpasswd monitor-password ${monitor-htpassword-file:password-file} ${monitor-instance-parameter:username} ${httpd-monitor-htpasswd:htpasswd-path} htpasswd monitor-password ${httpd-monitor-htpasswd:password-file} ${monitor-instance-parameter:username} ${httpd-monitor-htpasswd:htpasswd-path}
file promise-timeout ${monitor-promise-timeout-file:file} file promise-timeout ${monitor-promise-timeout-file:file}
file min-free-disk-MB ${promise-check-free-disk-space:config-file} file min-free-disk-MB ${promise-check-free-disk-space:config-file}
${monitor-instance-parameter:instance-configuration} ${monitor-instance-parameter:instance-configuration}
...@@ -164,25 +164,18 @@ environment = ...@@ -164,25 +164,18 @@ environment =
recipe = slapos.cookbook:generate.password recipe = slapos.cookbook:generate.password
storage-path = ${directory:etc}/.monitor_pwd storage-path = ${directory:etc}/.monitor_pwd
bytes = 8 bytes = 8
username = admin
[monitor-htpassword-file]
recipe = plone.recipe.command
stop-on-error = true
password-file = ${directory:etc}/.monitor_pwd
command =
if [ ! -s "${:password-file}" ]; then echo "${monitor-instance-parameter:password}" > ${:password-file}; fi
update-command = ${:command}
[httpd-monitor-htpasswd] [httpd-monitor-htpasswd]
recipe = plone.recipe.command recipe = plone.recipe.command
stop-on-error = true stop-on-error = true
password-file = ${directory:etc}/.monitor_pwd
htpasswd-path = ${monitor-directory:etc}/monitor-htpasswd htpasswd-path = ${monitor-directory:etc}/monitor-htpasswd
# Keep multiple lines as password can end with newline char. # Keep multiple lines as password can end with newline char.
command = command =
if [ ! -s "${:htpasswd-path}" ]; then if [ ! -s "${:htpasswd-path}" ]; then
{{ apache_location }}/bin/htpasswd -cb ${:htpasswd-path} ${:user} ${:password} {{ apache_location }}/bin/htpasswd -cb ${:htpasswd-path} ${:user} ${:password}
fi fi
if [ ! -s "${:password-file}" ]; then echo "${monitor-instance-parameter:password}" > ${:password-file}; fi
update-command = ${:command} update-command = ${:command}
user = ${monitor-instance-parameter:username} user = ${monitor-instance-parameter:username}
password = ${monitor-instance-parameter:password} password = ${monitor-instance-parameter:password}
...@@ -305,7 +298,7 @@ cors-domains = monitor.app.officejs.com ...@@ -305,7 +298,7 @@ cors-domains = monitor.app.officejs.com
collector-db = /srv/slapgrid/var/data-log/collector.db collector-db = /srv/slapgrid/var/data-log/collector.db
# Credentials # Credentials
password = ${monitor-htpasswd:passwd} password = ${monitor-htpasswd:passwd}
username = ${monitor-htpasswd:username} username = admin
# XXX: type key value # XXX: type key value
# ex raw monitor-password resqdsdsd34 # ex raw monitor-password resqdsdsd34
instance-configuration = instance-configuration =
......
  • mentioned in merge request !174

    Toggle commit list
  • @Tyagov @alain.takoudjou

    Hey, me and @Tyagov are having issues with the monitor starting around this commit. We have 2 webrunners that fail to run their instances with the following error:

    INFO     Installing switch-softwaretype.
    [2017-06-07 09:38:42,727] INFO     While:
    [2017-06-07 09:38:42,728] INFO       Installing.
    [2017-06-07 09:38:42,728] INFO       Getting section monitor-base.
    [2017-06-07 09:38:42,728] INFO       Initializing section monitor-base.
    [2017-06-07 09:38:42,728] INFO       Getting option monitor-base:base-url.
    [2017-06-07 09:38:42,728] INFO       Getting section monitor-conf-parameters.
    [2017-06-07 09:38:42,728] INFO       Initializing section monitor-conf-parameters.
    [2017-06-07 09:38:42,729] INFO       Getting option monitor-conf-parameters:base-url.
    [2017-06-07 09:38:42,729] INFO       Getting section monitor-instance-parameter.
    [2017-06-07 09:38:42,729] INFO       Initializing section monitor-instance-parameter.
    [2017-06-07 09:38:42,729] INFO       Getting option monitor-instance-parameter:monitor-base-url.
    [2017-06-07 09:38:42,729] INFO       Getting section monitor-frontend-promise.
    [2017-06-07 09:38:42,729] INFO       Initializing section monitor-frontend-promise.
    [2017-06-07 09:38:42,730] INFO       Getting option monitor-frontend-promise:url.
    [2017-06-07 09:38:42,730] INFO       Getting section monitor-frontend.
    [2017-06-07 09:38:42,730] INFO       Initializing section monitor-frontend.
    [2017-06-07 09:38:42,730] INFO       Getting option monitor-frontend:config-url.
    [2017-06-07 09:38:42,730] INFO       Getting section monitor-httpd-conf-parameter.
    [2017-06-07 09:38:42,730] INFO       Initializing section monitor-httpd-conf-parameter.
    [2017-06-07 09:38:42,731] INFO       Getting option monitor-httpd-conf-parameter:htpasswd-file.
    [2017-06-07 09:38:42,731] INFO       Getting section httpd-monitor-htpasswd.
    [2017-06-07 09:38:42,731] INFO       Initializing section httpd-monitor-htpasswd.
    [2017-06-07 09:38:42,731] INFO       Getting option httpd-monitor-htpasswd:command.
    [2017-06-07 09:38:42,731] INFO       Getting option httpd-monitor-htpasswd:password.
    [2017-06-07 09:38:42,731] INFO       Getting option monitor-instance-parameter:password.
    [2017-06-07 09:38:42,732] INFO     Error: Referenced option does not exist: monitor-htpasswd passwd
    [2017-06-07 09:38:42,757] INFO     While:
    [2017-06-07 09:38:42,757] INFO       Installing switch-softwaretype.
    [2017-06-07 09:38:42,758] INFO     
    [2017-06-07 09:38:42,758] INFO     An internal error occurred due to a bug in either zc.buildout or in a
    [2017-06-07 09:38:42,758] INFO     recipe being used:
    [2017-06-07 09:38:42,758] INFO     Traceback (most recent call last):
    [2017-06-07 09:38:42,759] INFO       File "/srv/slapgrid/slappart9/srv/runner/software/72846b0b455a20dfaefd882116deaac0/eggs/zc.buildout-2.5.2+slapos008-py2.7.egg/zc/buildout/buildout.py", line 2222, in main
    [2017-06-07 09:38:42,759] INFO         getattr(buildout, command)(args)
    [2017-06-07 09:38:42,759] INFO       File "/srv/slapgrid/slappart9/srv/runner/software/72846b0b455a20dfaefd882116deaac0/eggs/zc.buildout-2.5.2+slapos008-py2.7.egg/zc/buildout/buildout.py", line 636, in install
    [2017-06-07 09:38:42,760] INFO         self._install_parts(install_args)
    [2017-06-07 09:38:42,760] INFO       File "/srv/slapgrid/slappart9/srv/runner/software/72846b0b455a20dfaefd882116deaac0/eggs/zc.buildout-2.5.2+slapos008-py2.7.egg/zc/buildout/buildout.py", line 805, in _install_parts
    [2017-06-07 09:38:42,760] INFO         installed_files = self[part]._call(recipe.install)
    [2017-06-07 09:38:42,760] INFO       File "/srv/slapgrid/slappart9/srv/runner/software/72846b0b455a20dfaefd882116deaac0/eggs/zc.buildout-2.5.2+slapos008-py2.7.egg/zc/buildout/buildout.py", line 1586, in _call
    [2017-06-07 09:38:42,761] INFO         return f()
    [2017-06-07 09:38:42,761] INFO       File "/srv/slapgrid/slappart9/srv/runner/software/72846b0b455a20dfaefd882116deaac0/parts/slapos.cookbook-repository/slapos/recipe/switch_softwaretype.py", line 60, in install
    [2017-06-07 09:38:42,761] INFO         subprocess.check_call(args + ["-oc", buildout])
    [2017-06-07 09:38:42,761] INFO       File "/opt/slapos/parts/python2.7/lib/python2.7/subprocess.py", line 541, in check_call
    [2017-06-07 09:38:42,761] INFO         raise CalledProcessError(retcode, cmd)
    [2017-06-07 09:38:42,762] INFO     CalledProcessError: Command '['/srv/slapgrid/slappart9/srv/runner/software/72846b0b455a20dfaefd882116deaac0/bin/buildout', '-U', 'slap-connection:cert-file=', 'slap-connection:server-url=http://10.0.126.44:50000', 'slap-connection:partition-id=slappart8', 'slap-connection:key-file=', 'slap-connection:software-release-url=/srv/slapgrid/slappart9/srv//runner/project/windelin/slapos/software/windelin/software.cfg', 'slap-connection:computer-id=slaprunner', 'buildout:directory=/srv/slapgrid/slappart9/srv/runner/instance/slappart8', 'buildout:eggs-directory=/srv/slapgrid/slappart9/srv/runner/software/72846b0b455a20dfaefd882116deaac0/eggs', 'buildout:develop-eggs-directory=/srv/slapgrid/slappart9/srv/runner/software/72846b0b455a20dfaefd882116deaac0/develop-eggs', 'buildout:installed=.installed-switch-softwaretype.cfg', '-oc', '/srv/slapgrid/slappart9/srv/runner/software/72846b0b455a20dfaefd882116deaac0/template-jupyter.cfg']' returned non-zero exit status 1
    [2017-06-07 09:38:42,784] ERROR    Failed to run buildout profile in directory '/srv/slapgrid/slappart9/srv/runner/instance/slappart8'
    [2017-06-07 09:38:42,784] DEBUG    Restore umask from 027 to 022
    [2017-06-07 09:38:42,789] INFO     Finished computer partitions.

    The error occurs on this line. I'm fairly sure that this problem started occuring at this commit, but it's a pain to test, since the rebuild times can be pretty long. Please make sure this works since it's on master, after all.

  • I am looking into this problem!

  • Hello, hopefully !176 (merged) should fix this. Thanks to @jm for his inputs and help with the merge.

Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment