From a1f2c9d62428107f87b33266d3f02e5cdfe3ec2e Mon Sep 17 00:00:00 2001 From: robk-tahoe Date: Mon, 10 Mar 2008 17:50:44 -0700 Subject: [PATCH] confwiz: write accountname to a file motivated simply by a desire to be able to identify 'noderoot' directories for debugging and testing, the confwiz now writes an 'accountname' files based on what account was used when the node was configured. this is not currently read by or used by any code in the system, but helps identify directories from testing. --- src/allmydata/gui/confwiz.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/allmydata/gui/confwiz.py b/src/allmydata/gui/confwiz.py index ec36caaa..c5a4c610 100644 --- a/src/allmydata/gui/confwiz.py +++ b/src/allmydata/gui/confwiz.py @@ -132,16 +132,16 @@ def get_nickname(): nick = socket.gethostname() return nick -def maybe_write_nickname(nickname): - nnfile = os.path.join(get_basedir(), 'nickname') +def maybe_write_file(filename, contents): + fname = os.path.join(get_basedir(), filename) try: - if not os.path.exists(nnfile): - fh = file(nnfile, 'wb') - fh.write(nickname) + if not os.path.exists(fname): + fh = file(fname, 'wb') + fh.write(contents) fh.write('\n') fh.close() except: - DisplayTraceback('Failed to write nickname file %s' % (nnfile,)) + DisplayTraceback('Failed to write file %s' % (fname,)) def configure(backend, user, passwd): _config_re = re.compile('^([^:]*): (.*)$') @@ -348,7 +348,8 @@ class LoginPanel(wx.Panel): configure(backend, user, passwd) maybe_start_services() - maybe_write_nickname(nickname) + maybe_write_file('nickname', nickname) + maybe_write_file('accountname', user) self.app.open_welcome_page() @@ -495,7 +496,8 @@ class RegisterPanel(wx.Panel): configure(backend, user, passwd) maybe_start_services() - maybe_write_nickname(nickname) + maybe_write_file('nickname', nickname) + maybe_write_file('accountname', user) self.app.open_welcome_page() -- 2.45.2