dcavalca / rpms / dnf

Forked from rpms/dnf 2 years ago
Clone

Blame SOURCES/0002-Fix-and-document-order-of-config-files-in-aliasesd-RhBug1680489.patch

Brian Stinson a74cb7
From ba3615c600532a0ce8693a626a9cbe71a458399a Mon Sep 17 00:00:00 2001
Brian Stinson a74cb7
From: Pavla Kratochvilova <pkratoch@redhat.com>
Brian Stinson a74cb7
Date: Thu, 23 May 2019 14:48:29 +0200
Brian Stinson a74cb7
Subject: [PATCH 1/2] Respect order of config files in aliases.d
Brian Stinson a74cb7
 (RhBug:1680489)
Brian Stinson a74cb7
Brian Stinson a74cb7
https://bugzilla.redhat.com/show_bug.cgi?id=1680489
Brian Stinson a74cb7
The aliases config files were read in arbitrary order (os.listdir does not
Brian Stinson a74cb7
give sorted output). It is better to define clear order (i.e. all config files
Brian Stinson a74cb7
except USER.conf are ordered alphabetically, USER.conf is the last).
Brian Stinson a74cb7
Brian Stinson a74cb7
Closes: #1542
Brian Stinson a74cb7
Approved by: kontura
Brian Stinson a74cb7
---
Brian Stinson a74cb7
 dnf/cli/aliases.py | 2 +-
Brian Stinson a74cb7
 1 file changed, 1 insertion(+), 1 deletion(-)
Brian Stinson a74cb7
Brian Stinson a74cb7
diff --git a/dnf/cli/aliases.py b/dnf/cli/aliases.py
Brian Stinson a74cb7
index 0b3ba8f6b..b5283d0f3 100644
Brian Stinson a74cb7
--- a/dnf/cli/aliases.py
Brian Stinson a74cb7
+++ b/dnf/cli/aliases.py
Brian Stinson a74cb7
@@ -143,7 +143,7 @@ class Aliases(object):
Brian Stinson a74cb7
         try:
Brian Stinson a74cb7
             if not os.path.exists(ALIASES_DROPIN_DIR):
Brian Stinson a74cb7
                 os.mkdir(ALIASES_DROPIN_DIR)
Brian Stinson a74cb7
-            for fn in os.listdir(ALIASES_DROPIN_DIR):
Brian Stinson a74cb7
+            for fn in sorted(os.listdir(ALIASES_DROPIN_DIR)):
Brian Stinson a74cb7
                 if _ignore_filename(fn):
Brian Stinson a74cb7
                     continue
Brian Stinson a74cb7
                 filenames.append(os.path.join(ALIASES_DROPIN_DIR, fn))
Brian Stinson a74cb7
-- 
Brian Stinson a74cb7
2.21.0
Brian Stinson a74cb7
Brian Stinson a74cb7
Brian Stinson a74cb7
From e292de84fcdec844530099a6c37ef29e1a330003 Mon Sep 17 00:00:00 2001
Brian Stinson a74cb7
From: Pavla Kratochvilova <pkratoch@redhat.com>
Brian Stinson a74cb7
Date: Thu, 23 May 2019 15:04:34 +0200
Brian Stinson a74cb7
Subject: [PATCH 2/2] [doc] Describe priorities of config files in aliases.d
Brian Stinson a74cb7
 (RhBug:1680489)
Brian Stinson a74cb7
Brian Stinson a74cb7
https://bugzilla.redhat.com/show_bug.cgi?id=1680489
Brian Stinson a74cb7
Brian Stinson a74cb7
Closes: #1542
Brian Stinson a74cb7
Approved by: kontura
Brian Stinson a74cb7
---
Brian Stinson a74cb7
 doc/command_ref.rst | 5 ++++-
Brian Stinson a74cb7
 1 file changed, 4 insertions(+), 1 deletion(-)
Brian Stinson a74cb7
Brian Stinson a74cb7
diff --git a/doc/command_ref.rst b/doc/command_ref.rst
Brian Stinson a74cb7
index 7141fc2aa..637ccf96b 100644
Brian Stinson a74cb7
--- a/doc/command_ref.rst
Brian Stinson a74cb7
+++ b/doc/command_ref.rst
Brian Stinson a74cb7
@@ -424,7 +424,10 @@ for aliases. The alias processing stops when the first found command is not a na
Brian Stinson a74cb7
 Also, like in shell aliases, if the result starts with a ``\``, the alias processing will stop.
Brian Stinson a74cb7
 
Brian Stinson a74cb7
 All aliases are defined in configuration files in the ``/etc/dnf/aliases.d/`` directory in the [aliases] section,
Brian Stinson a74cb7
-and aliases created by the alias command are written to the ``USER.conf`` file.
Brian Stinson a74cb7
+and aliases created by the alias command are written to the ``USER.conf`` file. In case of conflicts,
Brian Stinson a74cb7
+the ``USER.conf`` has the highest priority, and alphabetical ordering is used for the rest of the
Brian Stinson a74cb7
+configuration files.
Brian Stinson a74cb7
+
Brian Stinson a74cb7
 Optionally, there is the ``enabled`` option in the ``[main]`` section defaulting to True. This can be set for each
Brian Stinson a74cb7
 file separately in the respective file, or globally for all aliases in the ``ALIASES.conf`` file.
Brian Stinson a74cb7
 
Brian Stinson a74cb7
-- 
Brian Stinson a74cb7
2.21.0
Brian Stinson a74cb7