Changeset 10434 in genesis


Ignore:
Timestamp:
Apr 12, 2012, 7:34:31 AM (13 years ago)
Author:
rick
Message:

Lets start storing the board type in gformat, to give a better look of the hardware in production (and check interface naming for example).

Files:
17 edited

Legend:

Unmodified
Added
Removed
  • nodes/proxy10/wleiden.yaml

    r10374 r10434  
    22# vim:ts=2:et:sw=2:ai
    33#
     4board     : "net45xx"
    45comment   : "None"
    56externalif: "sis1"
  • nodes/proxy11/wleiden.yaml

    r10374 r10434  
    22# vim:ts=2:et:sw=2:ai
    33#
     4board     : "net45xx"
    45comment   : "None"
    56externalif: "sis1"
  • nodes/proxy12/wleiden.yaml

    r10374 r10434  
    22# vim:ts=2:et:sw=2:ai
    33#
     4board     : "net45xx"
    45comment   : "None"
    56externalif: "sis0"
  • nodes/proxy14/wleiden.yaml

    r10416 r10434  
    22# vim:ts=2:et:sw=2:ai
    33#
     4board     : "net45xx"
    45comment   : "None"
    56externalif: "sis0"
  • nodes/proxy16/wleiden.yaml

    r10374 r10434  
    22# vim:ts=2:et:sw=2:ai
    33#
     4board     : "net45xx"
    45comment   : "None"
    56externalif: "sis0"
  • nodes/proxy17/wleiden.yaml

    r10400 r10434  
    22# vim:ts=2:et:sw=2:ai
    33#
     4board     : "ALIX2"
    45comment   : "None"
    56externalif: "vr0"
  • nodes/proxy18/wleiden.yaml

    r10374 r10434  
    22# vim:ts=2:et:sw=2:ai
    33#
     4board     : "net45xx"
    45comment   : "None"
    56externalif: "sis0"
  • nodes/proxy2/wleiden.yaml

    r10374 r10434  
    22# vim:ts=2:et:sw=2:ai
    33#
     4board     : "net45xx"
    45comment   : "None"
    56externalif: "sis0"
  • nodes/proxy20/wleiden.yaml

    r10399 r10434  
    22# vim:ts=2:et:sw=2:ai
    33#
     4board     : "net45xx"
    45comment   : "None"
    56externalif: "sis0"
  • nodes/proxy3/wleiden.yaml

    r10374 r10434  
    22# vim:ts=2:et:sw=2:ai
    33#
     4board     : "net45xx"
    45comment   : "None"
    56externalif: "sis0"
  • nodes/proxy4/wleiden.yaml

    r10374 r10434  
    22# vim:ts=2:et:sw=2:ai
    33#
     4board     : "net45xx"
    45comment   : "None"
    56externalif: "sis0"
  • nodes/proxy5/wleiden.yaml

    r10374 r10434  
    22# vim:ts=2:et:sw=2:ai
    33#
     4board     : "net45xx"
    45comment   : " verbonden met glasvezel gateway 192.168.0.1 nameservers: 217.149.192.6 en 217.149.196.6 "
    56externalif: "sis0"
  • nodes/proxy6/wleiden.yaml

    r10396 r10434  
    22# vim:ts=2:et:sw=2:ai
    33#
     4board     : "net45xx"
    45comment   : "None"
    56externalif: "sis0"
  • nodes/proxy7/wleiden.yaml

    r10374 r10434  
    22# vim:ts=2:et:sw=2:ai
    33#
     4board     : "ALIX2"
    45comment   : " verbonden met 'vuil' internet van Zorggroep Rijnland lokaal ip en nameservers via dhcp LET OP: niet standaard configuratie ivm lokale ap's!"
    56externalif: "vr0"
  • nodes/proxy9/wleiden.yaml

    r10374 r10434  
    22# vim:ts=2:et:sw=2:ai
    33#
     4board     : "net45xx"
    45comment   : "None"
    56externalif: "sis0"
  • nodes/proxy97/wleiden.yaml

    r10374 r10434  
    22# vim:ts=2:et:sw=2:ai
    33#
     4board     : "net45xx"
    45comment   : "None"
    56externalif: "sis0"
  • tools/check-batch-cmd

    r10433 r10434  
    5151  pass
    5252
     53class ConnectError(Exception):
     54  pass
     55
    5356
    5457
    5558def host_ssh_cmd(hostname, cmd):
    56   ssh = paramiko.SSHClient()
    57   ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
    58   ssh.connect(hostname, username='root', password=SSHPASS,timeout=3)
    59   stdin, stdout, stderr = ssh.exec_command(cmd)
    60   stdout = stdout.readlines()
    61   stderr = stderr.readlines()
    62   ssh.close()
    63   if stderr:
    64     raise CmdError((stderr, stdout))
    65   return stdout
     59  try:
     60    ssh = paramiko.SSHClient()
     61    ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
     62    ssh.connect(hostname, username='root', password=SSHPASS,timeout=3)
     63    stdin, stdout, stderr = ssh.exec_command(cmd)
     64    stdout = stdout.readlines()
     65    stderr = stderr.readlines()
     66    ssh.close()
     67    if stderr:
     68      raise CmdError((stderr, stdout))
     69    return stdout
     70  except socket.error, e:
     71    raise ConnectError(e)
    6672
    6773def parse_ini(lines):
     
    168174  parser = argparse.ArgumentParser(prog='Various WL management tools')
    169175  parser.add_argument('--ask-pass', dest="ask_pass", action='store_true', help='Ask password if SSHPASS is not found')
     176  parser.add_argument('--filter', dest="use_filter", action='store_true', help='Thread the host definition as an filter')
    170177  subparsers = parser.add_subparsers(help='sub-command help')
    171178 
     
    189196      SSHPASS = getpass.getpass("WL root password: ")
    190197
    191   # XXX: We need this loop when using filters
    192   #for host in gformat.get_hostlist():
    193   #  if filters and not any([f.lower() in host.lower() for f in filters]):
    194   #    continue
    195 
    196 
    197   if args.func == 'bridge':
    198     if args.action == 'keys':
    199       ubnt_keys(args.host)
    200     elif args.action == 'snmp':
    201       ubnt_snmp(args.host)
    202     elif args.action == 'probe':
    203       ubnt_probe(args.host)
    204   elif args.func == 'node':
    205     if args.action == 'check':
    206       node_check(args.host)
     198
     199  if args.use_filter:
     200    hosts = []
     201    for host in gformat.get_hostlist():
     202      if args.host in host:
     203        hosts.append(host)
     204  else:
     205    hosts = [args.host]
     206
     207
     208  for host in hosts:
     209    try:
     210      if args.func == 'bridge':
     211        if args.action == 'keys':
     212          ubnt_keys(host)
     213        elif args.action == 'snmp':
     214          ubnt_snmp(host)
     215        elif args.action == 'probe':
     216          ubnt_probe(host)
     217      elif args.func == 'node':
     218        if args.action == 'check':
     219          node_check(host)
     220    except ConnectError:
     221      print "#ERR: Connection failed to host %s" % host
Note: See TracChangeset for help on using the changeset viewer.