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

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