Exemplo n.º 1
0
 def doRequestMyIdentity(self, arg):
     login = dhnio.ReadTextFile(settings.UserNameFilename())
     idurl = nameurl.UrlMake('http', settings.IdentityServerName(), '', login+'.xml')
     dhnio.Dprint(4, 'identity_registrator.doRequestMyIdentity login=%s, idurl=%s' % (login, idurl))
     dhnnet.getPageTwisted(idurl).addCallbacks(
         lambda src: self.automat('my-id-exist', src),
         lambda err: self.automat('my-id-not-exist', err))
Exemplo n.º 2
0
 def doRequestMyIdentity(self, arg):
     global _WorkingIDURL
     idurl = _WorkingIDURL
     dhnio.Dprint(4, 'identity_restorer.doRequestMyIdentity %s' % idurl)
     dhnnet.getPageTwisted(idurl).addCallbacks(
         lambda src: self.automat('my-id-received', src),
         lambda err: self.automat('my-id-failed', err))
Exemplo n.º 3
0
def download_info():
    
    def _done(src, result):
        dhnio.Dprint(6, 'dhnupdate.download_info.done ')
        lines = src.split('\n')
        files_dict = {}
        for line in lines:
            words = line.split(' ')
            if len(words) < 2:
                continue
            files_dict[words[1].strip()] = words[0].strip()
        result.callback(files_dict)
        return src
    
    def _fail(x, result):
        dhnio.Dprint(1, 'dhnupdate.download_info FAILED')
        result.errback(Exception('error downloading info'))
        return x
    
    repo, locationURL = misc.ReadRepoLocation()
    url = locationURL + settings.FilesDigestsFilename()

    dhnio.Dprint(6, 'dhnupdate.download_info ' + str(url))
    result = Deferred()
    d = dhnnet.getPageTwisted(url)
    d.addCallback(_done, result)
    d.addErrback(_fail, result)
    return result
Exemplo n.º 4
0
 def doPingIdentityServer(self, arg):
     server_url = nameurl.UrlMake('http', settings.IdentityServerName())
     dhnnet.getPageTwisted(server_url).addCallbacks(
         lambda src: self.automat('id-server-response', src),
         lambda err: self.automat('id-server-failed', err))
Exemplo n.º 5
0
def download_version():
    repo, locationURL = misc.ReadRepoLocation()
    url = locationURL + settings.CurrentVersionDigestsFilename()
    dhnio.Dprint(6, 'dhnupdate.download_version ' + str(url))
    return dhnnet.getPageTwisted(url)