Support multiple nexus sections in lftools.ini 56/16456/10 v0.25.5
authorAric Gardner <agardner@linuxfoundation.org>
Tue, 6 Aug 2019 17:32:42 +0000 (13:32 -0400)
committerAnil Belur <abelur@linuxfoundation.org>
Wed, 7 Aug 2019 06:55:56 +0000 (16:55 +1000)
[nexus] section is taken from -s "server" passed to release job.
The "https://" part of passed url is stripped before match.

example:
lftools nexus release -s https://nexus.example.com

Would require auth section in lftools.ini of
[nexus.example.org]
username=
password=

Issue: RELENG-2129
Issue: RELENG-1666
Change-Id: I64ab0a18a4d0e9060f1273f5acc1971fcffe497c
Signed-off-by: Aric Gardner <agardner@linuxfoundation.org>
Signed-off-by: Anil Belur <abelur@linuxfoundation.org>
docs/commands/nexus.rst
docs/conf.py
lftools/nexus/cmd.py
releasenotes/notes/nexus-release-60333ea8c6deb068.yaml [new file with mode: 0644]

index 0df0196..cd8ecf6 100644 (file)
@@ -70,3 +70,16 @@ release
 -------
 
 .. program-output:: lftools nexus release --help
+
+While a settings.yaml file is still supported for ``nexus release`` commands,
+the preferred way to login is to use an lftools.ini file, and provide the
+server address using the ``--server`` option. The config file should be at
+$HOME/.config/lftools/lftools.ini.
+Requires an [nexus.example.com] for each Nexus repositories in
+~/.config/lftools/lftools.ini:
+
+.. code-block:: bash
+
+   [nexus.example.com]
+   username=
+   password=
index 6e160e4..b61dc98 100644 (file)
@@ -32,4 +32,5 @@ release = str(VersionInfo('lftools'))
 # Linkcheck Options
 linkcheck_ignore= [
     r'https://testing\.googleblog\.com/.*',
+    r'https://nexus\.example\.com',
 ]
index 0424ce2..9bc043b 100644 (file)
@@ -42,8 +42,9 @@ def get_credentials(settings_file, url=None):
             return settings
     elif url:
         try:
-            user = config.get_setting("nexus", "username")
-            password = config.get_setting("nexus", "password")
+            auth_url = url.replace("https://", "")
+            user = config.get_setting(auth_url, "username")
+            password = config.get_setting(auth_url, "password")
         except (configparser.NoOptionError,
                 configparser.NoSectionError):
             log.info("Failed to get nexus credentials; using empty username "
diff --git a/releasenotes/notes/nexus-release-60333ea8c6deb068.yaml b/releasenotes/notes/nexus-release-60333ea8c6deb068.yaml
new file mode 100644 (file)
index 0000000..7b07693
--- /dev/null
@@ -0,0 +1,29 @@
+---
+features:
+  - |
+    Support multiple nexus sections in lftools.ini
+
+    In the format:
+
+    .. code-block:: none
+
+       [nexus.example.org]
+       username=
+       password=
+
+       [nexus.example1.org]
+       username=
+       password=
+
+    [nexus] section is taken from -s "server" passed to release job.
+    https part of passed url is stripped before match.
+upgrade:
+  - |
+    current [nexus] section of lftools.ini must be changed to
+    [nexus.example.com]
+
+    where nexus.example.com matches the "server" string passed to
+    lftools nexus release -s https://nexus.example.com
+    The https part of passed url is stripped before match.
+    example provided would require auth section in lftools.ini of
+    [nexus.example.org]