This is an automated email from the ASF dual-hosted git repository.

bcall pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/9.0.x by this push:
     new cf86aa7  Convert old sni configuration file in lua to yaml
cf86aa7 is described below

commit cf86aa71fda5ce0745be9a252337a93964345a3a
Author: Bryan Call <bc...@apache.org>
AuthorDate: Tue Sep 24 16:54:05 2019 -0700

    Convert old sni configuration file in lua to yaml
    
    (cherry picked from commit f75345e9287448270b8fd2259e6f25cd7cc2e2e1)
---
 tools/sni_lua_to_yaml.pl | 50 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 50 insertions(+)

diff --git a/tools/sni_lua_to_yaml.pl b/tools/sni_lua_to_yaml.pl
new file mode 100755
index 0000000..3c5458f
--- /dev/null
+++ b/tools/sni_lua_to_yaml.pl
@@ -0,0 +1,50 @@
+#!/usr/bin/perl
+
+#
+## 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.
+
+use strict;
+use warnings;
+
+{
+  print "sni:\n";
+  while (<>) {
+    chomp;
+    #print "y $_\n";
+    if (m|fqdn\s+=\s+'(\S+)',|) {
+      my $fqdn = $1;
+      if ($fqdn =~ m|\*|) {
+        $fqdn = "'" . $fqdn . "'";
+      }
+      print "- fqdn: $fqdn\n";
+      while (<>) {
+        chomp;
+        last if (m|},|);
+        #print "x $_\n";
+        if (m|(\w+)\s+=\s+'(\S+)',?|) {
+          my $key = $1;
+          my $value = $2;
+          if ($key eq 'verify_server_policy') {
+            $value = 'PERMISSIVE' if ($value eq 'moderate');
+            $value = 'DISABLED' if ($value eq 'disabled');
+          }
+          print "  $key: $value\n"
+        }
+      }
+    }
+  }
+}

Reply via email to