Blame SOURCES/0009-Rhsm-new-lens-to-parse-subscription-manager-s-rhsm.c.patch

91858b
From a90c028eae871422588037ea1a21aff080f77fd2 Mon Sep 17 00:00:00 2001
91858b
From: Dominic Cleal <dcleal@redhat.com>
91858b
Date: Fri, 3 Jul 2015 12:05:30 +0100
91858b
Subject: [PATCH] Rhsm: new lens to parse subscription-manager's rhsm.conf
91858b
91858b
(cherry picked from commit abdb9fbc4e8c0975f51a62e34ee2e22ed2d5c39f)
91858b
91858b
Conflicts:
91858b
	NEWS
91858b
---
91858b
 doc/naturaldocs/conf/lenses/Menu.txt |   2 +
91858b
 lenses/rhsm.aug                      |  42 ++++++++
91858b
 lenses/tests/test_rhsm.aug           | 151 +++++++++++++++++++++++++++
91858b
 tests/Makefile.am                    |   1 +
91858b
 4 files changed, 196 insertions(+)
91858b
 create mode 100644 lenses/rhsm.aug
91858b
 create mode 100644 lenses/tests/test_rhsm.aug
91858b
91858b
diff --git a/doc/naturaldocs/conf/lenses/Menu.txt b/doc/naturaldocs/conf/lenses/Menu.txt
91858b
index c245446b..e74cd13a 100644
91858b
--- a/doc/naturaldocs/conf/lenses/Menu.txt
91858b
+++ b/doc/naturaldocs/conf/lenses/Menu.txt
91858b
@@ -151,6 +151,7 @@ Group: Specific Modules  {
91858b
    File: Redis  (redis.aug)
91858b
    File: Reprepro_Uploaders  (reprepro_uploaders.aug)
91858b
    File: Resolv  (resolv.aug)
91858b
+   File: Rhsm  (rhsm.aug)
91858b
    File: Rmt  (rmt.aug)
91858b
    File: Rsyslog  (rsyslog.aug)
91858b
    File: Schroot  (schroot.aug)
91858b
@@ -261,6 +262,7 @@ Group: Tests and Examples  {
91858b
    File: Test_Rabbitmq  (tests/test_rabbitmq.aug)
91858b
    File: Test_Redis  (tests/test_redis.aug)
91858b
    File: Test_Reprepro_Uploaders  (tests/test_reprepro_uploaders.aug)
91858b
+   File: Test_Rhsm  (tests/test_rhsm.aug)
91858b
    File: Test_Rmt  (tests/test_rmt.aug)
91858b
    File: Test_Rsyslog  (tests/test_rsyslog.aug)
91858b
    File: Test_Simplelines  (tests/test_simplelines.aug)
91858b
diff --git a/lenses/rhsm.aug b/lenses/rhsm.aug
91858b
new file mode 100644
91858b
index 00000000..56cc82ea
91858b
--- /dev/null
91858b
+++ b/lenses/rhsm.aug
91858b
@@ -0,0 +1,42 @@
91858b
+(*
91858b
+Module: Rhsm
91858b
+  Parses subscription-manager config files
91858b
+
91858b
+Author: Dominic Cleal <dcleal@redhat.com>
91858b
+
91858b
+About: Reference
91858b
+  This lens tries to keep as close as possible to rhsm.conf(5) and
91858b
+  Python's SafeConfigParser.  All settings must be in sections without
91858b
+  indentation.  Semicolons and hashes are permitted for comments.
91858b
+
91858b
+About: License
91858b
+  This file is licenced under the LGPL v2+, like the rest of Augeas.
91858b
+
91858b
+About: Lens Usage
91858b
+  To be documented
91858b
+
91858b
+About: Configuration files
91858b
+  This lens applies to:
91858b
+    /etc/rhsm/rhsm.conf
91858b
+
91858b
+  See <filter>.
91858b
+*)
91858b
+
91858b
+module Rhsm =
91858b
+  autoload xfm
91858b
+
91858b
+(* Semicolons and hashes are permitted for comments *)
91858b
+let comment = IniFile.comment IniFile.comment_re "#"
91858b
+(* Equals and colons are permitted for separators *)
91858b
+let sep     = IniFile.sep IniFile.sep_re IniFile.sep_default
91858b
+
91858b
+(* All settings must be in sections without indentation *)
91858b
+let entry   = IniFile.entry_multiline IniFile.entry_re sep comment
91858b
+let title   = IniFile.title IniFile.record_re
91858b
+let record  = IniFile.record title entry
91858b
+
91858b
+let lns     = IniFile.lns record comment
91858b
+
91858b
+let filter  = incl "/etc/rhsm/rhsm.conf"
91858b
+
91858b
+let xfm     = transform lns filter
91858b
diff --git a/lenses/tests/test_rhsm.aug b/lenses/tests/test_rhsm.aug
91858b
new file mode 100644
91858b
index 00000000..219a5be7
91858b
--- /dev/null
91858b
+++ b/lenses/tests/test_rhsm.aug
91858b
@@ -0,0 +1,151 @@
91858b
+(*
91858b
+Module: Test_Rhsm
91858b
+  Provides unit tests and examples for the <Rhsm> lens.
91858b
+*)
91858b
+
91858b
+module Test_rhsm =
91858b
+
91858b
+  (* Variable: conf
91858b
+     A full rhsm.conf *)
91858b
+  let conf = "# Red Hat Subscription Manager Configuration File:
91858b
+
91858b
+# Unified Entitlement Platform Configuration
91858b
+[server]
91858b
+# Server hostname:
91858b
+hostname = subscription.rhn.redhat.com
91858b
+
91858b
+# Server prefix:
91858b
+prefix = /subscription
91858b
+
91858b
+# Server port:
91858b
+port = 443
91858b
+
91858b
+# Set to 1 to disable certificate validation:
91858b
+insecure = 0
91858b
+
91858b
+# Set the depth of certs which should be checked
91858b
+# when validating a certificate
91858b
+ssl_verify_depth = 3
91858b
+
91858b
+# an http proxy server to use
91858b
+proxy_hostname =
91858b
+
91858b
+# port for http proxy server
91858b
+proxy_port =
91858b
+
91858b
+# user name for authenticating to an http proxy, if needed
91858b
+proxy_user =
91858b
+
91858b
+# password for basic http proxy auth, if needed
91858b
+proxy_password =
91858b
+
91858b
+[rhsm]
91858b
+# Content base URL:
91858b
+baseurl= https://cdn.redhat.com
91858b
+
91858b
+# Server CA certificate location:
91858b
+ca_cert_dir = /etc/rhsm/ca/
91858b
+
91858b
+# Default CA cert to use when generating yum repo configs:
91858b
+repo_ca_cert = %(ca_cert_dir)sredhat-uep.pem
91858b
+
91858b
+# Where the certificates should be stored
91858b
+productCertDir = /etc/pki/product
91858b
+entitlementCertDir = /etc/pki/entitlement
91858b
+consumerCertDir = /etc/pki/consumer
91858b
+
91858b
+# Manage generation of yum repositories for subscribed content:
91858b
+manage_repos = 1
91858b
+
91858b
+# Refresh repo files with server overrides on every yum command
91858b
+full_refresh_on_yum = 0
91858b
+
91858b
+# If set to zero, the client will not report the package profile to
91858b
+# the subscription management service.
91858b
+report_package_profile = 1
91858b
+
91858b
+# The directory to search for subscription manager plugins
91858b
+pluginDir = /usr/share/rhsm-plugins
91858b
+
91858b
+# The directory to search for plugin configuration files
91858b
+pluginConfDir = /etc/rhsm/pluginconf.d
91858b
+
91858b
+[rhsmcertd]
91858b
+# Interval to run cert check (in minutes):
91858b
+certCheckInterval = 240
91858b
+# Interval to run auto-attach (in minutes):
91858b
+autoAttachInterval = 1440
91858b
+"
91858b
+
91858b
+  test Rhsm.lns get conf =
91858b
+    { "#comment" = "Red Hat Subscription Manager Configuration File:" }
91858b
+    {  }
91858b
+    { "#comment" = "Unified Entitlement Platform Configuration" }
91858b
+    { "server"
91858b
+      { "#comment" = "Server hostname:" }
91858b
+      { "hostname" = "subscription.rhn.redhat.com" }
91858b
+      {  }
91858b
+      { "#comment" = "Server prefix:" }
91858b
+      { "prefix" = "/subscription" }
91858b
+      {  }
91858b
+      { "#comment" = "Server port:" }
91858b
+      { "port" = "443" }
91858b
+      {  }
91858b
+      { "#comment" = "Set to 1 to disable certificate validation:" }
91858b
+      { "insecure" = "0" }
91858b
+      {  }
91858b
+      { "#comment" = "Set the depth of certs which should be checked" }
91858b
+      { "#comment" = "when validating a certificate" }
91858b
+      { "ssl_verify_depth" = "3" }
91858b
+      {  }
91858b
+      { "#comment" = "an http proxy server to use" }
91858b
+      { "proxy_hostname" }
91858b
+      {  }
91858b
+      { "#comment" = "port for http proxy server" }
91858b
+      { "proxy_port" }
91858b
+      {  }
91858b
+      { "#comment" = "user name for authenticating to an http proxy, if needed" }
91858b
+      { "proxy_user" }
91858b
+      {  }
91858b
+      { "#comment" = "password for basic http proxy auth, if needed" }
91858b
+      { "proxy_password" }
91858b
+      {  }
91858b
+    }
91858b
+    { "rhsm"
91858b
+      { "#comment" = "Content base URL:" }
91858b
+      { "baseurl" = "https://cdn.redhat.com" }
91858b
+      {  }
91858b
+      { "#comment" = "Server CA certificate location:" }
91858b
+      { "ca_cert_dir" = "/etc/rhsm/ca/" }
91858b
+      {  }
91858b
+      { "#comment" = "Default CA cert to use when generating yum repo configs:" }
91858b
+      { "repo_ca_cert" = "%(ca_cert_dir)sredhat-uep.pem" }
91858b
+      {  }
91858b
+      { "#comment" = "Where the certificates should be stored" }
91858b
+      { "productCertDir" = "/etc/pki/product" }
91858b
+      { "entitlementCertDir" = "/etc/pki/entitlement" }
91858b
+      { "consumerCertDir" = "/etc/pki/consumer" }
91858b
+      {  }
91858b
+      { "#comment" = "Manage generation of yum repositories for subscribed content:" }
91858b
+      { "manage_repos" = "1" }
91858b
+      {  }
91858b
+      { "#comment" = "Refresh repo files with server overrides on every yum command" }
91858b
+      { "full_refresh_on_yum" = "0" }
91858b
+      {  }
91858b
+      { "#comment" = "If set to zero, the client will not report the package profile to" }
91858b
+      { "#comment" = "the subscription management service." }
91858b
+      { "report_package_profile" = "1" }
91858b
+      {  }
91858b
+      { "#comment" = "The directory to search for subscription manager plugins" }
91858b
+      { "pluginDir" = "/usr/share/rhsm-plugins" }
91858b
+      {  }
91858b
+      { "#comment" = "The directory to search for plugin configuration files" }
91858b
+      { "pluginConfDir" = "/etc/rhsm/pluginconf.d" }
91858b
+      {  }
91858b
+    }
91858b
+    { "rhsmcertd"
91858b
+      { "#comment" = "Interval to run cert check (in minutes):" }
91858b
+      { "certCheckInterval" = "240" }
91858b
+      { "#comment" = "Interval to run auto-attach (in minutes):" }
91858b
+      { "autoAttachInterval" = "1440" }
91858b
+    }
91858b
diff --git a/tests/Makefile.am b/tests/Makefile.am
91858b
index 65d8993e..4d2b2605 100644
91858b
--- a/tests/Makefile.am
91858b
+++ b/tests/Makefile.am
91858b
@@ -167,6 +167,7 @@ lens_tests =			\
91858b
   lens-redis.sh		\
91858b
   lens-reprepro_uploaders.sh		\
91858b
   lens-resolv.sh		\
91858b
+  lens-rhsm.sh			\
91858b
   lens-rmt.sh			\
91858b
   lens-rsyncd.sh		\
91858b
   lens-rsyslog.sh		\
91858b
-- 
91858b
2.17.2
91858b