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

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