Fixes configuring jetty.xml 14/63114/3
authorTim Rozet <trozet@redhat.com>
Wed, 13 Sep 2017 18:21:54 +0000 (14:21 -0400)
committerTim Rozet <trozet@redhat.com>
Wed, 13 Sep 2017 21:29:42 +0000 (17:29 -0400)
In Nitrogen and later the template configuration for jetty.xml is
incorrect and ODL does not start correctly.  This patch removes the
template in favor of using augeas.

Also updates acceptance to use nitrogen (since oxygen repo not
available).

Change-Id: Ia5cf466cb8ba2596d1df0fa4f2d5956827206e46
Signed-off-by: Tim Rozet <trozet@redhat.com>
Rakefile
manifests/config.pp
spec/spec_helper.rb
templates/jetty.xml.erb [deleted file]

index e7a176a0850fa729df8c3a5a43eff9e42696cf8d..2de9aa39959725e3f40b3bb7b723b99c7d98ceb2 100644 (file)
--- a/Rakefile
+++ b/Rakefile
@@ -26,14 +26,14 @@ end
 
 desc "Beaker tests against CentOS 7 VM with latest Carbon testing RPM"
 task :cent_6test_vm do
-  sh "RS_SET=centos-7 RPM_REPO='opendaylight-6-testing' bundle exec rake beaker"
+  sh "RS_SET=centos-7 RPM_REPO='opendaylight-7-testing' bundle exec rake beaker"
 end
 
 # CentOS Containers
 
 desc "Beaker tests against CentOS 7 container with latest Carbon testing RPM"
 task :cent_6test_dock do
-  sh "RS_SET=centos-7-docker RPM_REPO='opendaylight-6-testing' bundle exec rake beaker"
+  sh "RS_SET=centos-7-docker RPM_REPO='opendaylight-7-testing' bundle exec rake beaker"
 end
 
 # Ubuntu VMs
index 69723f195c50bb7749cd6841c8621ebd37309698..f5089999988285f3650db369ae5839225a129360 100644 (file)
@@ -19,15 +19,17 @@ class opendaylight::config {
     match => '^featuresBoot=.*$',
   }
 
-  # Configuration of ODL NB REST port to listen on
-  file { 'jetty.xml':
-    ensure  => file,
-    path    => '/opt/opendaylight/etc/jetty.xml',
-    # Set user:group owners
-    owner   => 'odl',
-    group   => 'odl',
-    # Use a template to populate the content
-    content => template('opendaylight/jetty.xml.erb'),
+  # Configuration of ODL NB REST port and IP to listen on
+  augeas {'jetty.xml':
+    incl    => '/opt/opendaylight/etc/jetty.xml',
+    context => '/files/opt/opendaylight/etc/jetty.xml/Configure',
+    lens    => 'Xml.lns',
+    changes => [
+      "set Call[2]/Arg/New/Set[#attribute[name='port']]/Property/#attribute/default ${opendaylight::odl_rest_port}",
+      "set Call[1]/Arg/New/Set[#attribute[name='host']]/#text[1] ${opendaylight::odl_bind_ip}",
+      "rm Call[1]/Arg/New/Set[#attribute[name='host']]/Property",
+      "set Call[2]/Arg/New/Set[#attribute[name='host']]/#text[1] ${opendaylight::odl_bind_ip}",
+      "rm Call[2]/Arg/New/Set[#attribute[name='host']]/Property"]
   }
 
   # Set any custom log levels
index 00b21fd0ef46f75b7c506cbfdb51290f46b2ee60..1726a30cb9544c21a11a608234b3f4a139888484 100644 (file)
@@ -123,13 +123,7 @@ def odl_rest_port_tests(options = {})
   # NB: These hashes don't work with Ruby 1.8.7, but we
   #   don't support 1.8.7 so that's okay. See issue #36.
   it {
-    should contain_file('jetty.xml').with(
-      'ensure'      => 'file',
-      'path'        => '/opt/opendaylight/etc/jetty.xml',
-      'owner'   => 'odl',
-      'group'   => 'odl',
-      'content'     => /Property name="jetty.port" default="#{odl_rest_port}"/
-    )
+    should contain_augeas('jetty.xml')
   }
 end
 
diff --git a/templates/jetty.xml.erb b/templates/jetty.xml.erb
deleted file mode 100644 (file)
index a5cae9d..0000000
+++ /dev/null
@@ -1,106 +0,0 @@
-<?xml version="1.0"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements.  See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership.  The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License.  You may obtain a copy of the License at
-
-   http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied.  See the License for the
- specific language governing permissions and limitations
- under the License.
--->
-<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//
-DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">
-
-<Configure class="org.eclipse.jetty.server.Server">
-
-    <!-- =========================================================== -->
-    <!-- Set connectors -->
-    <!-- =========================================================== -->
-    <!-- One of each type! -->
-    <!-- =========================================================== -->
-
-    <!-- Use this connector for many frequently idle connections and for
-        threadless continuations. -->
-    <Call name="addConnector">
-        <Arg>
-            <New class="org.eclipse.jetty.server.nio.SelectChannelConnector">
-                <Set name="host"><%= scope.lookupvar('opendaylight::odl_bind_ip') %>
-                    <Property name="jetty.host" />
-                </Set>
-                <Set name="port">
-                    <Property name="jetty.port" default="8181" />
-                </Set>
-                <Set name="maxIdleTime">300000</Set>
-                <Set name="Acceptors">2</Set>
-                <Set name="statsOn">false</Set>
-                <Set name="confidentialPort">8543</Set>
-                <Set name="lowResourcesConnections">20000</Set>
-                <Set name="lowResourcesMaxIdleTime">5000</Set>
-            </New>
-        </Arg>
-    </Call>
-    <Call name="addConnector">
-      <Arg>
-        <New class="org.eclipse.jetty.server.nio.SelectChannelConnector">
-          <Set name="host"><%= scope.lookupvar('opendaylight::odl_bind_ip') %>
-            <Property name="jetty.host" />
-          </Set>
-          <Set name="port">
-            <Property name="jetty.port" default="<%= scope.lookupvar('opendaylight::odl_rest_port') %>" />
-          </Set>
-          <Set name="maxIdleTime">300000</Set>
-          <Set name="Acceptors">2</Set>
-          <Set name="statsOn">false</Set>
-          <Set name="confidentialPort">8443</Set>
-          <Set name="lowResourcesConnections">20000</Set>
-          <Set name="lowResourcesMaxIdleTime">5000</Set>
-        </New>
-      </Arg>
-    </Call>
-
-    <!-- =========================================================== -->
-    <!-- Configure Authentication Realms -->
-    <!-- Realms may be configured for the entire server here, or -->
-    <!-- they can be configured for a specific web app in a context -->
-    <!-- configuration (see $(jetty.home)/contexts/test.xml for an -->
-    <!-- example). -->
-    <!-- =========================================================== -->
-    <Call name="addBean">
-        <Arg>
-            <New class="org.eclipse.jetty.plus.jaas.JAASLoginService">
-                <Set name="name">karaf</Set>
-                <Set name="loginModuleName">karaf</Set>
-                <Set name="roleClassNames">
-                    <Array type="java.lang.String">
-                        <Item>org.apache.karaf.jaas.boot.principal.RolePrincipal
-                        </Item>
-                    </Array>
-                </Set>
-            </New>
-        </Arg>
-    </Call>
-    <Call name="addBean">
-        <Arg>
-            <New class="org.eclipse.jetty.plus.jaas.JAASLoginService">
-                <Set name="name">default</Set>
-                <Set name="loginModuleName">karaf</Set>
-                <Set name="roleClassNames">
-                    <Array type="java.lang.String">
-                        <Item>org.apache.karaf.jaas.boot.principal.RolePrincipal
-                        </Item>
-                    </Array>
-                </Set>
-            </New>
-        </Arg>
-    </Call>
-
-</Configure>