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

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