[yum-commits] Branch 'yum-3_2_X' - cli.py docs/yum.8 docs/yum.conf.5 yum/__init__.py

James Antill james at osuosl.org
Thu Jul 14 18:50:42 UTC 2011


 cli.py          |    8 ++++----
 docs/yum.8      |    5 +++++
 docs/yum.conf.5 |    7 +++++--
 yum/__init__.py |   12 ++++++------
 4 files changed, 20 insertions(+), 12 deletions(-)

New commits:
commit fa63b661a1863ff1e13ae9083e2c2c5a74c00f7c
Author: James Antill <james at and.org>
Date:   Thu Jul 14 14:50:25 2011 -0400

    Make the assume yes/no cmd. options and and config. options behave the same.

diff --git a/cli.py b/cli.py
index 7d332c1..74504c4 100644
--- a/cli.py
+++ b/cli.py
@@ -453,7 +453,7 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
         lsts = self.listTransaction()
         if self.verbose_logger.isEnabledFor(yum.logginglevels.INFO_1):
             self.verbose_logger.log(yum.logginglevels.INFO_1, lsts)
-        elif not self.conf.assumeyes:
+        elif self.conf.assumeno or not self.conf.assumeyes:
             #  If we are in quiet, and assumeyes isn't on we want to output
             # at least the transaction list anyway.
             self.logger.warn(lsts)
@@ -623,7 +623,8 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
                 continue            
 
             elif result == 1:
-                if not sys.stdin.isatty() and not self.conf.assumeyes:
+                ay = self.conf.assumeyes and not self.conf.assumeno
+                if not sys.stdin.isatty() and not ay:
                     raise yum.Errors.YumBaseError, \
                             _('Refusing to automatically import keys when running ' \
                             'unattended.\nUse "-y" to override.')
@@ -1389,7 +1390,7 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
 
     def _promptWanted(self):
         # shortcut for the always-off/always-on options
-        if self.conf.assumeyes:
+        if self.conf.assumeyes and not self.conf.assumeno:
             return False
         if self.conf.alwaysprompt:
             return True
@@ -1538,7 +1539,6 @@ class YumOptionParser(OptionParser):
                 self.base.conf.assumeyes = 1
             if opts.assumeno:
                 self.base.conf.assumeno  = 1
-                self.base.conf.assumeyes = 0
 
             #  Instead of going cache-only for a non-root user, try to use a
             # user writable cachedir. If that fails fall back to cache-only.
diff --git a/docs/yum.8 b/docs/yum.8
index 1a8202a..ea18f34 100644
--- a/docs/yum.8
+++ b/docs/yum.8
@@ -401,6 +401,11 @@ Assume yes; assume that the answer to any question which would be asked
 is yes\&.
 .br
 Configuration Option: \fBassumeyes\fP
+.IP "\fB\-\-assumeno\fP"
+Assume no; assume that the answer to any question which would be asked 
+is no\&. This option overrides assumeyes, but is still subject to alwaysprompt.
+.br
+Configuration Option: \fBassumeno\fP
 .IP "\fB\-c, \-\-config=[config file]\fP" 
 Specifies the config file location - can take HTTP and FTP URLs and local file
 paths\&.
diff --git a/docs/yum.conf.5 b/docs/yum.conf.5
index 3e229ea..bd86eea 100644
--- a/docs/yum.conf.5
+++ b/docs/yum.conf.5
@@ -114,13 +114,15 @@ are causing problems from the transaction.
 Either `1' or `0'. Determines whether or not yum prompts for confirmation of
 critical actions. Default is `0' (do prompt).
 .br
-Command-line option: \fB\-y\fP
+Command-line option: \fB\-y\fP \fB\--assumeyes\fP
 
 .IP
 \fBassumeno\fR
 Either `1' or `0'. If yum would prompt for confirmation of critical actions, 
 assume the user chose no. This is basically the same as doing "echo | yum ..."
-but is a bit more usable. Default is `0' (do prompt).
+but is a bit more usable. This option overrides \fBassumeyes\fP, but is still
+subject to \fBalwaysprompt\fP.
+Default is `0' (do prompt).
 .br
 Command-line option: \fB\--assumeno\fP
 
@@ -141,6 +143,7 @@ Either `1' or `0'. If enabled, then yum will be tolerant of errors on the
 command line with regard to packages. For example: if you request to install
 foo, bar and baz and baz is installed; yum won't error out complaining that baz
 is already installed. Default to `0' (not tolerant).
+Note: This option currently does nothing.
 .br
 Command-line option: \fB\-t\fP
 
diff --git a/yum/__init__.py b/yum/__init__.py
index 8951cdc..12c2bdd 100644
--- a/yum/__init__.py
+++ b/yum/__init__.py
@@ -4727,10 +4727,10 @@ class YumBase(depsolve.Depsolve):
                     # Try installing/updating GPG key
                     self._getKeyImportMessage(info, keyurl)
                     rc = False
-                    if self.conf.assumeyes:
-                        rc = True
-                    elif self.conf.assumeno:
+                    if self.conf.assumeno:
                         rc = False
+                    elif self.conf.assumeyes:
+                        rc = True
                         
                     # grab the .sig/.asc for the keyurl, if it exists
                     # if it does check the signature on the key
@@ -4823,10 +4823,10 @@ class YumBase(depsolve.Depsolve):
                 if not key_installed:
                     self._getKeyImportMessage(info, keyurl, keytype)
                     rc = False
-                    if self.conf.assumeyes:
-                        rc = True
-                    elif self.conf.assumeno:
+                    if self.conf.assumeno:
                         rc = False
+                    elif self.conf.assumeyes:
+                        rc = True
 
                     elif callback:
                         rc = callback({"repo": repo, "userid": info['userid'],


More information about the Yum-commits mailing list