system_setup: dryrun username

This commit is contained in:
Jinming Wu, Patrick 2021-08-09 23:20:25 +08:00 committed by Jean-Baptiste Lallement
parent 3536f0517a
commit 6bb86645ea
2 changed files with 17 additions and 4 deletions

View File

@ -36,3 +36,15 @@ class WSLIdentityController(IdentityController):
username=self.answers['username'],
crypted_password=self.answers['password'])
self.done(identity)
def done(self, identity_data):
log.debug(
"IdentityController.done next_screen user_spec=%s",
identity_data)
if self.opts.dry_run:
username = "dryrun_user"
else:
username = identity_data.username
with open('/var/run/ubuntu_wsl_oobe_assigned_account', 'w') as f:
f.write(username)
self.app.next_screen(self.endpoint.POST(identity_data))

View File

@ -5,7 +5,7 @@ Overview provides user with the overview of all the current settings.
"""
import os
import logging
from subiquitycore.ui.buttons import done_btn
@ -20,9 +20,10 @@ class OverviewView(BaseView):
def __init__(self, controller):
self.controller = controller
user_name = "test"
#with open('/var/lib/ubuntu-wsl/assigned_account', 'r') as f:
# user_name = f.read()
user_name = ""
with open('/var/run/ubuntu_wsl_oobe_assigned_account', 'r') as f:
user_name = f.read()
os.remove('/var/run/ubuntu_wsl_oobe_assigned_account')
complete_text = _("Hi {username},\n"
"You have complete the setup!\n\n"
"It is suggested to run the following command to update your Ubuntu "