backend/Makefile.defs | 2
backend/common/rhnConfig.py | 22 ----
backend/common/spacewalk-cfg-get | 17 ---
backend/db-checker.py | 15 --
backend/satellite_exporter/satexport.py | 2
backend/satellite_tools/disk_dumper/iss.py | 3
backend/satellite_tools/disk_dumper/iss_ui.py | 2
backend/satellite_tools/disk_dumper/rhn-satellite-exporter.sgml | 12 --
backend/satellite_tools/reposync.py | 3
backend/satellite_tools/rhn-entitlement-report | 5
backend/satellite_tools/rhn-schema-version | 23 ----
backend/satellite_tools/rhn-schema-version.sgml | 10 -
backend/satellite_tools/rhn_satellite_activate.py | 18 ---
backend/satellite_tools/rhn_ssl_dbstore.py | 12 --
backend/satellite_tools/satCerts.py | 6 -
backend/satellite_tools/satComputePkgHeaders.py | 11 --
backend/satellite_tools/satellite-sync.sgml | 11 --
backend/satellite_tools/satsync.py | 35 ------
backend/satellite_tools/spacewalk-data-fsck | 4
backend/satellite_tools/spacewalk-remove-channel | 2
backend/satellite_tools/spacewalk-update-signatures | 9 -
backend/satellite_tools/spacewalk-update-signatures.sgml | 6 -
backend/satellite_tools/test/test-dump-arches.py | 2
backend/satellite_tools/test/test-dump-channel.py | 2
backend/satellite_tools/test/test-dump-ks.py | 2
backend/satellite_tools/test/test-import-rhn-cert.py | 9 -
backend/satellite_tools/test/test-satsync-errata.py | 2
backend/satellite_tools/test/test-store_rhnCryptoKey.py | 4
backend/satellite_tools/update-packages.sgml | 8 -
backend/satellite_tools/updatePackages.py | 8 -
backend/server/handlers/app/test/test_channel.py | 7 -
backend/server/handlers/config/test/test_template1.py | 2
backend/server/importlib/channelImport.py | 4
backend/server/importlib/test/test_backendOracle.py | 4
backend/server/importlib/test/test_blob_update.py | 6 -
backend/server/importlib/test/test_ks_tree.py | 2
backend/server/importlib/test/test_solaris.py | 3
backend/server/importlib/test/test_strict_channel_package_subscription.py | 4
backend/server/rhn.conf.sample | 1
backend/server/rhnPackage.py | 2
backend/server/rhnSQL/__init__.py | 55
++--------
backend/server/rhnSQL/driver_cx_Oracle.py | 13 +-
backend/server/rhnSQL/sql_base.py | 7 -
backend/server/rhnServer/server_lib.py | 2
backend/server/rhnVirtualization.py | 2
backend/server/test/TestServer.py | 12 --
backend/server/test/misc_functions.py | 4
client/tools/osad/Makefile.defs | 2
client/tools/spacewalk-koan/Makefile.defs | 2
proxy/proxy/Makefile.defs | 2
reporting/spacewalk-report | 7 -
reporting/spacewalk-report.sgml | 17 ---
spacewalk/certs-tools/Makefile.defs | 2
spacewalk/config/satellite-rules.conf | 3
utils/Makefile.defs | 2
utils/cloneByDate.py | 3
web/conf/rhn_web.conf | 3
57 files changed, 73 insertions(+), 367 deletions(-)
New commits:
commit 0ad984b3904a21e6ffb38f3da1cfd85a6cf6ca5f
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Thu Feb 28 09:38:37 2013 +0100
Move to three-parameter cx_Oracle.Connection call.
diff --git a/backend/server/rhnSQL/driver_cx_Oracle.py
b/backend/server/rhnSQL/driver_cx_Oracle.py
index 0b8a59a..ca7d7b0 100644
--- a/backend/server/rhnSQL/driver_cx_Oracle.py
+++ b/backend/server/rhnSQL/driver_cx_Oracle.py
@@ -361,7 +361,7 @@ class Database(sql_base.Database):
def __init__(self, host=None, port=None, username=None,
password=None, database=None):
- # Oracle requires enough info to assembled a dsn:
+ # Oracle requires enough info to connect
if not (username and password and database):
raise AttributeError, "A valid Oracle username, password, and SID are
required."
@@ -371,10 +371,9 @@ class Database(sql_base.Database):
self.password = password
self.database = database
- # dbtxt is the connection string without the password
- self.dbtxt = self.dsn
- if '@' in self.dsn:
- self.dbtxt = string.split(self.dsn, '@')[-1]
+ # dbtxt is the connection string without the password, to be used in exceptions
+ self.dbtxt = self.username + '@' + self.database
+
self.dbh = None
# self.stderr keeps the sys.stderr handle alive in case it gets
@@ -411,7 +410,7 @@ class Database(sql_base.Database):
self._cursor_class._cursor_cache[dbh_id] = {}
def _connect(self):
- dbh = cx_Oracle.Connection(self.dsn)
+ dbh = cx_Oracle.Connection(self.username, self.password, self.database)
if hasattr(sys, "argv"):
dbh.cursor().execute(
"BEGIN DBMS_APPLICATION_INFO.SET_MODULE('%s',NULL);
END;"
@@ -443,7 +442,7 @@ class Database(sql_base.Database):
except:
pass
del _cursor_cache[dbh_id]
- self.dbh = self.dsn = None
+ self.dbh = None
def cursor(self):
return self._cursor_class(dbh=self.dbh)
diff --git a/backend/server/rhnSQL/sql_base.py b/backend/server/rhnSQL/sql_base.py
index b376c82..03ce800 100644
--- a/backend/server/rhnSQL/sql_base.py
+++ b/backend/server/rhnSQL/sql_base.py
@@ -300,9 +300,6 @@ class Database:
def __init__(self, host=None, port=None, username=None,
password=None, database=None):
- # TODO: For now, keep assuming incoming args are used to assemble a dsn.
- # (really not sure what might be using this)
- self.dsn = "%s/%s@%s" % (username, password, database)
def connect(self, reconnect=1):
""" Opens a connection to the database. """
@@ -357,10 +354,6 @@ class Database:
"rollback changes, optionally to a previously set transaction point"
pass
- def check(self):
- "check the connection"
- return self.dsn is not None
-
def close(self):
"Close the connection"
pass
commit 9e12586842ed04852aa5c09ea1f5c85309a902af
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Fri Feb 8 17:22:48 2013 +0100
Removing the dsn parameter from initDB, removing support for --db option.
We just use the defaults everywhere, let initDB() do the right thing..
diff --git a/backend/Makefile.defs b/backend/Makefile.defs
index 36fd745..fd677e0 100644
--- a/backend/Makefile.defs
+++ b/backend/Makefile.defs
@@ -89,7 +89,7 @@ pychecker :: $(PYFILES)
$(descend-subdirs)
db-checker :: $(PYFILES)
- @PYTHONPATH=$(PYTHONPATH) $(TOP)/$(DBCHECKER) $(DBCHECKEROPTS) --db $(DB) $(PYFILES) ||
:
+ @PYTHONPATH=$(PYTHONPATH) $(TOP)/$(DBCHECKER) $(DBCHECKEROPTS) $(PYFILES) || :
$(descend-subdirs)
graphviz ::
diff --git a/backend/common/rhnConfig.py b/backend/common/rhnConfig.py
index c12a6ce..e9bd5a3 100644
--- a/backend/common/rhnConfig.py
+++ b/backend/common/rhnConfig.py
@@ -336,27 +336,7 @@ class RHNOptions:
"""
self.__check()
if not self.__configs[self.__component].has_key(key):
- if key == 'DEFAULT_DB':
- # this is a special virtual key for backward compatibility
- if self.__configs[self.__component]['db_backend'] ==
'oracle':
- default_db = "%s/%s@%s" % (
- self.__configs[self.__component]['db_user'],
- self.__configs[self.__component]['db_password'],
- self.__configs[self.__component]['db_name'])
- else:
- default_db = "%s/%s@dbname=%s" % (
- self.__configs[self.__component]['db_user'],
- self.__configs[self.__component]['db_password'],
- self.__configs[self.__component]['db_name'])
- db_host = self.__configs[self.__component]['db_host']
- if db_host:
- default_db += ";host=%s" % db_host
- db_port = self.__configs[self.__component]['db_port']
- if db_port:
- default_db += ";port=%s" % db_port
- return default_db
- else:
- raise AttributeError(key)
+ raise AttributeError(key)
return self.__configs[self.__component][key]
__getitem__ = __getattr__
diff --git a/backend/common/spacewalk-cfg-get b/backend/common/spacewalk-cfg-get
index 7b2c57e..0bc841b 100644
--- a/backend/common/spacewalk-cfg-get
+++ b/backend/common/spacewalk-cfg-get
@@ -26,22 +26,7 @@ if do_list:
cfg.show()
else:
val = cfg.get(key)
- # default_db is a special 'virtual' key
- if key == 'default_db':
- if cfg.get('db_backend') == 'oracle':
- default_db = "%s/%s@%s" % (
- cfg.get('db_user'), cfg.get('db_password'),
cfg.get('db_name'))
- elif cfg.get('db_backend') == 'postgresql':
- default_db = "%s/%s@db_name=%s" % (
- cfg.get('db_user'), cfg.get('db_password'),
cfg.get('db_name'))
- db_host = cfg.get('db_host')
- if db_host:
- default_db += ";host=%s" % db_host
- db_port = cfg.get('db_port')
- if db_port:
- default_db += ";port=%s" % db_port
- print default_db
- elif isinstance(val, list):
+ if isinstance(val, list):
for i in val:
print i
elif val != None:
diff --git a/backend/db-checker.py b/backend/db-checker.py
index e5a126c..cda696d 100755
--- a/backend/db-checker.py
+++ b/backend/db-checker.py
@@ -26,20 +26,7 @@ if _topdir not in sys.path:
from spacewalk.server import rhnSQL
def main():
- options_table = [
- Option("-d", "--db", action="store",
- help="DB string to connect to"),
- ]
-
- parser = OptionParser(option_list=options_table)
-
- (options, args) = parser.parse_args()
-
- if not options.db:
- print "--db not specified"
- return 1
-
- rhnSQL.initDB(options.db)
+ rhnSQL.initDB()
if not args:
print "No module specified"
diff --git a/backend/satellite_exporter/satexport.py
b/backend/satellite_exporter/satexport.py
index 60413c7..b9eb8b6 100644
--- a/backend/satellite_exporter/satexport.py
+++ b/backend/satellite_exporter/satexport.py
@@ -63,7 +63,7 @@ class BaseApacheServer:
return self._send_xmlrpc(req, rhnFault(-1,
_("IMPORTANT MESSAGE FOLLOWS:\n%s") % msg, explain=0))
- rhnSQL.initDB(CFG.DEFAULT_DB)
+ rhnSQL.initDB()
self.server = options['SERVER']
self.server_classes = rhnImport.load("satellite_exporter/handlers")
diff --git a/backend/satellite_tools/disk_dumper/iss.py
b/backend/satellite_tools/disk_dumper/iss.py
index eabb51a..95005c3 100644
--- a/backend/satellite_tools/disk_dumper/iss.py
+++ b/backend/satellite_tools/disk_dumper/iss.py
@@ -1020,7 +1020,6 @@ class ExporterMain:
debug_level = int(CFG.DEBUG)
CFG.set("TRACEBACK_MAIL", self.options.traceback_mail or
CFG.TRACEBACK_MAIL)
- CFG.set("DEFAULT_DB", self.options.db or CFG.DEFAULT_DB)
CFG.set("DEBUG", debug_level)
CFG.set("ISSEMAIL", self.options.email)
@@ -1029,7 +1028,7 @@ class ExporterMain:
#This was taken straight from satsync.py.
try:
- rhnSQL.initDB(CFG.DEFAULT_DB)
+ rhnSQL.initDB()
except SQLConnectError:
print 'SQLERROR: There was an error connecting to the Database.'
sys.exit(-1)
diff --git a/backend/satellite_tools/disk_dumper/iss_ui.py
b/backend/satellite_tools/disk_dumper/iss_ui.py
index 8bb5d85..9e22730 100644
--- a/backend/satellite_tools/disk_dumper/iss_ui.py
+++ b/backend/satellite_tools/disk_dumper/iss_ui.py
@@ -68,8 +68,6 @@ class UI:
help="Email a report of what was exported."),
option( "--traceback-mail",
action="store",
help="Alternative email address for --email."),
- option( "--db",
action="store",
- help="Connect to this database."),
]
self.optionparser = option_parser(option_list=self.optiontable)
self.options, self.args = self.optionparser.parse_args()
diff --git a/backend/satellite_tools/disk_dumper/rhn-satellite-exporter.sgml
b/backend/satellite_tools/disk_dumper/rhn-satellite-exporter.sgml
index a83bc1f..f0ea7fc 100644
--- a/backend/satellite_tools/disk_dumper/rhn-satellite-exporter.sgml
+++ b/backend/satellite_tools/disk_dumper/rhn-satellite-exporter.sgml
@@ -86,9 +86,6 @@ A tool that exports satellite content into a directory in an XML format.
That co
<arg>--traceback-mail</arg>
</cmdsynopsis>
<cmdsynopsis>
-
<arg>--db=<replaceable>DBUSERNAME/DBPASSWORD@DBSID</replaceable></arg>
- </cmdsynopsis>
- <cmdsynopsis>
<arg>--help</arg>
</cmdsynopsis>
</Synopsis>
@@ -109,9 +106,6 @@ A tool that exports satellite content into a directory in an XML
format. That co
When importing an exported channel into a satellite on which you have not run
satellite-sync, you will need to use satellite-sync's --rhn-cert option to import the
entitlements cert.
</para>
<para>
- The --db option is mainly intended for debug purposes. If you decide to use this
option, be warned that rhn-satellite-exporter will not be able to export the RPMs for the
channel you are dumping if the RPMs are not already imported into the satellite you are
running rhn-satellite-exporter on. As an example, if you are running
rhn-satellite-exporter on Satellite A with the --db option to connect to the database for
Satellite B, rhn-satellite-exporter will not find the RPMs because they are not on
Satellite A. They are on Satellite B. The exception to this is if the channel(s) you are
exporting exist on both Satellite A and Satellite B.
-</para>
-<para>
The --email option is used to send a report to the administrator's email address
when the export is complete. If an error occurs when the --email option is set, the error
should be included in the report. The only time that --email will not work is if an error
occurs while the program is starting up. Increasing the debug level by using --debug-level
will increase the amount of information included in the report.
</para>
</RefSect1>
@@ -273,12 +267,6 @@ A tool that exports satellite content into a directory in an XML
format. That co
</listitem>
</varlistentry>
<varlistentry>
-
<term>--db=<replaceable>DBUSERNAME/DBPASSWORD@DBSID</replaceable></term>
- <listitem>
- <para>Extract information from this database. The value must be an
Oracle connection string that is configured in your tnsnames.ora file.</para>
- </listitem>
- </varlistentry>
- <varlistentry>
<term>-h, --help</term>
<listitem>
<para>Show help message and exit.</para>
diff --git a/backend/satellite_tools/reposync.py b/backend/satellite_tools/reposync.py
index a9c72a9..53c2769 100644
--- a/backend/satellite_tools/reposync.py
+++ b/backend/satellite_tools/reposync.py
@@ -57,8 +57,7 @@ class RepoSync(object):
self.sync_kickstart = sync_kickstart
initCFG('server')
- db_string = CFG.DEFAULT_DB
- rhnSQL.initDB(db_string)
+ rhnSQL.initDB()
# setup logging
log_filename = 'reposync.log'
diff --git a/backend/satellite_tools/rhn-entitlement-report
b/backend/satellite_tools/rhn-entitlement-report
index 80c4b4b..78823b2 100755
--- a/backend/satellite_tools/rhn-entitlement-report
+++ b/backend/satellite_tools/rhn-entitlement-report
@@ -6,16 +6,13 @@ from pprint import pprint
try:
from spacewalk.server import rhnSQL
- from spacewalk.common.rhnConfig import CFG, initCFG
except:
print "Couldn't load needed libs, Are you sure you are running this on a
satellite?"
sys.exit(1)
-initCFG()
-db_string = CFG.DEFAULT_DB
-rhnSQL.initDB(db_string)
+rhnSQL.initDB()
def main():
printAcrossSatelliteUsage();
diff --git a/backend/satellite_tools/rhn-schema-version
b/backend/satellite_tools/rhn-schema-version
index d482b6c..eb96fd0 100755
--- a/backend/satellite_tools/rhn-schema-version
+++ b/backend/satellite_tools/rhn-schema-version
@@ -40,36 +40,15 @@ if _LIBPATH not in sys.path:
try:
from spacewalk.server import rhnSQL
- from spacewalk.common.rhnConfig import initCFG
except KeyboardInterrupt:
sys.stderr.write("\nUser interrupted process.\n")
sys.exit(0)
def processCommandline():
- """ process the commandline """
-
- from optparse import Option, OptionParser
- optionsTable = [
- Option('--db', action='store', type="string",
- help='alternative database string (USERNAME/PASSWORD@SID). '+\
- 'Default value is the DEFAULT_DB setting in '+\
- '/etc/rhn/rhn.conf'),
- ]
-
- optionParser = OptionParser(option_list=optionsTable)
- options, args = optionParser.parse_args()
-
- # we take no extra commandline arguments that are not linked to an option
- if args:
- msg = "ERROR: these arguments make no sense in this context (try "+\
- "--help): %s\n" % repr(args)
- sys.stderr.write(msg)
- sys.exit(-1)
- initCFG('server')
try:
- rhnSQL.initDB(options.db)
+ rhnSQL.initDB()
except KeyboardInterrupt:
sys.stderr.write("\nUser interrupted process.\n")
sys.exit(0)
diff --git a/backend/satellite_tools/rhn-schema-version.sgml
b/backend/satellite_tools/rhn-schema-version.sgml
index ec15eab..c16e055 100644
--- a/backend/satellite_tools/rhn-schema-version.sgml
+++ b/backend/satellite_tools/rhn-schema-version.sgml
@@ -23,9 +23,6 @@ Fetch the database schema version for an &RHNSAT;.
<arg>options <replaceable>...</replaceable></arg>
</cmdsynopsis>
<cmdsynopsis>
- <arg>--db
<replaceable>USERNAME/PASSWORD@SID</replaceable></arg>
- </cmdsynopsis>
- <cmdsynopsis>
<arg>-h</arg> <arg>--help</arg>
</cmdsynopsis>
</Synopsis>
@@ -47,13 +44,6 @@ Fetch the database schema version for an &RHNSAT;.
<para>Display the help screen with a list of options.</para>
</listitem>
</varlistentry>
- <varlistentry>
- <term>--db
<replaceable>USERNAME/PASSWORD@SID</replaceable></term>
- <listitem>
- <para>alternative database string. Default value is the DEFAULT_DB
- setting in /etc/rhn/rhn.conf</para>
- </listitem>
- </varlistentry>
</variablelist>
</RefSect1>
diff --git a/backend/satellite_tools/rhn_satellite_activate.py
b/backend/satellite_tools/rhn_satellite_activate.py
index acf5af5..73f57c0 100644
--- a/backend/satellite_tools/rhn_satellite_activate.py
+++ b/backend/satellite_tools/rhn_satellite_activate.py
@@ -156,7 +156,7 @@ def prepRhnCert(options):
writing to default storage location
"""
- # NOTE: default_db MUST be populated in /etc/rhn/rhn.conf before this
+ # NOTE: db_* options MUST be populated in /etc/rhn/rhn.conf before this
# function is run.
# validateSatCert() must have been run prior to this as well (it
# populates "/var/log/entitlementCert"
@@ -186,7 +186,7 @@ def activateSatellite_local(options):
Assumptions:
o cert has already been written to DEFAULT_RHN_CERT_LOCATION
- o rhn.conf is written, to include default_db setting
+ o rhn.conf is written, to include db_* setting
o database is setup and populated
"""
@@ -406,10 +406,6 @@ def populateChannelFamilies(options):
if options.dump_version:
args.extend(['--dump-version', options.dump_version])
- ## database string for that satellite-sync
- #if options.db:
- # args.extend(['--db', options.db])
-
if options.verbose:
print "Executing: %s\n" % repr(' '.join(args))
ret, out_stream, err_stream = fileutils.rhn_popen(args)
@@ -573,15 +569,7 @@ def main():
# local activation
try:
- db_backend = CFG.DB_BACKEND
- db_host = CFG.DB_HOST
- db_port = CFG.DB_PORT
- db_user = CFG.DB_user
- db_password = CFG.DB_PASSWORD
- database = CFG.DB_NAME
-
- rhnSQL.initDB(backend=db_backend, host=db_host, port=db_port,
- username=db_user, password=db_password, database=database)
+ rhnSQL.initDB()
if options.verbose:
print ("Database connectioned initialized: refer to %s" %
CFG.filename)
diff --git a/backend/satellite_tools/rhn_ssl_dbstore.py
b/backend/satellite_tools/rhn_ssl_dbstore.py
index 2c16374..4a736e1 100644
--- a/backend/satellite_tools/rhn_ssl_dbstore.py
+++ b/backend/satellite_tools/rhn_ssl_dbstore.py
@@ -18,7 +18,6 @@ import sys
from optparse import Option, OptionParser
from spacewalk.common import rhnTB
-from spacewalk.common.rhnConfig import CFG, initCFG
from spacewalk.server import rhnSQL
import satCerts
@@ -26,7 +25,6 @@ import satCerts
DEFAULT_TRUSTED_CERT = 'RHN-ORG-TRUSTED-SSL-CERT'
def processCommandline():
- initCFG('server.satellite')
options = [
Option('--ca-cert', action='store',
default=DEFAULT_TRUSTED_CERT, type="string", help='public CA certificate,
default is %s' % DEFAULT_TRUSTED_CERT),
@@ -48,15 +46,7 @@ def processCommandline():
sys.exit(10)
try:
- db_backend = CFG.DB_BACKEND
- db_host = CFG.DB_HOST
- db_port = CFG.DB_PORT
- db_user = CFG.DB_user
- db_password = CFG.DB_PASSWORD
- db_name = CFG.DB_NAME
-
- rhnSQL.initDB(backend=db_backend, host=db_host, port=db_port,
- username=db_user, password=db_password, database=db_name)
+ rhnSQL.initDB()
except:
sys.stderr.write("""\
ERROR: there was a problem trying to initialize the database:
diff --git a/backend/satellite_tools/satCerts.py b/backend/satellite_tools/satCerts.py
index bfe238b..863598b 100644
--- a/backend/satellite_tools/satCerts.py
+++ b/backend/satellite_tools/satCerts.py
@@ -776,11 +776,7 @@ def verify_family_permissions(orgid=1):
if __name__ == '__main__':
- from spacewalk.common.rhnConfig import CFG, initCFG
-
- initCFG('server.satellite')
- print 'database: %s' % CFG.DEFAULT_DB
- rhnSQL.initDB(CFG.DEFAULT_DB)
+ rhnSQL.initDB()
#_test_storeRhnCert(open('rhn.cert').read())
_test_store_rhnCryptoKey('ca.crt')
diff --git a/backend/satellite_tools/satComputePkgHeaders.py
b/backend/satellite_tools/satComputePkgHeaders.py
index c272cd6..4955581 100644
--- a/backend/satellite_tools/satComputePkgHeaders.py
+++ b/backend/satellite_tools/satComputePkgHeaders.py
@@ -20,8 +20,6 @@
import sys
from optparse import OptionParser, Option
-from spacewalk.common.rhnConfig import initCFG
-
SERVER_RETURN = 0
def log_error(*args):
@@ -56,8 +54,6 @@ from spacewalk.common import rhn_rpm
options_table = [
Option("-v", "--verbose", action="count",
help="Increase verbosity"),
- Option("-d", "--db", action="store",
- help="DB string to connect to"),
Option("--commit", action="store_true",
help="Commit work"),
Option("--backup-file", action="store",
@@ -77,12 +73,7 @@ class Runner:
(self.options, args) = parser.parse_args()
- if not self.options.db:
- print "--db not specified"
- return 1
-
- initCFG('server')
- rhnSQL.initDB(self.options.db)
+ rhnSQL.initDB()
self._channels_hash = self._get_channels()
diff --git a/backend/satellite_tools/satellite-sync.sgml
b/backend/satellite_tools/satellite-sync.sgml
index a6bd163..df8b3f6 100644
--- a/backend/satellite_tools/satellite-sync.sgml
+++ b/backend/satellite_tools/satellite-sync.sgml
@@ -99,10 +99,6 @@ Incrementally synchronize an RHN Satellite's DB data and RPM
repository with Red
<arg>--ca-cert=<replaceable>SSL_CA_CERT_FULL_PATH</replaceable></arg>
</cmdsynopsis>
<cmdsynopsis>
-
<arg>-d<replaceable>DBUSERNAME/DBPASSWORD@DBSID</replaceable></arg>
-
<arg>--db=<replaceable>DBUSERNAME/DBPASSWORD@DBSID</replaceable></arg>
- </cmdsynopsis>
- <cmdsynopsis>
<arg>--orgid=<replaceable>ORGID</replaceable></arg>
</cmdsynopsis>
<cmdsynopsis>
@@ -444,13 +440,6 @@ Incrementally synchronize an RHN Satellite's DB data and RPM
repository with Red
</listitem>
</varlistentry>
<varlistentry>
- <term>-d<replaceable>DBUSERNAME/DBPASSWORD@DB</replaceable>,
-
--db=<replaceable>DBUSERNAME/DBPASSWORD@DB</replaceable></term>
- <listitem>
- <para>alternative database connection string
(username/password(a)sid).</para>
- </listitem>
- </varlistentry>
- <varlistentry>
<term>--orgid=<replaceable>ORGID</replaceable></term>
<listitem>
<para>Organization to which the sync imports data.
diff --git a/backend/satellite_tools/satsync.py b/backend/satellite_tools/satsync.py
index e9c8f27..d075a3d 100644
--- a/backend/satellite_tools/satsync.py
+++ b/backend/satellite_tools/satsync.py
@@ -200,8 +200,7 @@ class Runner:
log(-1, ['', messages.syncer_error % e], )
sys.exit(10)
- dbusername, dbpassword, dbinstance = _parseDbString(CFG.DEFAULT_DB)
- log(1, ' db: %s/<password>@%s' % (dbusername, dbinstance))
+ log(1, ' db: %s/<password>@%s' % (CFG.DB_USER, CFG.DB_NAME))
selected = filter(lambda action, ad=actionDict: ad[action],
actionDict.keys())
@@ -2028,33 +2027,6 @@ def _getImportedChannels():
return []
-def _parseDbString(dbstring):
- """ given "dbusername/dbpassword@dbinstance",
- return (dbusername, dbpassword, dbinstance).
- """
- x = ''
- errorMsg = _('ERROR: in /etc/rhn/rhn.conf DEFAULT_DB '
- 'must be of form dbusername/dbpassword@dbinstance')
-
- # parse instance
- try:
- x = string.split(dbstring, '@')
- except:
- log(-1, errorMsg, stream=sys.stderr)
- sys.exit(18)
- if len(x) != 2:
- log(-1, errorMsg, stream=sys.stderr)
- sys.exit(18)
- dbinstance = x[1]
-
- # parse username and password
- u_p = string.split(x[0], '/')
- if len(u_p) != 2:
- log(-1, errorMsg, stream=sys.stderr)
- sys.exit(18)
- return (u_p[0], u_p[1], dbinstance)
-
-
def processCommandline():
"process the commandline, setting the OPTIONS object"
@@ -2070,8 +2042,6 @@ def processCommandline():
help=_('disk dump will be considered to be a full export; see "man
satellite-sync" for more information.')),
Option( '--include-custom-channels',
action='store_true',
help=_('existing custom channels will also be synced (unless -c is
used)')),
- Option('-d','--db', action='store',
- help=_('alternative database connection string
(username/password@sid)')),
Option( '--debug-level', action='store',
help=_('override debug level set in /etc/rhn/rhn.conf (which is currently
set at %s).') % CFG.DEBUG),
Option( '--dump-version', action='store',
@@ -2154,10 +2124,9 @@ def processCommandline():
CFG.set("HTTP_PROXY_USERNAME", OPTIONS.http_proxy_username or
CFG.HTTP_PROXY_USERNAME)
CFG.set("HTTP_PROXY_PASSWORD", OPTIONS.http_proxy_password or
CFG.HTTP_PROXY_PASSWORD)
CFG.set("CA_CHAIN", OPTIONS.ca_cert or CFG.CA_CHAIN)
- CFG.set("DEFAULT_DB", OPTIONS.db or CFG.DEFAULT_DB)
try:
- rhnSQL.initDB(CFG.DEFAULT_DB)
+ rhnSQL.initDB()
except (SQLError, SQLSchemaError, SQLConnectError), e:
# An SQL error is fatal... crash and burn
log(-1, _("ERROR: Can't connect to the database: %s") % e,
stream=sys.stderr)
diff --git a/backend/satellite_tools/spacewalk-data-fsck
b/backend/satellite_tools/spacewalk-data-fsck
index 5464850..4d0cf53 100755
--- a/backend/satellite_tools/spacewalk-data-fsck
+++ b/backend/satellite_tools/spacewalk-data-fsck
@@ -51,7 +51,7 @@ def is_sha256_capable():
def db_init():
initCFG('server')
- rhnSQL.initDB(CFG.DEFAULT_DB)
+ rhnSQL.initDB()
def package_query(options, bind_path=False):
query = """select %s
@@ -283,8 +283,6 @@ if __name__ == '__main__':
help="Don't check package checksum"),
Option("-O", "--no-nevrao",
action="store_false", dest="nevrao", default=True,
help="Don't check package name, epoch, version, release, arch,
org"),
- Option("-d", "--db-only",
action="store_true",
- help="Check only if packages from database are present on
filesystem"),
Option("-f", "--fs-only",
action="store_true",
help="Check only if packages from filesystem are in the
database"),
Option("-r", "--remove",
action="store_true",
diff --git a/backend/satellite_tools/spacewalk-remove-channel
b/backend/satellite_tools/spacewalk-remove-channel
index 627f4ea..ee041b3 100755
--- a/backend/satellite_tools/spacewalk-remove-channel
+++ b/backend/satellite_tools/spacewalk-remove-channel
@@ -90,7 +90,7 @@ def main():
initCFG('server')
initLOG("stdout", options.verbose or 0)
- rhnSQL.initDB(CFG.DEFAULT_DB)
+ rhnSQL.initDB()
dict_label, dict_parents = __listChannels()
if options.list:
diff --git a/backend/satellite_tools/spacewalk-update-signatures
b/backend/satellite_tools/spacewalk-update-signatures
index 6cb1ee2..80ba74d 100644
--- a/backend/satellite_tools/spacewalk-update-signatures
+++ b/backend/satellite_tools/spacewalk-update-signatures
@@ -38,8 +38,6 @@ verbose = 0
options_table = [
Option("-v", "--verbose", action="count",
help="Increase verbosity"),
- Option("-d", "--db", action="store",
- help="DB string to connect to"),
Option( "--debug", action="store_true",
help="logs the debug information to a log file"),
]
@@ -64,12 +62,7 @@ def main():
initLOG(CFG.LOG_FILE, options.debug or 0)
debug = 1
- if not options.db:
- sys.stderr.write("--db not specified\n")
- sys.exit(1)
-
- print "Connecting to %s" % options.db
- rhnSQL.initDB(options.db)
+ rhnSQL.initDB()
process_package_data()
diff --git a/backend/satellite_tools/spacewalk-update-signatures.sgml
b/backend/satellite_tools/spacewalk-update-signatures.sgml
index 1292818..7b3bec0 100644
--- a/backend/satellite_tools/spacewalk-update-signatures.sgml
+++ b/backend/satellite_tools/spacewalk-update-signatures.sgml
@@ -51,12 +51,6 @@ Helper utility that update packages checksum.
</listitem>
</varlistentry>
<varlistentry>
- <term>-d DB, --db=DB</term>
- <listitem>
- <para>DB string to connect to.</para>
- </listitem>
- </varlistentry>
- <varlistentry>
<term>--debug</term>
<listitem>
<para>Logs the debug information to a log file
/var/log/rhn/update-packages.log</para>
diff --git a/backend/satellite_tools/test/test-dump-arches.py
b/backend/satellite_tools/test/test-dump-arches.py
index 576c215..f4159b5 100644
--- a/backend/satellite_tools/test/test-dump-arches.py
+++ b/backend/satellite_tools/test/test-dump-arches.py
@@ -16,7 +16,7 @@ from spacewalk.server import rhnSQL
from spacewalk.satellite_tools.exporter import xmlWriter, exportLib
-rhnSQL.initDB("satdev/satdev@citisat")
+rhnSQL.initDB()
writer = xmlWriter.XMLWriter(skip_xml_decl=1)
diff --git a/backend/satellite_tools/test/test-dump-channel.py
b/backend/satellite_tools/test/test-dump-channel.py
index ee2a5c2..25d866d 100644
--- a/backend/satellite_tools/test/test-dump-channel.py
+++ b/backend/satellite_tools/test/test-dump-channel.py
@@ -18,7 +18,7 @@ from spacewalk.server import rhnSQL
from spacewalk.satellite_tools import xmlSource
from spacewalk.satellite_tools.exporter import xmlWriter, exportLib
-rhnSQL.initDB("rhnuser/rhnuser@webdev")
+rhnSQL.initDB()
s = StringIO.StringIO()
writer = xmlWriter.XMLWriter(stream=s)
diff --git a/backend/satellite_tools/test/test-dump-ks.py
b/backend/satellite_tools/test/test-dump-ks.py
index 90f4f6d..63a534a 100644
--- a/backend/satellite_tools/test/test-dump-ks.py
+++ b/backend/satellite_tools/test/test-dump-ks.py
@@ -15,7 +15,7 @@
from spacewalk.server import rhnSQL
from spacewalk.satellite_tools.exporter import xmlWriter, exportLib
-rhnSQL.initDB("rhnuser/rhnuser@webdev")
+rhnSQL.initDB()
w = xmlWriter.XMLWriter(skip_xml_decl=1)
diff --git a/backend/satellite_tools/test/test-import-rhn-cert.py
b/backend/satellite_tools/test/test-import-rhn-cert.py
index 4d1b1f6..e7b900a 100644
--- a/backend/satellite_tools/test/test-import-rhn-cert.py
+++ b/backend/satellite_tools/test/test-import-rhn-cert.py
@@ -17,13 +17,12 @@ from spacewalk.server import rhnSQL
from spacewalk.satellite_tools import satCerts
def main():
- if len(sys.argv) != 3:
- print "Usage: %s <db-string> <cert>" % sys.argv[0]
+ if len(sys.argv) != 2:
+ print "Usage: %s <cert>" % sys.argv[0]
return 1
- db_string = sys.argv[1]
- cert = sys.argv[2]
+ cert = sys.argv[1]
- rhnSQL.initDB(db_string)
+ rhnSQL.initDB()
satCerts.storeRhnCert(open(cert).read())
diff --git a/backend/satellite_tools/test/test-satsync-errata.py
b/backend/satellite_tools/test/test-satsync-errata.py
index 64103e7..68f22bd 100644
--- a/backend/satellite_tools/test/test-satsync-errata.py
+++ b/backend/satellite_tools/test/test-satsync-errata.py
@@ -21,7 +21,7 @@ from syncContainerHandlers import processErrata
initCFG('server.satellite')
initLOG(CFG.LOG_FILE, CFG.DEBUG)
-rhnSQL.initDB('satuser/satuser@satdev')
+rhnSQL.initDB()
cache = SyncCache().init()
cache.addChannelsState(['redhat-linux-i386-8.0'])
diff --git a/backend/satellite_tools/test/test-store_rhnCryptoKey.py
b/backend/satellite_tools/test/test-store_rhnCryptoKey.py
index c22f833..f688e87 100644
--- a/backend/satellite_tools/test/test-store_rhnCryptoKey.py
+++ b/backend/satellite_tools/test/test-store_rhnCryptoKey.py
@@ -25,7 +25,6 @@
import os
from spacewalk.server import rhnSQL
-from spacewalk.common.rhnConfig import CFG, initCFG
from spacewalk.satellite_tools.satCerts import store_rhnCryptoKey
from spacewalk.satellite_tools.satCerts import _querySelectCryptoCertInfo
@@ -34,8 +33,7 @@ print "NOTE: has to be performed on an RHN Satellite or
server"
description = 'RHN-ORG-TRUSTED-SSL-CERT'
-initCFG('server.satellite')
-rhnSQL.initDB(CFG.DEFAULT_DB)
+rhnSQL.initDB()
def deleteCertRow():
# get rhn_cryptokey_id (there can only be one, bugzilla: 120297)
diff --git a/backend/satellite_tools/update-packages.sgml
b/backend/satellite_tools/update-packages.sgml
index 00b5269..81fbf60 100644
--- a/backend/satellite_tools/update-packages.sgml
+++ b/backend/satellite_tools/update-packages.sgml
@@ -32,7 +32,7 @@ If you're upgrading from RHN Satellite 5.3, this step can be safely
skipped.
<para>
Run update-packages script as root:
<code>
- /usr/bin/update-packages --db=$(spacewalk-cfg-get default_db) \
+ /usr/bin/update-packages \
--update-filer \
--update-kstrees \
--debug
@@ -62,12 +62,6 @@ size of your filer and the speed of your hardware. Assume 60 - 120 GB /
hour.
</listitem>
</varlistentry>
<varlistentry>
- <term>-d DB, --db=DB</term>
- <listitem>
- <para>DB string to connect to.</para>
- </listitem>
- </varlistentry>
- <varlistentry>
<term>--debug</term>
<listitem>
<para>Logs the debug information to a log file
/var/log/rhn/update-packages.log</para>
diff --git a/backend/satellite_tools/updatePackages.py
b/backend/satellite_tools/updatePackages.py
index ef10f05..2018f82 100644
--- a/backend/satellite_tools/updatePackages.py
+++ b/backend/satellite_tools/updatePackages.py
@@ -47,7 +47,6 @@ options_table = [
help="Convert filer structure"),
Option("--update-kstrees", action="store_true",
help="Fix kickstart trees permissions"),
- Option("-d", "--db", action="store", help="DB
string to connect to"),
Option("-v", "--verbose", action="count",
help="Increase verbosity"),
Option("--debug", action="store_true",
@@ -74,12 +73,7 @@ def main():
initLOG(CFG.LOG_FILE, options.debug or 0)
debug = 1
- if not options.db:
- sys.stderr.write("--db not specified\n")
- sys.exit(1)
-
- print "Connecting to %s" % options.db
- rhnSQL.initDB(options.db)
+ rhnSQL.initDB()
if options.update_filer:
process_package_data()
diff --git a/backend/server/handlers/app/test/test_channel.py
b/backend/server/handlers/app/test/test_channel.py
index 1de3753..c3914f6 100644
--- a/backend/server/handlers/app/test/test_channel.py
+++ b/backend/server/handlers/app/test/test_channel.py
@@ -43,15 +43,10 @@ kargs = {
'release' : version
}
-def init_db(username, password, dbhost):
- db = "%s/%s@%s" % (username, password, dbhost)
- rhnSQL.initDB(db)
-
class ChannelTestCase(unittest.TestCase):
def setUp(self):
- #init_db('rhnuser', 'rhnuser', db)
- rhnSQL.initDB('rhnuser/rhnuser@webdev')
+ rhnSQL.initDB()
def tearDown(self):
rhnSQL.rollback()
diff --git a/backend/server/handlers/config/test/test_template1.py
b/backend/server/handlers/config/test/test_template1.py
index df0fb3d..9b55c37 100644
--- a/backend/server/handlers/config/test/test_template1.py
+++ b/backend/server/handlers/config/test/test_template1.py
@@ -17,7 +17,7 @@ import sys
from templated_document import ServerTemplatedDocument
from spacewalk.server import rhnServer, rhnSQL
-rhnSQL.initDB('rhnuser/rhnuser@webdev')
+rhnSQL.initDB()
server_id = 1003887108
diff --git a/backend/server/importlib/channelImport.py
b/backend/server/importlib/channelImport.py
index 1467a8d..da20eea 100644
--- a/backend/server/importlib/channelImport.py
+++ b/backend/server/importlib/channelImport.py
@@ -353,7 +353,7 @@ if __name__ == '__main__':
x = DistChannelMap()
x.populate(dcm)
batch.append(x)
- rhnSQL.initDB('rhnsat/rhnsat@rhnsat')
+ rhnSQL.initDB()
backend.init()
dcmimp = DistChannelMapImport(batch, backend)
dcmimp.run()
@@ -376,7 +376,7 @@ if __name__ == '__main__':
cf = ChannelFamily()
cf.populate(fam)
batch.append(cf)
- rhnSQL.initDB('rhnsat/rhnsat@rhnsat')
+ rhnSQL.initDB()
backend.init()
cfimp = ChannelFamilyImport(batch, backend)
cfimp.run()
diff --git a/backend/server/importlib/test/test_backendOracle.py
b/backend/server/importlib/test/test_backendOracle.py
index 80d989d..7d58c13 100644
--- a/backend/server/importlib/test/test_backendOracle.py
+++ b/backend/server/importlib/test/test_backendOracle.py
@@ -3,8 +3,6 @@
from spacewalk.server import rhnSQL
-DB = 'rhnsat/rhnsat@rhnsat'
-
from spacewalk.server.importlib.backendOracle import OracleBackend
from spacewalk.server.importlib.backendLib import DBint, DBstring, DBdateTime, DBblob
@@ -16,7 +14,7 @@ for k,v in tabs.iteritems():
utabs[k.upper()] = v
-rhnSQL.initDB(DB)
+rhnSQL.initDB()
h = rhnSQL.prepare("""select table_name, column_name, data_type,
data_length
from user_tab_columns""")
h.execute()
diff --git a/backend/server/importlib/test/test_blob_update.py
b/backend/server/importlib/test/test_blob_update.py
index 61f236a..52efbb0 100644
--- a/backend/server/importlib/test/test_blob_update.py
+++ b/backend/server/importlib/test/test_blob_update.py
@@ -34,11 +34,7 @@ from spacewalk.server.importlib.backendLib import Table, DBblob, DBint,
TableUpd
TableInsert
def main():
- if len(sys.argv) != 2:
- print "Usage: %s <connect-string>" % sys.argv[0]
- return 1
-
- rhnSQL.initDB(sys.argv[1])
+ rhnSQL.initDB()
blob_values1 = [
# Regular update
diff --git a/backend/server/importlib/test/test_ks_tree.py
b/backend/server/importlib/test/test_ks_tree.py
index d65bb41..ec1e46b 100644
--- a/backend/server/importlib/test/test_ks_tree.py
+++ b/backend/server/importlib/test/test_ks_tree.py
@@ -50,7 +50,7 @@ ks_trees = [
}),
]
-rhnSQL.initDB("rhnuser/rhnuser@webdev")
+rhnSQL.initDB()
backend = OracleBackend()
backend.init()
diff --git a/backend/server/importlib/test/test_solaris.py
b/backend/server/importlib/test/test_solaris.py
index 453302b..ba12b61 100644
--- a/backend/server/importlib/test/test_solaris.py
+++ b/backend/server/importlib/test/test_solaris.py
@@ -251,8 +251,7 @@ solaris_patch_sets = [
if __debug__: print "-" * 75
-#rhnSQL.initDB("rhnuser/rhnuser@webdev")
-rhnSQL.initDB("shughes1/shughes1@shughes1")
+rhnSQL.initDB()
backend = OracleBackend()
backend.init()
diff --git a/backend/server/importlib/test/test_strict_channel_package_subscription.py
b/backend/server/importlib/test/test_strict_channel_package_subscription.py
index 666206f..2929dee 100644
--- a/backend/server/importlib/test/test_strict_channel_package_subscription.py
+++ b/backend/server/importlib/test/test_strict_channel_package_subscription.py
@@ -30,14 +30,12 @@
# invalid should become non-null (2 in my tests)
import sys
-from spacewalk.common.rhnConfig import initCFG
from spacewalk.server import rhnSQL
from spacewalk.server.importlib import importLib, packageImport, backendOracle
def main():
- initCFG("server.app")
- rhnSQL.initDB('rhnuser/rhnuser@webdev')
+ rhnSQL.initDB()
channel = { 'label' : 'mibanescu-test2' }
diff --git a/backend/server/rhn.conf.sample b/backend/server/rhn.conf.sample
index eb30b65..99158eb 100644
--- a/backend/server/rhn.conf.sample
+++ b/backend/server/rhn.conf.sample
@@ -38,7 +38,6 @@ traceback_mail = user0(a)example.com, user1(a)example.com
#
# server
#
-server.default_db = oracleuser/oraclepassword@oracleinstance
#server.mount_point = /pub
#server.disallow_user_creation = 0
#server.log_file = /var/log/rhn/rhn_server.log
diff --git a/backend/server/rhnPackage.py b/backend/server/rhnPackage.py
index 8405c70..8f9085f 100644
--- a/backend/server/rhnPackage.py
+++ b/backend/server/rhnPackage.py
@@ -248,7 +248,7 @@ if __name__ == '__main__':
"""
from spacewalk.common.rhnLog import initLOG
initLOG("stdout", 1)
- rhnSQL.initDB('rhnuser/rhnuser@webqa')
+ rhnSQL.initDB()
print
# new client
print get_package_path(1000463284, 'kernel-2.4.2-2.i686.rpm',
'redhat-linux-i386-7.1')
diff --git a/backend/server/rhnSQL/__init__.py b/backend/server/rhnSQL/__init__.py
index 0f8a8c0..3d2ac54 100644
--- a/backend/server/rhnSQL/__init__.py
+++ b/backend/server/rhnSQL/__init__.py
@@ -70,55 +70,31 @@ def __init__DB(backend, host, port, username, password, database):
__DB.connect()
return 0
-def initDB(dsn=None, backend=None, host="localhost", port=None, username=None,
+def initDB(backend=None, host=None, port=None, username=None,
password=None, database=None):
"""
Initialize the database.
- For Oracle connections: provide just a string dsn argument, or a username,
- password, and database. (sid in this case)
+ Either we get backend and all parameter which means the caller
+ knows what they are doing, or we populate everything from the
+ config files.
"""
- if backend == None:
- backend=CFG.DB_BACKEND
+ if backend is None:
+ backend = CFG.DB_BACKEND
+ host = CFG.DB_HOST
+ port = CFG.DB_PORT
+ database = CFG.DB_DATABASE
+ username = CFG.DB_USER
+ password = CFG.DB_PASSWORD
if not SUPPORTED_BACKENDS.has_key(backend):
raise rhnException("Unsupported database backend", backend)
- if backend == ORACLE:
- # For Oracle, must provide either dsn or username, password,
- # and database.
- if not dsn and not (username and password and database):
- # Grab the default from the config file:
- dsn = CFG.DEFAULT_DB
-
- if dsn:
- # split the dsn up into username/pass/sid so we can call the rest of
- # the code in a uniform fashion for all database backends:
- (username, temp) = dsn.split("/", 1)
- (password, database) = temp.split("@")
- del temp
-
- if backend == POSTGRESQL:
- host = None
- port = None
- dsn = CFG.DEFAULT_DB
- (username, temp) = dsn.split("/")
- (password, dsn) = temp.split("@")
- del temp
- for i in dsn.split(';'):
- (k, v) = i.split('=')
- if k == 'dbname':
- database = v
- elif k == 'host':
- host = v
- elif k == 'port':
- port = int(v)
- else:
- raise rhnException("Unknown piece in default_db string", i)
+ if port:
+ port = int(port)
# Hide the password
- add_to_seclist(dsn)
add_to_seclist(password)
try:
__init__DB(backend, host, port, username, password, database)
@@ -180,11 +156,6 @@ def Table(table, hash_name, local_cache = 0):
db = __test_DB()
return sql_table.Table(db, table, hash_name, local_cache)
-# Returns the connection string to the DB
-def database():
- db = __test_DB()
- return db.dsn
-
# Functions points of entry
def cursor():
db = __test_DB()
diff --git a/backend/server/rhnServer/server_lib.py
b/backend/server/rhnServer/server_lib.py
index 58f16f9..91809b9 100644
--- a/backend/server/rhnServer/server_lib.py
+++ b/backend/server/rhnServer/server_lib.py
@@ -344,5 +344,5 @@ def generate_random_string(length=20):
return string.lower(result)
if __name__ == '__main__':
- rhnSQL.initDB('rhnuser/rhnuser@webdev')
+ rhnSQL.initDB()
print update_push_client_registration(1000102174)
diff --git a/backend/server/rhnVirtualization.py b/backend/server/rhnVirtualization.py
index 6200667..c5bb94d 100644
--- a/backend/server/rhnVirtualization.py
+++ b/backend/server/rhnVirtualization.py
@@ -844,7 +844,7 @@ def is_host_uuid(uuid):
if __name__ == '__main__':
- rhnSQL.initDB("rhnsat/rhnsat@rhnsat")
+ rhnSQL.initDB()
host_sysid = 1000010001
guest_sysid = 1000010010
diff --git a/backend/server/test/TestServer.py b/backend/server/test/TestServer.py
index 8f775e8..1d7746c 100644
--- a/backend/server/test/TestServer.py
+++ b/backend/server/test/TestServer.py
@@ -28,7 +28,7 @@ class TestServer:
#The actual implementation
class TestServerImplementation:
- def __init__(self, username=None, password=None, email=None, dbusername=None,
dbpassword=None, dbhostname=None):
+ def __init__(self)
#start_init = time.time()
@@ -41,15 +41,12 @@ class TestServer:
self.test_username = username or ("test_username_%.3f" % mytime)
self.test_password = password or ("test_password_%.3f" % mytime)
self.test_email = email or ("%s(a)test_domain.com" %
self.test_username)
- self.dbusername = dbusername or 'rhnuser'
- self.dbpassword = dbpassword or 'rhnuser'
- self.dbhostname = dbhostname or 'webdev'
self.channel_arch = 'unittestarch'
self.roles = ['org_admin']
rhnFlags.set( 'outputTransportOptions', UserDictCase() )
- self._init_db( self.dbusername, self.dbpassword, self.dbhostname )
+ self._init_db()
self._init_org()
self._init_user(self.roles)
self._init_server()
@@ -57,9 +54,8 @@ class TestServer:
self._init_up2date()
#Sets up database connection
- def _init_db( self, username, password, dbhost ):
- self.db = "%s/%s@%s" % (username, password, dbhost)
- rhnSQL.initDB( self.db )
+ def _init_db( self ):
+ rhnSQL.initDB()
#creates an org
def _init_org( self ):
diff --git a/backend/server/test/misc_functions.py
b/backend/server/test/misc_functions.py
index a2ca59f..0c60146 100644
--- a/backend/server/test/misc_functions.py
+++ b/backend/server/test/misc_functions.py
@@ -28,10 +28,6 @@ import server.xmlrpc.up2date
from spacewalk.server import rhnSQL, rhnChannel, rhnServer, rhnUser, rhnServerGroup,
rhnActivationKey
from spacewalk.server.xmlrpc import registration
-def init_db(username, password, dbhost):
- db = "%s/%s@%s" % (username, password, dbhost)
- rhnSQL.initDB(db)
-
def create_channel_family():
cf = rhnChannel.ChannelFamily()
cf.load_from_dict(new_channel_family_dict())
diff --git a/client/tools/osad/Makefile.defs b/client/tools/osad/Makefile.defs
index 31b7a2a..80266ac 100644
--- a/client/tools/osad/Makefile.defs
+++ b/client/tools/osad/Makefile.defs
@@ -79,7 +79,7 @@ pychecker :: $(PYFILES)
$(descend-subdirs)
db-checker :: $(PYFILES)
- @PYTHONPATH=$(PYTHONPATH) $(TOP)/$(DBCHECKER) $(DBCHECKEROPTS) --db $(DB) $(PYFILES) ||
:
+ @PYTHONPATH=$(PYTHONPATH) $(TOP)/$(DBCHECKER) $(DBCHECKEROPTS) $(PYFILES) || :
$(descend-subdirs)
graphviz ::
diff --git a/client/tools/spacewalk-koan/Makefile.defs
b/client/tools/spacewalk-koan/Makefile.defs
index 7924c15..95419b4 100644
--- a/client/tools/spacewalk-koan/Makefile.defs
+++ b/client/tools/spacewalk-koan/Makefile.defs
@@ -85,7 +85,7 @@ pychecker :: $(PYFILES)
$(descend-subdirs)
db-checker :: $(PYFILES)
- @PYTHONPATH=$(PYTHONPATH) $(TOP)/$(DBCHECKER) $(DBCHECKEROPTS) --db $(DB) $(PYFILES) ||
:
+ @PYTHONPATH=$(PYTHONPATH) $(TOP)/$(DBCHECKER) $(DBCHECKEROPTS) $(PYFILES) || :
$(descend-subdirs)
graphviz ::
diff --git a/proxy/proxy/Makefile.defs b/proxy/proxy/Makefile.defs
index 5935079..11204cc 100644
--- a/proxy/proxy/Makefile.defs
+++ b/proxy/proxy/Makefile.defs
@@ -77,7 +77,7 @@ pychecker :: $(PYFILES)
$(descend-subdirs)
db-checker :: $(PYFILES)
- @PYTHONPATH=$(PYTHONPATH) $(TOP)/$(DBCHECKER) $(DBCHECKEROPTS) --db $(DB) $(PYFILES) ||
:
+ @PYTHONPATH=$(PYTHONPATH) $(TOP)/$(DBCHECKER) $(DBCHECKEROPTS) $(PYFILES) || :
$(descend-subdirs)
graphviz ::
diff --git a/reporting/spacewalk-report b/reporting/spacewalk-report
index 08b5348..c22bbc9 100755
--- a/reporting/spacewalk-report
+++ b/reporting/spacewalk-report
@@ -38,7 +38,6 @@ import reports
try:
from spacewalk.server import rhnSQL
- from spacewalk.common.rhnConfig import initCFG, RHNOptions
except KeyboardInterrupt:
systemExit(-1, "\nUser interrupted process.")
@@ -52,9 +51,6 @@ def processCommandline():
default=';',
help='if there are multiple values for certain field, separate them with this
string' \
' (unless --multival-on-rows)'),
- Option('--db', action='store', type="string",
- help='alternative database string (username/password@sid);' \
- + ' default is default_db from /etc/rhn/rhn.conf'),
Option('--info', action='store_true',
help='print synopsis of the report in the list of report, or description of
individual reports specified'),
Option('--list-fields', action='store_true',
@@ -173,8 +169,7 @@ if __name__ == '__main__':
else:
the_sql_where.append('%s in ( %s )' % (k, val))
- initCFG('server')
- rhnSQL.initDB(options.db)
+ rhnSQL.initDB()
writer = csv.writer(sys.stdout, lineterminator = "\n")
diff --git a/reporting/spacewalk-report.sgml b/reporting/spacewalk-report.sgml
index d9be02b..7244efa 100644
--- a/reporting/spacewalk-report.sgml
+++ b/reporting/spacewalk-report.sgml
@@ -17,7 +17,6 @@ Generate reports from Spacewalk server in csv format
<Synopsis>
<cmdsynopsis>
<command>spacewalk-report</command>
-
<arg>--db=<replaceable>connect_string</replaceable></arg>
<arg>--info</arg>
</cmdsynopsis>
<cmdsynopsis>
@@ -28,8 +27,6 @@ Generate reports from Spacewalk server in csv format
<arg>--multival-separator=<replaceable>separator-string</replaceable></arg>
</group>
<sbr>
-
<arg>--db=<replaceable>connect-string</replaceable></arg>
- <sbr>
<arg>--info</arg>
<sbr>
<group><arg>--list-fields</arg><arg>--list-fields-info</arg></group>
@@ -86,20 +83,6 @@ Generate reports from Spacewalk server in csv format
</listitem>
</varlistentry>
<varlistentry>
-
<term>--db=<replaceable>connect-string</replaceable></term>
- <listitem>
- <para>Database connect string in the form of
- <replaceable>username/password@dbname</replaceable> can be
- specified to generated report from user-defined database.
- By default, connect string from default_db option from
- /etc/rhn/rhn.conf is used.</para>
- <para>This option should be considered obsoleted and may
- not be available in next versions of
- <command>spacewalk-report</command>.
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
<term>--list-fields</term>
<listitem>
<para>Instead of running the report, shows fields that the
diff --git a/spacewalk/certs-tools/Makefile.defs b/spacewalk/certs-tools/Makefile.defs
index 87f3f13..1a7d37f 100644
--- a/spacewalk/certs-tools/Makefile.defs
+++ b/spacewalk/certs-tools/Makefile.defs
@@ -92,7 +92,7 @@ pychecker :: $(PYFILES)
$(descend-subdirs)
db-checker :: $(PYFILES)
- @PYTHONPATH=$(PYTHONPATH) $(TOP)/$(DBCHECKER) $(DBCHECKEROPTS) --db $(DB) $(PYFILES) ||
:
+ @PYTHONPATH=$(PYTHONPATH) $(TOP)/$(DBCHECKER) $(DBCHECKEROPTS) $(PYFILES) || :
$(descend-subdirs)
graphviz ::
diff --git a/spacewalk/config/satellite-rules.conf
b/spacewalk/config/satellite-rules.conf
index dea21ff..9f433ad 100644
--- a/spacewalk/config/satellite-rules.conf
+++ b/spacewalk/config/satellite-rules.conf
@@ -56,9 +56,6 @@ serverDOTsatelliteDOThttp_proxy_password=
# line 9
serverDOTsatelliteDOTca_chain[prompt]=Enter a value for serverDOTsatelliteDOTca_chain
serverDOTsatelliteDOTca_chain=
-# line 11
-default_db[prompt]=Enter a value for default_db
-default_db=
# line 17
session_swap_secret_1[prompt]=Enter a value for session_swap_secret_1
session_swap_secret_1=
diff --git a/utils/Makefile.defs b/utils/Makefile.defs
index 9f8ee98..c07e305 100644
--- a/utils/Makefile.defs
+++ b/utils/Makefile.defs
@@ -78,7 +78,7 @@ pychecker :: $(PYFILES)
$(descend-subdirs)
db-checker :: $(PYFILES)
- @PYTHONPATH=$(PYTHONPATH) $(TOP)/$(DBCHECKER) $(DBCHECKEROPTS) --db $(DB) $(PYFILES) ||
:
+ @PYTHONPATH=$(PYTHONPATH) $(TOP)/$(DBCHECKER) $(DBCHECKEROPTS) $(PYFILES) || :
$(descend-subdirs)
graphviz ::
diff --git a/utils/cloneByDate.py b/utils/cloneByDate.py
index 807a17c..3116685 100644
--- a/utils/cloneByDate.py
+++ b/utils/cloneByDate.py
@@ -707,8 +707,7 @@ class DBApi:
def __init__(self):
initCFG('server')
- db_string = CFG.DEFAULT_DB #"rhnsat/rhnsat@rhnsat"
- rhnSQL.initDB(db_string)
+ rhnSQL.initDB()
@staticmethod
def applicable_errata(from_label, to_label):
diff --git a/web/conf/rhn_web.conf b/web/conf/rhn_web.conf
index 1828da4..62552ac 100644
--- a/web/conf/rhn_web.conf
+++ b/web/conf/rhn_web.conf
@@ -177,9 +177,6 @@ web.account_deletion_address =
# default DSN in /etc/pxtdb.conf to connect to for PXT itself
web.pxt_database_dsn =
-# default_db setting from python land, form of user/pass@tnsname
-web.default_db =
-
# More modern db connection param defaults:
web.db_backend =
web.db_host =