from allmydata.immutable.offloaded import Helper
from allmydata.control import ControlServer
from allmydata.introducer.client import IntroducerClient
-from allmydata.util import hashutil, base32, pollmixin, log, keyutil
+from allmydata.util import hashutil, base32, pollmixin, log, keyutil, idlib
from allmydata.util.encodingutil import get_filesystem_encoding
from allmydata.util.abbreviate import parse_abbreviated_size
from allmydata.util.time_format import parse_duration, parse_date
self.write_config("node.pubkey", vk_vs+"\n")
self._node_key = sk
+ def get_long_nodeid(self):
+ # this matches what IServer.get_longname() says about us elsewhere
+ vk_bytes = self._node_key.get_verifying_key_bytes()
+ return "v0-"+base32.b2a(vk_bytes)
+
+ def get_long_tubid(self):
+ return idlib.nodeid_b2a(self.nodeid)
+
def _init_permutation_seed(self, ss):
seed = self.get_config_from_file("permutation-seed")
if not seed:
-from base64 import b32encode
import os, re, sys, time, simplejson
from cStringIO import StringIO
d = getPage(base)
def _got_welcome(page):
html = page.replace('\n', ' ')
- connected_re = "Connected to <span>%d</span>[ ]*of <span>%d</span> known storage servers" % (self.numclients, self.numclients)
+ connected_re = r'Connected to <span>%d</span>\s*of <span>%d</span> known storage servers' % (self.numclients, self.numclients)
self.failUnless(re.search(connected_re, html),
"I didn't see the right '%s' message in:\n%s" % (connected_re, page))
- nodeid_re = "<th>Node ID:</th>[ ]*<td>%s</td>" % (re.escape(b32encode(self.clients[0].nodeid).lower()),)
+ # nodeids/tubids don't have any regexp-special characters
+ nodeid_re = r'<th>Node ID:</th>\s*<td title="TubID: %s">%s</td>' % (
+ self.clients[0].get_long_tubid(), self.clients[0].get_long_nodeid())
self.failUnless(re.search(nodeid_re, html),
"I didn't see the right '%s' message in:\n%s" % (nodeid_re, page))
self.failUnless("Helper: 0 active uploads" in page)
d.addCallback(lambda res: getPage(self.helper_webish_url))
def _got_welcome_helper(page):
html = page.replace('\n', ' ')
- self.failUnless(re.search('<div class="status-indicator connected-yes"></div>[ ]*<div>Helper</div>', html), page)
+ self.failUnless(re.search(r'<div class="status-indicator connected-yes"></div>\s*<div>Helper</div>', html), page)
self.failUnlessIn("Not running helper", page)
d.addCallback(_got_welcome_helper)
self.mutable_file_default = SDMF_VERSION
self.addService(FakeStorageServer(self.nodeid, self.nickname))
+ def get_long_nodeid(self):
+ return "v0-nodeid"
+ def get_long_tubid(self):
+ return "tubid"
+
def startService(self):
return service.MultiService.startService(self)
def stopService(self):
import allmydata # to display import path
from allmydata import get_package_versions_string
-from allmydata.util import idlib, log
+from allmydata.util import log
from allmydata.interfaces import IFileNode
from allmydata.web import filenode, directory, unlinked, status, operations
from allmydata.web import storage
return get_package_versions_string()
def data_import_path(self, ctx, data):
return str(allmydata)
- def data_my_nodeid(self, ctx, data):
- return idlib.nodeid_b2a(self.client.nodeid)
+ def render_my_nodeid(self, ctx, data):
+ tubid_s = "TubID: "+self.client.get_long_tubid()
+ return T.td(title=tubid_s)[self.client.get_long_nodeid()]
def data_my_nickname(self, ctx, data):
return self.client.nickname
</tr>
<tr>
<th>Node ID:</th>
- <td n:render="string" n:data="my_nodeid" />
+ <td n:render="my_nodeid" />
</tr>
</table>
</div>