Uploaded image for project: 'Ambari'
  1. Ambari
  2. AMBARI-8233

Blueprint fails when %HOSTGROUP::name% followed by another %

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 1.7.0
    • 1.7.0
    • ambari-server
    • None

    Description

      I created an HDP 2.2 cluster with all of the services except Knox, Kafka, and Slider, then exported the blueprint, and removed Ganglia from it.

      Then, I attempted to create a single node cluster using the blueprints and ran into a regex error.

      The problem is that one of the properties contains %HOSTGROUP::name% followed by another % and the regex match tries to do greedy matching instead of minimal.
      For example, storm-site.xml had worker.childopts with

      -Xmx768m _JAAS_PLACEHOLDER -javaagent:/usr/hdp/current/storm-client/contrib/storm-jmxetric/lib/jmxetric-1.0.4.jar=host=%HOSTGROUP::host_group_1%,port=8650,wireformat31x=true,mode=multicast,config=/usr/hdp/current/storm-client/contrib/storm-jmxetric/conf/jmxetric-conf.xml,process=Worker_%ID%_JVM
      

      While the regex expression in BlueprintConfigurationProcessor.java is,

      private static Pattern HOSTGROUP_REGEX = Pattern.compile("%HOSTGROUP::(\\S+)%");
      

      Instead, it should be,

      private static Pattern HOSTGROUP_REGEX = Pattern.compile("%HOSTGROUP::(\\S+?)%");
      

      Steps to repro,

      curl -H "X-Requested-By:ambari" -X POST -u admin:admin http://c6410.ambari.apache.org:8080/api/v1/blueprints/hdp22 -d @hdp_22_blueprint.json
      curl -H "X-Requested-By:ambari" -X POST -u admin:admin http://c6410.ambari.apache.org:8080/api/v1/clusters/dev -d @single_node_cluster.json
      

      Returns an error,

      00:27:27,999 ERROR [qtp560042431-25] BaseManagementHandler:66 - Caught a runtime exception while attempting to create a resource
      java.lang.NullPointerException
              at org.apache.ambari.server.controller.internal.BlueprintConfigurationProcessor$SingleHostTopologyUpdater.updateForClusterCreate(BlueprintConfigurationProcessor.java:580)
              at org.apache.ambari.server.controller.internal.BlueprintConfigurationProcessor.doUpdateForClusterCreate(BlueprintConfigurationProcessor.java:131)
              at org.apache.ambari.server.controller.internal.ClusterResourceProvider.processConfigurations(ClusterResourceProvider.java:961)
              at org.apache.ambari.server.controller.internal.ClusterResourceProvider.processBlueprintCreate(ClusterResourceProvider.java:432)
              at org.apache.ambari.server.controller.internal.ClusterResourceProvider.createResources(ClusterResourceProvider.java:124)
              at org.apache.ambari.server.controller.internal.ClusterControllerImpl.createResources(ClusterControllerImpl.java:274)
              at org.apache.ambari.server.api.services.persistence.PersistenceManagerImpl.create(PersistenceManagerImpl.java:75)
              at org.apache.ambari.server.api.handlers.CreateHandler.persist(CreateHandler.java:36)
              at org.apache.ambari.server.api.handlers.BaseManagementHandler.handleRequest(BaseManagementHandler.java:72)
              at org.apache.ambari.server.api.services.BaseRequest.process(BaseRequest.java:135)
              at org.apache.ambari.server.api.services.BaseService.handleRequest(BaseService.java:103)
              at org.apache.ambari.server.api.services.BaseService.handleRequest(BaseService.java:72)
              at org.apache.ambari.server.api.services.ClusterService.createCluster(ClusterService.java:118)
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
              at java.lang.reflect.Method.invoke(Method.java:606)
              at com.sun.jersey.spi.container.JavaMethodInvokerFactory$1.invoke(JavaMethodInvokerFactory.java:60)
              at com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$ResponseOutInvoker._dispatch(
      

      Attachments

        1. blueprint_error.log
          36 kB
          Alejandro Fernandez
        2. hdp_22_blueprint.json
          112 kB
          Alejandro Fernandez
        3. single_node_cluster.json
          0.2 kB
          Alejandro Fernandez
        4. AMBARI-8233.patch
          0.8 kB
          Alejandro Fernandez
        5. AMBARI-8233_branch-1.7.0.patch
          0.8 kB
          Alejandro Fernandez

        Issue Links

          Activity

            People

              afernandez Alejandro Fernandez
              afernandez Alejandro Fernandez
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: