Beispiel #1
0
def getMessageWebLink(message):
    """
    Get the on-line documentation link target for this message, if any.

    @param message: the message
    @type message: L{flumotion.common.messages.Message}
    """
    if not message.description:
        return None

    from flumotion.project import project
    try:
        projectURL = project.get(message.project, 'docurl')
    except errors.NoProjectError:
        projectURL = None

    return getWebLink(section=message.section,
                      anchor=(message.anchor or ''),
                      version=message.version,
                      projectURL=projectURL)
def getMessageWebLink(message):
    """
    Get the on-line documentation link target for this message, if any.

    @param message: the message
    @type message: L{flumotion.common.messages.Message}
    """
    if not message.description:
        return None

    from flumotion.project import project
    try:
        projectURL = project.get(message.project, 'docurl')
    except errors.NoProjectError:
        projectURL = None

    return getWebLink(section=message.section,
                      anchor=(message.anchor or ''),
                      version=message.version,
                      projectURL=projectURL)
Beispiel #3
0
    def _addComponent(self, conf, parent, identity):
        """
        Add a component state for the given component config entry.

        @rtype: L{flumotion.common.planet.ManagerComponentState}
        """

        self.debug('adding component %s to %s'
                   % (conf.name, parent.get('name')))

        if identity != LOCAL_IDENTITY:
            self.adminAction(identity, '_addComponent', (conf, parent), {})

        state = planet.ManagerComponentState()
        state.set('name', conf.name)
        state.set('type', conf.getType())
        state.set('workerRequested', conf.worker)
        state.setMood(moods.sleeping.value)
        state.set('config', conf.getConfigDict())

        state.set('parent', parent)
        parent.append('components', state)

        avatarId = conf.getConfigDict()['avatarId']

        self.clearMessage('loadComponent-%s' % avatarId)

        configDict = conf.getConfigDict()
        projectName = configDict['project']
        versionTuple = configDict['version']

        projectVersion = None
        try:
            projectVersion = project.get(projectName, 'version')
        except errors.NoProjectError:
            m = messages.Warning(T_(N_(
                "This component is configured for Flumotion project '%s', "
                "but that project is not installed.\n"),
                    projectName))
            state.append('messages', m)

        if projectVersion:
            self.debug('project %s, version %r, project version %r' % (
                projectName, versionTuple, projectVersion))
            if not common.checkVersionsCompat(
                    versionTuple,
                    common.versionStringToTuple(projectVersion)):
                m = messages.Warning(T_(N_(
                    "This component is configured for "
                    "Flumotion '%s' version %s, "
                    "but you are running version %s.\n"
                    "Please update the configuration of the component.\n"),
                        projectName, common.versionTupleToString(versionTuple),
                        projectVersion))
                state.append('messages', m)

        # add to mapper
        m = ComponentMapper()
        m.state = state
        m.id = avatarId
        self._componentMappers[state] = m
        self._componentMappers[avatarId] = m

        return state
Beispiel #4
0
def main(args):
    from flumotion.common import setup
    setup.setupPackagePath()
    from flumotion.configure import configure
    log.debug('launch', 'Running Flumotion version %s' %
        configure.version)
    import twisted.copyright
    log.debug('launch', 'Running against Twisted version %s' %
        twisted.copyright.version)
    from flumotion.project import project
    for p in project.list():
        log.debug('launch', 'Registered project %s version %s' % (
            p, project.get(p, 'version')))

    parser = OptionParser(domain="flumotion-launch")

    log.debug('launch', 'Parsing arguments (%r)' % ', '.join(args))
    options, args = parser.parse_args(args)

    i18n.installGettext()

    # verbose overrides --debug
    if options.verbose:
        log.setFluDebug("*:3")

    # handle all options
    if options.version:
        print common.version("flumotion-launch")
        return 0

    if options.debug:
        log.setFluDebug(options.debug)

    # note parser versus parse
    configs = parse.parse_args(args[1:])

    # load the modules, make the component
    wrappers = [ComponentWrapper(config) for config in configs]

    # make socket pairs
    fds = make_pipes(wrappers)

    reactor.running = False
    reactor.failure = False
    reactor.callLater(0, lambda: setattr(reactor, 'running', True))

    d = start_components(wrappers, fds)

    def errback(failure):
        log.debug('launch', log.getFailureMessage(failure))
        print "Error occurred: %s" % failure.getErrorMessage()
        failure.printDetailedTraceback()
        reactor.failure = True
        if reactor.running:
            print "Stopping reactor."
            reactor.stop()
    d.addErrback(errback)

    if not reactor.failure:
        print 'Running the reactor. Press Ctrl-C to exit.'

        log.debug('launch', 'Starting reactor')
        reactor.run()

        log.debug('launch', 'Reactor stopped')

    if reactor.failure:
        return 1
    else:
        return 0
Beispiel #5
0
        return 1

    # register package path
    setup.setupPackagePath()

    # log our standardized starting marker
    log.info("manager", "Starting manager '%s'" % options.name)

    log.debug("manager", "Running Flumotion version %s" % configure.version)
    import twisted.copyright

    log.debug("manager", "Running against Twisted version %s" % twisted.copyright.version)
    from flumotion.project import project

    for p in project.list():
        log.debug("manager", "Registered project %s version %s" % (p, project.get(p, "version")))

    vishnu = manager.Vishnu(options.name, configDir=managerConfigDir)
    for managerConfigFile in args[1:]:
        vishnu.loadManagerConfigurationXML(managerConfigFile)

    paths = [os.path.abspath(filename) for filename in args[1:]]
    reactor.callLater(0, _initialLoadConfig, vishnu, paths)
    reactor.callLater(0, vishnu.startManagerPlugs)

    # set up server based on transport
    myServer = server.Server(vishnu)
    try:
        if options.transport == "ssl":
            myServer.startSSL(options.host, options.port, options.certificate, configure.configdir)
        elif options.transport == "tcp":
Beispiel #6
0
    # register package path
    setup.setupPackagePath()

    # log our standardized starting marker
    log.info('manager', "Starting manager '%s'" % options.name)

    log.debug('manager', 'Running Flumotion version %s' %
        configure.version)
    import twisted.copyright
    log.debug('manager', 'Running against Twisted version %s' %
        twisted.copyright.version)
    from flumotion.project import project
    for p in project.list():
        log.debug('manager', 'Registered project %s version %s' % (
            p, project.get(p, 'version')))

    vishnu = manager.Vishnu(options.name, configDir=managerConfigDir)
    for managerConfigFile in args[1:]:
        vishnu.loadManagerConfigurationXML(managerConfigFile)

    paths = [os.path.abspath(filename) for filename in args[1:]]
    reactor.callLater(0, _initialLoadConfig, vishnu, paths)
    reactor.callLater(0, vishnu.startManagerPlugs)

    # set up server based on transport
    myServer = server.Server(vishnu)
    try:
        if options.transport == "ssl":
            myServer.startSSL(options.host, options.port, options.certificate,
                configure.configdir)
Beispiel #7
0
    # register package path
    setup.setupPackagePath()

    # log our standardized starting marker
    log.info('manager', "Starting manager '%s'" % options.name)

    log.debug('manager', 'Running Flumotion version %s' %
        configure.version)
    import twisted.copyright
    log.debug('manager', 'Running against Twisted version %s' %
        twisted.copyright.version)
    from flumotion.project import project
    for p in project.list():
        log.debug('manager', 'Registered project %s version %s' % (
            p, project.get(p, 'version')))

    vishnu = manager.Vishnu(options.name, configDir=managerConfigDir)
    for managerConfigFile in args[1:]:
        vishnu.loadManagerConfigurationXML(managerConfigFile)

    paths = [os.path.abspath(filename) for filename in args[1:]]
    reactor.callLater(0, _initialLoadConfig, vishnu, paths)
    reactor.callLater(0, vishnu.startManagerPlugs)

    # set up server based on transport
    myServer = server.Server(vishnu)
    try:
        if options.transport == "ssl":
            myServer.startSSL(options.host, options.port, options.certificate,
                configure.configdir)