Exemplo n.º 1
0
    def run(self, options):
        """ the main program function

        :param options: parser options
        :type options: :class:`argparse.Namespace`
        """

        if not PYTANGO:
            sys.stderr.write("Info: No PyTango installed\n")
            sys.exit(255)

        if not options.server:
            options.server = checkServer()
            if not options.server:
                print("")
                sys.exit(0)
        if not options.pool:
            options.pool = checkServer("Pool")
            if not options.pool:
                print("")
                sys.exit(0)
        args = options.args

        print("INPUT: %s" % args)
        if options.directory:
            print("OUTPUT DIR: %s" % options.directory)
        elif options.database:
            print("SERVER: %s" % options.server)
        else:
            print("TEST MODE: %s" % options.server)

        creator = PoolDSCreator(options, args)
        creator.create()
Exemplo n.º 2
0
    def run(self, options):
        """ the main program function

        :param options: parser options
        :type options: :class:`argparse.Namespace`
        """

        parser = self._parser
        if not PYTANGO:
            sys.stderr.write("Info: No PyTango installed\n")
            sys.exit(255)

        if not options.server:
            options.server = checkServer()
            if not options.server:
                print("")
                sys.exit(0)
        args = [options.args] if options.args else []
        if not len(args) and os.path.isfile('/online_dir/online.xml'):
            args = ['/online_dir/online.xml']

        if not len(args):
            parser.print_help()
            sys.exit(255)

        print("INPUT: %s" % args)
        if options.directory:
            print("OUTPUT DIR: %s" % options.directory)
        elif options.database:
            print("SERVER: %s" % options.server)
        else:
            print("TEST MODE: %s" % options.server)

        creator = OnlineDSCreator(options, args)
        creator.create()
Exemplo n.º 3
0
    def run(self, options):
        """ the main program function

        :param options: parser options
        :type options: :class:`argparse.Namespace`
        """

        parser = self._parser
        if options.database and not options.server:
            if not PYTANGO:
                sys.stderr.write("Info: No PyTango installed\n")
                sys.exit(255)

            options.server = checkServer()
            if not options.server:
                print("")
                sys.exit(0)

        if options.database:
            print("CONFIG SERVER: %s" % options.server)
        else:
            print("OUTPUT DIRECTORY: %s" % options.directory)

        creator = ClientDSCreator(options, options.args or [])
        try:
            creator.create()
        except WrongParameterError as e:
            sys.stderr.write(str(e))
            parser.print_help()
            sys.exit(255)
Exemplo n.º 4
0
    def run(self, options):
        """ the main program function

        :param options: parser options
        :type options: :class:`argparse.Namespace`
        """

        parser = self._parser
        if (options.database and not options.server) or \
           (not options.host and not options.server):
            if not PYTANGO:
                sys.stderr.write("Info: No PyTango installed\n")
                sys.exit(255)

            options.server = checkServer()
            if not options.server:
                print("")
                sys.exit(0)

        if not options.host:
            if not PYTANGO:
                print >> sys.stderr, \
                    "Info: No Tango Host or PyTango installed\n"
                sys.exit(255)
            hostport = getServerTangoHost(options.server)
            options.host, options.port = hostport.split(":")

        if options.database:
            print("CONFIG SERVER: %s" % options.server)
        else:
            print("OUTPUT DIRECTORY: %s" % options.directory)

        if not options.device.strip():
            parser.print_help()
            sys.exit(255)

        if options.args:
            aargs = list(options.args)
        else:
            if not PYTANGO:
                sys.stderr.write("CollCompCreator No PyTango installed\n")
                parser.print_help()
                sys.exit(255)
            aargs = getAttributes(options.device, options.host, options.port)

        creator = DeviceDSCreator(options, aargs)
        creator.create()
Exemplo n.º 5
0
    def run(self, options):
        """ the main program function

        :param options: parser options
        :type options: :class:`argparse.Namespace`
        """
        parser = self._parser
        if not PYTANGO:
            sys.stderr.write("Info: No PyTango installed\n")
            parser.print_help()
            sys.exit(255)

        args = options.args or []

        creator = StandardCPCreator(options, args)
        if options.component and options.cptype:
            if not options.server:
                options.server = checkServer()
                if not options.server:
                    print("")
                    sys.exit(0)

            if options.database:
                print("SERVER: %s" % options.server)
            else:
                print("OUTPUT DIR: %s" % options.directory)

            try:
                creator.create()
            except CPExistsException as e:
                print(str(e))
        elif options.cptype:
            dct = creator.listcomponentvariables()
            print("\nCOMPONENT VARIABLES:")
            for var in sorted(dct.keys()):
                desc = dct[var]
                if not var.startswith('__') and not var.endswith('__'):
                    print("  %s - %s [default: '%s']" %
                          (var, desc['doc'], desc['default']))
        else:
            parser.print_help()
            print("")
            lst = sorted(creator.listcomponenttypes())
            print("\nPOSSIBLE COMPONENT TYPES: \n   %s" % " ".join(lst))
Exemplo n.º 6
0
    def run(self, options):
        """ the main program function

        :param options: parser options
        :type options: :class:`argparse.Namespace`
        """

        parser = self._parser
        if not PYTANGO:
            sys.stderr.write("Info: No PyTango installed\n")
            sys.exit(255)

        if not options.server:
            options.server = checkServer()
            if not options.server:
                print("")
                sys.exit(0)

        args = [options.args] if options.args else []
        if not len(args) and os.path.isfile('/online_dir/online.xml'):
            args = ['/online_dir/online.xml']

        if not len(args):
            parser.print_help()
            sys.exit(255)

        print("INPUT: %s" % args[0])
        if options.database:
            print("SERVER: %s" % options.server)
        else:
            print("OUTPUT DIR: %s" % options.directory)

        creator = OnlineCPCreator(options, args)
        if options.component:
            try:
                creator.create()
            except CPExistsException as e:
                print(str(e))
        else:
            lst = creator.listcomponents()
            print("\nPOSSIBLE COMPONENTS: \n   %s" % " ".join(list(lst)))
Exemplo n.º 7
0
    def run(self, options):
        """ the main program function

        :param options: parser options
        :type options: :class:`argparse.Namespace`
        """

        parser = self._parser
        if (options.database and not options.server) or \
           (not options.host and not options.server):
            if not PYTANGO:
                sys.stderr.write("Info: No PyTango installed\n")
                sys.exit(255)

            options.server = checkServer()
            if not options.server:
                print("")
                sys.exit(0)

        if not options.host:
            if not PYTANGO:
                sys.stderr.write("Info: No Tango Host or PyTango installed\n")
                sys.exit(255)
            hostport = getServerTangoHost(options.server)
            options.host, options.port = hostport.split(":")

        if options.database:
            print("CONFIG SERVER: %s" % str(options.server))
        else:
            print("OUTPUT DIRECTORY: %s" % str(options.directory))

        creator = TangoDSCreator(options, [])
        try:
            creator.create()
        except WrongParameterError as e:
            sys.stderr.write(str(e))
            parser.print_help()
            sys.exit(255)