def doDetectLocalIP(self, *args, **kwargs):
     """
     Action method.
     """
     localip = net_misc.getLocalIp()
     bpio.WriteTextFile(settings.LocalIPFilename(), localip)
     lg.out(4, 'id_registrator.doDetectLocalIP [%s]' % localip)
     self.automat('local-ip-detected')
Exemple #2
0
 def msg(self, msgid, arg=None):
     msg = self.MESSAGES.get(msgid, ['', 'black'])
     text = msg[0] % {
         'login': bpio.ReadTextFile(settings.UserNameFilename()),
         'externalip': misc.readExternalIP(),  # bpio.ReadTextFile(settings.ExternalIPFilename()),
         'localip': bpio.ReadTextFile(settings.LocalIPFilename()), }
     color = 'black'
     if len(msg) == 2:
         color = msg[1]
     return text, color
Exemple #3
0
 def msg(self, msgid, *args, **kwargs):
     msg = self.MESSAGES.get(msgid, ['', 'black'])
     text = msg[0] % {
         'login': strng.to_bin(
             bpio.ReadTextFile(settings.UserNameFilename())),
         'externalip': strng.to_bin(misc.readExternalIP()),
         'localip': strng.to_bin(
             bpio.ReadTextFile(settings.LocalIPFilename())),
     }
     color = 'black'
     if len(msg) == 2:
         color = msg[1]
     return text, color
Exemple #4
0
def readLocalIP():
    """
    Read local IP stored in the file [BitDust data dir]/metadata/localip.
    """
    return bpio.ReadTextFile(settings.LocalIPFilename()).strip()