]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
confwiz: write accountname to a file
authorrobk-tahoe <robk-tahoe@allmydata.com>
Tue, 11 Mar 2008 00:50:44 +0000 (17:50 -0700)
committerrobk-tahoe <robk-tahoe@allmydata.com>
Tue, 11 Mar 2008 00:50:44 +0000 (17:50 -0700)
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

index ec36caaa63aaf67b4b6663621190ff0dc31d3fcf..c5a4c61030e766522aabbee10cd48227fed89965 100644 (file)
@@ -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()