|
|
@ -24,8 +24,12 @@ def clean_kasm_users():
|
|
|
|
password_file = os.path.join(home_dir, ".kasmpasswd")
|
|
|
|
password_file = os.path.join(home_dir, ".kasmpasswd")
|
|
|
|
Path(password_file).remove_p()
|
|
|
|
Path(password_file).remove_p()
|
|
|
|
|
|
|
|
|
|
|
|
vnc_dir = os.path.join(home_dir, ".vnc")
|
|
|
|
|
|
|
|
Path(vnc_dir).rmtree(ignore_errors=True)
|
|
|
|
def start_xvnc_pexpect(extra_args="", **kwargs):
|
|
|
|
|
|
|
|
child = pexpect.spawn('/bin/bash',
|
|
|
|
|
|
|
|
['-ic', f':;{vncserver_cmd} {extra_args}'],
|
|
|
|
|
|
|
|
timeout=5, encoding='utf-8', **kwargs)
|
|
|
|
|
|
|
|
return child
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def start_xvnc(extra_args="", **kwargs):
|
|
|
|
def start_xvnc(extra_args="", **kwargs):
|
|
|
@ -135,9 +139,12 @@ with description('vncserver') as self:
|
|
|
|
check_de_was_setup_to_run('cinnamon')
|
|
|
|
check_de_was_setup_to_run('cinnamon')
|
|
|
|
|
|
|
|
|
|
|
|
with context('guided user creation'):
|
|
|
|
with context('guided user creation'):
|
|
|
|
with it('asks to create a user if none exist'):
|
|
|
|
with fit('asks to create a user if none exist'):
|
|
|
|
child = pexpect.spawn(f'{vncserver_cmd} -select-de cinnamon',
|
|
|
|
global running_xvnc
|
|
|
|
timeout=2)
|
|
|
|
clean_kasm_users()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
child = start_xvnc_pexpect('-select-de cinnamon')
|
|
|
|
|
|
|
|
running_xvnc = True
|
|
|
|
child.expect('Enter username')
|
|
|
|
child.expect('Enter username')
|
|
|
|
child.sendline()
|
|
|
|
child.sendline()
|
|
|
|
child.expect('Password:')
|
|
|
|
child.expect('Password:')
|
|
|
@ -153,11 +160,11 @@ with description('vncserver') as self:
|
|
|
|
completed_process = run_cmd(f'grep -qw {user} {home_dir}/.kasmpasswd')
|
|
|
|
completed_process = run_cmd(f'grep -qw {user} {home_dir}/.kasmpasswd')
|
|
|
|
expect(completed_process.returncode).to(equal(0))
|
|
|
|
expect(completed_process.returncode).to(equal(0))
|
|
|
|
|
|
|
|
|
|
|
|
with fit('specify custom username'):
|
|
|
|
with it('specify custom username'):
|
|
|
|
|
|
|
|
global running_xvnc
|
|
|
|
|
|
|
|
|
|
|
|
custom_username = 'custom_username'
|
|
|
|
custom_username = 'custom_username'
|
|
|
|
child = pexpect.spawn('/bin/bash',
|
|
|
|
child = start_xvnc_pexpect('-select-de cinnamon')
|
|
|
|
['-ic', f':;{vncserver_cmd} -select-de cinnamon'],
|
|
|
|
|
|
|
|
timeout=5, encoding='utf-8')
|
|
|
|
|
|
|
|
running_xvnc = True
|
|
|
|
running_xvnc = True
|
|
|
|
child.logfile_read = sys.stderr
|
|
|
|
child.logfile_read = sys.stderr
|
|
|
|
child.expect('Enter username')
|
|
|
|
child.expect('Enter username')
|
|
|
|