schema/spacewalk/spacewalk-sql | 2 -
scripts/schema-updater | 66 -----------------------------------------
2 files changed, 1 insertion(+), 67 deletions(-)
New commits:
commit 4d3f22263a83a8fa7d95b6cdc00baaa77a03098b
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Thu Feb 28 12:06:05 2013 +0100
Quote the password we pass to sqlplus so that special characters can be used.
diff --git a/schema/spacewalk/spacewalk-sql b/schema/spacewalk/spacewalk-sql
index 215b3da..4830f33 100755
--- a/schema/spacewalk/spacewalk-sql
+++ b/schema/spacewalk/spacewalk-sql
@@ -58,7 +58,7 @@ chdir '/';
my ($pid, $wfh, $rfh);
if ($options{db_backend} eq 'oracle') {
- my @command = ( 'sqlplus', '-S',
"$options{db_user}/$options{db_password}\@$options{db_name}");
+ my @command = ( 'sqlplus', '-S',
qq!$options{db_user}/"$options{db_password}"\@$options{db_name}!);
if ($verbose) {
print STDERR "Running: @command\n";
}
commit e1f7ac2314560b37cc9c1ddc7a2236ef289604c3
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Thu Feb 28 12:03:38 2013 +0100
The schema-updater has been obsoleted by spacewalk-schema-upgrade.
diff --git a/scripts/schema-updater b/scripts/schema-updater
deleted file mode 100755
index 4a8606e..0000000
--- a/scripts/schema-updater
+++ /dev/null
@@ -1,66 +0,0 @@
-#!/usr/bin/python
-import os, os.path
-import sys
-import optparse
-import re
-import subprocess
-import cx_Oracle
-import re
-
-_query = """select default_tablespace from user_users
- where username = sys_context('userenv',
'session_user')"""
-def get_table_space(options):
- con = cx_Oracle.Connection(options.connect)
- cursor = con.cursor()
- cursor.execute(_query)
- ret = cursor.fetchall()[0][0]
- cursor.close()
- con.close()
- return ret
-
-def execute(command, shell=False, ignore_rc=False):
- if subprocess.call(command, shell = shell) != 0:
- if not ignore_rc:
- sys.stderr.write("\n -- ERROR: command '%s' failed. Setup
aborted.\n" % command)
- sys.exit(1);
-
-def setup(parser):
- default = "spacewalk/spacewalk@xe"
- parser.add_option("-c", "--connect", dest="connect",
- default=default,
- help="Database connect string - default '%s'" %
default)
- default = "."
- parser.add_option("-d","--dir", dest="scripts_dir",
- default=default,
- help="Sql Scripts directory - default
'%s'" % default)
- parser.add_option("-s", "--start", dest="start",
default = -sys.maxint, type="int",
- help="Enter the number of the first script to run." )
-
- parser.add_option("-e", "--end", dest="end", default =
sys.maxint, type="int",
- help="Enter the number of the last script to run." )
-
-def in_range(name, start, end):
- return start <= int(name[:name.find("-")]) <= end
-
-def main():
- parser = optparse.OptionParser()
- setup(parser)
- (options, args) = parser.parse_args()
- lines=[]
- p = re.compile(r"^\s*commit\b", re.IGNORECASE)
- files = sorted([os.path.join(options.scripts_dir, f) for f in
os.listdir(options.scripts_dir) if f[-4:]==".sql" and in_range(f,
options.start, options.end)])
- print files
- for f in files:
- lines.extend([line.strip() for line in open(f).readlines() if not
p.match(line)])
- if lines:
- x = re.compile(r"tablespace\s+([\[\]\w]+)")
- table_space = get_table_space(options)
- lines = [x.sub("tablespace " + table_space, line) for line in lines]
- lines.append("commit;")
- f = "/tmp/__lines.sql"
- open(f,"w").write("\n".join(lines))
- execute ("sqlplus -S %s < %s" % (options.connect, f), shell=True)
- print "Schema updated"
-
-if __name__=="__main__":
- main()