Uploaded image for project: 'Red Hat Fuse'
  1. Red Hat Fuse
  2. ENTESB-11059

[karaf-maven-plugin] client goal + script execution is not working

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • fuse-7.5-ER1
    • fuse-7.4-GA
    • Karaf
    • None
    • Fuse 7.5 Sprint 50 - Dev #1

      My plugin configuration:

      <plugin>
      	<groupId>org.jboss.redhat-fuse</groupId>
      	<artifactId>karaf-maven-plugin</artifactId>
      	<executions>
      	   <execution>
      	     <id>config-log-eip-test</id>
      		<goals>
      		   <goal>client</goal>
      		</goals>
      		<configuration>
      		  <scripts>
      		    <script>
      			<rank>1</rank>
      			    <script>config-karaf.cli</script>
      		    </script>
      		  </scripts>
      		</configuration>
      	</execution>
         </executions>
      </plugin>
      

      config-karaf.cli

      config:edit org.ops4j.pax.logging
      
      config:property-set log4j2.appender.log-eip-test.type Routing
      config:property-set log4j2.appender.log-eip-test.name LogEipTest
      config:property-set log4j2.appender.log-eip-test.routes.type Routes
      config:property-set log4j2.appender.log-eip-test.routes.pattern $$\\{ctx:camel.routeId\\}
      config:property-set log4j2.appender.log-eip-test.routes.context.type Route
      config:property-set log4j2.appender.log-eip-test.routes.context.rolling.type RollingFile
      config:property-set log4j2.appender.log-eip-test.routes.context.rolling.name LogEipTest-$\\{ctx:camel.routeId\\}
      config:property-set log4j2.appender.log-eip-test.routes.context.rolling.layout.type PatternLayout
      config:property-set log4j2.appender.log-eip-test.routes.context.rolling.layout.pattern '%d{ISO8601} | %c{1} | route=%X{camel.routeId} | %-5.5p | %m%n'
      config:property-set log4j2.appender.log-eip-test.routes.context.rolling.fileName data/log/camel-log-eip-$\\{ctx:camel.routeId\\}.log
      config:property-set log4j2.appender.log-eip-test.routes.context.rolling.filePattern data/log/camel-log-eip-$\\{ctx:camel.routeId\\}.\%i.log.gz
      config:property-set log4j2.appender.log-eip-test.routes.context.rolling.append false
      config:property-set log4j2.appender.log-eip-test.routes.context.rolling.policies.type Policies
      config:property-set log4j2.appender.log-eip-test.routes.context.rolling.policies.size.type SizeBasedTriggeringPolicy
      config:property-set log4j2.appender.log-eip-test.routes.context.rolling.policies.size.size 16MB
      
      config:property-set log4j2.logger.CustomLogger.name CustomLogger
      config:property-set log4j2.logger.CustomLogger.level INFO
      config:property-set log4j2.logger.CustomLogger.appenderRef.LogEipTest.ref LogEipTest
      
      config:property-set log4j2.logger.LoggerA.name LoggerA
      config:property-set log4j2.logger.LoggerA.level INFO
      config:property-set log4j2.logger.LoggerA.appenderRef.LogEipTest.ref LogEipTest
      
      config:property-set log4j2.logger.LoggerB.name LoggerB
      config:property-set log4j2.logger.LoggerB.level INFO
      config:property-set log4j2.logger.LoggerB.appenderRef.LogEipTest.ref LogEipTest
      
      config:property-set log4j2.rootLogger.appenderRef.LogEipTest.ref LogEipTest
      
      config:update
      

      The plugin executes only the first command.

      Problem is in ClientMojo class.

      Commands are stored in SortedSet (https://github.com/jboss-fuse/karaf/blob/4.2.x.redhat-7-x/tooling/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/client/ClientMojo.java#L107)

      Set comparator uses rank value for sorting commands. (https://github.com/jboss-fuse/karaf/blob/4.2.x.redhat-7-x/tooling/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/client/ClientMojo.java#L106)

      The whole script has constant value for rank variable (https://github.com/jboss-fuse/karaf/blob/4.2.x.redhat-7-x/tooling/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/client/ClientMojo.java#L120)

      This means all commands from script are evaluated with same rank and because we have a Set there is stored only the first command from the script.

            yfang@redhat.com Freeman(Yue) Fang
            jbouska@redhat.com Jan Bouska
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: