Commit 2ae4505e authored by Jérome Perrin's avatar Jérome Perrin

recipe.shellinabox: Allow to pass knowledge0_cfg to get shell password from there

parent 75a8f28e
...@@ -29,11 +29,16 @@ import pwd ...@@ -29,11 +29,16 @@ import pwd
import grp import grp
import os import os
import shlex import shlex
import ConfigParser
from slapos.recipe.librecipe import GenericBaseRecipe from slapos.recipe.librecipe import GenericBaseRecipe
def login_shell(args): def login_shell(args):
password = args['password'] password = args['password']
if args.get('knowledge0_cfg'):
parser = ConfigParser.ConfigParser()
parser.read(args['knowledge0_cfg'])
password = parser.get('public', 'shell-password')
if (password != ''): if (password != ''):
entered_password = getpass() entered_password = getpass()
...@@ -96,7 +101,8 @@ class Recipe(GenericBaseRecipe): ...@@ -96,7 +101,8 @@ class Recipe(GenericBaseRecipe):
'%s.login_shell' % __name__, '%s.login_shell' % __name__,
{ {
'password': self.options['password'], 'password': self.options['password'],
'shell': self.options['shell'] 'shell': self.options['shell'],
'knowledge0_cfg': self.options.get('knowledge0_cfg')
} }
) )
path_list.append(login_shell) path_list.append(login_shell)
......
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