1
0
mirror of https://github.com/openSUSE/osc.git synced 2025-09-06 21:28:42 +02:00

Print warnings to stderr.

This way we can avoid confusion for programs which do parse osc output.
This commit is contained in:
Michal Čihař
2011-01-05 16:31:02 +01:00
parent 8ea5bc7f04
commit 3892117558
4 changed files with 18 additions and 16 deletions

View File

@@ -8,6 +8,7 @@ from core import *
import cmdln
import conf
import oscerr
import sys
from optparse import SUPPRESS_HELP
MAN_HEADER = r""".TH %(ucname)s "1" "%(date)s" "%(name)s %(version)s" "User Commands"
@@ -783,12 +784,12 @@ class Osc(cmdln.Cmdln):
# remove this block later again
oldcmds = ['create', 'list', 'log', 'show', 'decline', 'accept', 'delete', 'revoke']
if args and args[0] in oldcmds:
print "************************************************************************"
print "* WARNING: It looks that you are using this command with a *"
print "* deprecated syntax. *"
print "* Please run \"osc sr --help\" and \"osc rq --help\" *"
print "* to see the new syntax. *"
print "************************************************************************"
print >>sys.stderr, "************************************************************************"
print >>sys.stderr, "* WARNING: It looks that you are using this command with a *"
print >>sys.stderr, "* deprecated syntax. *"
print >>sys.stderr, "* Please run \"osc sr --help\" and \"osc rq --help\" *"
print >>sys.stderr, "* to see the new syntax. *"
print >>sys.stderr, "************************************************************************"
if args[0] == 'create':
args.pop(0)
else:
@@ -3116,7 +3117,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
if opts.skip_validation:
validators = None
elif not os.path.exists(validators):
print "WARNING: source_validator_directory configured but it "\
print >>sys.stderr, "WARNING: source_validator_directory configured but it "\
"does not exist:\n\t %s \n"\
"\t Install osc-source_validator to fix." % validators
validators = None
@@ -3376,7 +3377,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
prj = Project(prj_dir, False)
prj.delPackage(p, opts.force)
else:
print "WARNING: package tracking is disabled, operation skipped !"
print >>sys.stderr, "WARNING: package tracking is disabled, operation skipped !"
else:
pathn = getTransActPath(p.dir)
for filename in p.todo:

View File

@@ -793,14 +793,14 @@ def get_config(override_conffile = None,
try:
password = passwordx.decode('base64').decode('bz2')
except:
print "%s: no credentials known" % url
print >>sys.stderr, "%s: no credentials known" % url
password = 'your_password'
elif password != passwordx.decode('base64').decode('bz2'):
if not passwordx:
# passx not present
print '%s: rewriting from plain pass to encoded pass\n' % url
print >>sys.stderr, '%s: rewriting from plain pass to encoded pass\n' % url
else:
print '%s: pass and passx mismatch (rewriting from plain pass to encoded pass)\n' % url
print >>sys.stderr, '%s: pass and passx mismatch (rewriting from plain pass to encoded pass)\n' % url
add_section(conffile, url, user, password)
if cp.has_option(url, 'http_headers'):

View File

@@ -2666,7 +2666,7 @@ def read_filemeta(dir):
filesmeta = os.path.join(dir, store, '_files')
if not os.path.isfile(filesmeta):
print "Warning: file _files is missing, creating a default one"
print >>sys.stderr, "Warning: file _files is missing, creating a default one"
store_write_string(os.path.join(dir, store), '_files', '<directory \>')
try:

View File

@@ -11,6 +11,7 @@ import urlparse
import socket
import urllib
import httplib
import sys
class TrustedCertStore:
_tmptrusted = {}
@@ -301,10 +302,10 @@ def verify_certificate(connection):
if tc.is_trusted(): # ok, same cert as the stored one
return
else:
print "WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!"
print "IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!"
print "offending certificate is at '%s'" % tc.file
raise SSLVerificationError("remote host identification has changed")
print >>sys.stderr, "WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!"
print >>sys.stderr, "IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!"
print >>sys.stderr, "offending certificate is at '%s'" % tc.file
raise >>sys.stderr, SSLVerificationError("remote host identification has changed")
verrs.show()