From: robk-tahoe Date: Tue, 11 Mar 2008 00:50:44 +0000 (-0700) Subject: confwiz: write accountname to a file X-Git-Tag: allmydata-tahoe-0.9.0~42 X-Git-Url: https://git.rkrishnan.org/%5B/%5D%20/quickstart.html?a=commitdiff_plain;h=a1f2c9d62428107f87b33266d3f02e5cdfe3ec2e;p=tahoe-lafs%2Ftahoe-lafs.git 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. --- 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()