Ejemplo n.º 1
0
 def setUp(self):
     self.hosts = []
     factory = g2h.HostFactory()
     for hs in ss.Host.objects.all():
         h = factory.create_host(hs)
         if not isinstance(h, g2h.G2LocalHost) and h.active:
             self.hosts.append(h)
Ejemplo n.º 2
0
from django.core.management import setup_environ
import settings as s
setup_environ(s)

import systemsettings.models as ss
import operations.core.g2hosts as g2h


def parse_arguments():
    parser = argparse.ArgumentParser()
    parser.add_argument('-r', '--restrict_pattern', help='A regular expression with ' \
                        'the pattern to filter the path_list.')
    parser.add_argument('host', help='The remote host\'s name, as defined ' \
                        'in the g2system settings.')
    parser.add_argument('path_list', metavar='path', nargs='+',
                        help='A list of paths, interpreted as ' \
                        'regular expressions to search on the remote host.')
    return parser.parse_args()


if __name__ == '__main__':
    args = parse_arguments()
    factory = g2h.HostFactory()
    remote_host_settings = ss.Host.objects.get(name=args.host)
    remote_host = factory.create_host(remote_host_settings)
    found = remote_host.find(args.path_list,
                             restrict_pattern=args.restrict_pattern)
    remote_host.close_connection()
    for path in found:
        print(path)
Ejemplo n.º 3
0
 def setUp(self):
     self.factory = g2h.HostFactory()
Ejemplo n.º 4
0
 def setUp(self):
     timeslot = dt.datetime(2012, 7, 7),
     settings = ss.Package.objects.get(name='postprocess_swi'),
     area = ss.Area.objects.get(area='.*')
     host = g2h.HostFactory().create_host()
     self.swi_pack = g2p.SWIProcessor(settings, timeslot, area, host)
Ejemplo n.º 5
0
 def setUp(self):
     factory = g2h.HostFactory()
     self.host = factory.create_host()