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

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

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • fuse-7.6-DR1
    • fuse-7.5-ER1
    • Karaf
    • None
    • Fuse 7.5 Sprint 53 - Blockers

      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
      

      I set break point to line https://github.com/jboss-fuse/karaf/blob/karaf-4.2.6.fuse-750013/tooling/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/client/ClientMojo.java#L150 and printed out sw.toString() I have following output.

      config:property-set log4j2.logger.CustomLogger.name CustomLogger
      config:property-set log4j2.appender.log-eip-test.routes.context.rolling.policies.size.size 16MB
      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.type Policies
      config:property-set log4j2.appender.log-eip-test.routes.context.rolling.append false
      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.fileName data/log/camel-log-eip-$\\{ctx:camel.routeId\\}.log
      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.layout.type PatternLayout
      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.type RollingFile
      config:property-set log4j2.appender.log-eip-test.routes.context.type Route
      config:property-set log4j2.appender.log-eip-test.routes.pattern $$\\{ctx:camel.routeId\\}
      config:property-set log4j2.appender.log-eip-test.routes.type Routes
      config:property-set log4j2.appender.log-eip-test.name LogEipTest
      config:property-set log4j2.appender.log-eip-test.type Routing
      config:edit org.ops4j.pax.logging
      

      First issue is that first command from my script is last command in executed string list (see config:edit org.ops4j.pax.logging).

      Second issue not all commands are contained in executed string. For example I miss config:update command in executed string. Basicly script file has 27 lines (excluding empty lines) and executed string has only 17 lines.

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

                Created:
                Updated:
                Resolved: