Пример #1
0
def main():
    from gate import create_default_gate
    profile = smolt.create_profile(create_default_gate(), smolt.read_uuid())
    session = requests.Session()
    session.headers.update({'USER-AGENT': opts.user_agent})

    o = session.post(opts.smoonURL + '', timeout=opts.timeout)

    exceptions = (requests.exceptions.HTTPError,
                  requests.exceptions.URLRequired,
                  requests.exceptions.Timeout,
                  requests.exceptions.ConnectionError,
                  requests.exceptions.InvalidURL)

    #first find out the server desired protocol
    try:
        #fli is a file like item
        pub_uuid_fli = opts.smoonURL + 'client/pub_uuid?uuid=%s' % profile.host.UUID
        pub_uuid_fli = session.get(pub_uuid_fli, timeout=opts.timeout)
    except exceptions as e:
        error(_('Error contacting Server: %s') % e)
        return 1
    try:
        pub_uuid_obj = pub_uuid_fli.json()
        try:
            print(_('To view your profile visit: %s') % smolt.get_profile_link(opts.smoonURL, pub_uuid_obj["pub_uuid"]))
        except ValueError as e:
            error(_('Something went wrong fetching the public UUID'))
    finally:
        session.close()
Пример #2
0
def read_profile(gate, uuid):
    ensure_code_reachability()
    from i18n import _
    import smolt

    try:
        profile = smolt.create_profile(gate, uuid)
    except smolt.UUIDError, e:
        sys.stderr.write(_('%s\n' % e))
        sys.exit(9)
Пример #3
0
def read_profile(gate, uuid):
    ensure_code_reachability()
    from i18n import _
    import smolt

    try:
        profile = smolt.create_profile(gate, uuid)
    except smolt.UUIDError, e:
        sys.stderr.write(_('%s\n' % e))
        sys.exit(9)
Пример #4
0
def main():
    from gate import create_default_gate
    profile = smolt.create_profile(create_default_gate(), smolt.read_uuid())
    grabber = urlgrabber.grabber.URLGrabber(user_agent=opts.user_agent, timeout=opts.timeout)
    #first find out the server desired protocol
    try:
        #fli is a file like item
        pub_uuid_fli = grabber.urlopen(urljoin(opts.smoonURL + "/", '/client/pub_uuid?uuid=%s' % profile.host.UUID, False))
    except urlgrabber.grabber.URLGrabError, e:
        error(_('Error contacting Server: %s') % e)
        return 1
Пример #5
0
def main():
    from gate import create_default_gate
    profile = smolt.create_profile(create_default_gate(), smolt.read_uuid())
    grabber = urlgrabber.grabber.URLGrabber(user_agent=opts.user_agent, timeout=opts.timeout)
    #first find out the server desired protocol
    try:
        #fli is a file like item
        pub_uuid_fli = grabber.urlopen(urljoin(opts.smoonURL + "/", '/client/pub_uuid?uuid=%s' % profile.host.UUID, False))
    except urlgrabber.grabber.URLGrabError, e:
        error(_('Error contacting Server: %s') % e)
        return 1
Пример #6
0
    for page in r['query']['pages']:
        try:
            if int(page) > 0:
                found.append('\t%swiki/%s' %
                             (smoonURL, r['query']['pages'][page]['title']))
        except KeyError:
            pass

    if found:
        print(_("\tErrata Found!"))
        for f in found:
            print("\t%s" % f)
    else:
        print(
            _("\tNo errata found, if this machine is having issues please go to"
              ))
        print(
            _("\tyour profile and create a wiki page for the device so others can"
              ))
        print(_("\tbenefit"))


if __name__ == "__main__":
    from gate import create_passing_gate
    gate = create_passing_gate()
    smoonURL = get_config_attr("SMOON_URL", "http://smolts.org/")
    profile = smolt.create_profile(gate, smolt.read_uuid())
    scan(profile, smoonURL, gate)
    rating(profile, smoonURL, gate)
Пример #7
0
    scanData = 'action=query&titles=%s&format=json' % searchDevices
    try:
         r = json.load(urllib.urlopen(scanURL, scanData))
    except ValueError:
        print "Could not wiki for errata!"
        return
    found = []

    for page in r['query']['pages']:
        try:
            if int(page) > 0:
                found.append('\t%swiki/%s' % (smoonURL, r['query']['pages'][page]['title']))
        except KeyError:
            pass

    if found:
        print _("\tErrata Found!")
        for f in found: print "\t%s" % f
    else:
        print _("\tNo errata found, if this machine is having issues please go to")
        print _("\tyour profile and create a wiki page for the device so others can")
        print _("\tbenefit")
      
if __name__ == "__main__":  
    from gate import create_passing_gate
    gate = create_passing_gate()
    smoonURL = get_config_attr("SMOON_URL", "http://smolts.org/")
    profile = smolt.create_profile(gate, smolt.read_uuid())
    scan(profile, smoonURL, gate)
    rating(profile, smoonURL, gate)