backend/Makefile.backend | 2 -
backend/satellite_tools/reposync.py | 43 +++++++++++++++++++-----------------
backend/spacewalk-backend.spec | 1
3 files changed, 25 insertions(+), 21 deletions(-)
New commits:
commit c4f32e97c88e5d175f365ed65d24b76391d669a2
Author: Justin Sherrill <jsherril(a)redhat.com>
Date: Mon Aug 3 12:54:57 2009 -0400
fixing small method call in reposync
diff --git a/backend/satellite_tools/reposync.py b/backend/satellite_tools/reposync.py
index 97ec97e..37d01bb 100644
--- a/backend/satellite_tools/reposync.py
+++ b/backend/satellite_tools/reposync.py
@@ -56,7 +56,7 @@ class RepoSync:
self.error_msg("--url must be specified")
if not options.type:
quit = True
- self.error_message("--type must be specified")
+ self.error_msg("--type must be specified")
if not options.channel_label:
quit = True
self.error_msg("--channel must be specified")
commit 10c32328e6ac2f63b93f5e815179a57a10439be4
Author: Justin Sherrill <jsherril(a)redhat.com>
Date: Mon Aug 3 12:49:11 2009 -0400
fixing specfile to create directory for reposync
diff --git a/backend/Makefile.backend b/backend/Makefile.backend
index 73ca5c7..378723e 100644
--- a/backend/Makefile.backend
+++ b/backend/Makefile.backend
@@ -7,7 +7,7 @@ CONF_DIRS = apache-conf httpd-conf rhn-conf logrotate
# We look for config files in "well known" locations (rhn-conf,
# httpd-conf, logrotate)
-EXTRA_DIRS = /var/log/rhn /var/cache/rhn
+EXTRA_DIRS = /var/log/rhn /var/log/rhn/reposync /var/cache/rhn
all :: all-code all-conf
commit b2066fa2460ae2ec32a8a24958e155ce8420d4e0
Author: Justin Sherrill <jsherril(a)redhat.com>
Date: Mon Aug 3 12:43:11 2009 -0400
fixing small whitespace error with reposync
diff --git a/backend/satellite_tools/reposync.py b/backend/satellite_tools/reposync.py
index 6d03b60..97ec97e 100644
--- a/backend/satellite_tools/reposync.py
+++ b/backend/satellite_tools/reposync.py
@@ -76,8 +76,7 @@ class RepoSync:
self.repo_label = options.label
self.channel = self.load_channel()
- if not self.channel or not \
- rhnChannel.isCustomChannel(self.channel['id']):
+ if not self.channel or not
rhnChannel.isCustomChannel(self.channel['id']):
print "Channel does not exist or is not custom"
sys.exit(1)
commit c03775d9bcb4e6387e6f04e1398c05f0128252c9
Author: Justin Sherrill <jsherril(a)redhat.com>
Date: Mon Aug 3 12:41:00 2009 -0400
adding better logging for spacewalk-repo-sync
diff --git a/backend/satellite_tools/reposync.py b/backend/satellite_tools/reposync.py
index 9418a78..6d03b60 100644
--- a/backend/satellite_tools/reposync.py
+++ b/backend/satellite_tools/reposync.py
@@ -13,7 +13,7 @@
# granted to use or replicate Red Hat trademarks that are incorporated
# in this software or its documentation.
#
-import sys, os
+import sys, os, time
from optparse import OptionParser
from common import rhnLib
from server import rhnPackage, rhnSQL, rhnChannel, rhnPackageUpload
@@ -23,6 +23,9 @@ from server.importlib.importLib import IncompletePackage
from server.importlib.backendOracle import OracleBackend
from server.importlib.packageImport import ChannelPackageSubscription
+
+default_log_location = '/var/log/rhn/reposync/'
+
class RepoSync:
parser = None
type = None
@@ -39,30 +42,32 @@ class RepoSync:
rhnSQL.initDB(db_string)
(options, args) = self.process_args()
+ log_filename = 'reposync.log'
+ if options.channel_label and options.label:
+ date = time.localtime()
+ datestr = '%s.%s.%s-%s:%s:%s' % (date.tm_year, date.tm_mon,
date.tm_mday, date.tm_hour, date.tm_min, date.tm_sec)
+ log_filename = options.channel_label + '-' + options.label +
'-' + datestr + '.log'
+
+ rhnLog.initLOG(default_log_location + log_filename)
quit = False
if not options.url:
quit = True
- print("--url must be specified")
+ self.error_msg("--url must be specified")
if not options.type:
quit = True
- print("--type must be specified")
+ self.error_message("--type must be specified")
if not options.channel_label:
quit = True
- print("--channel must be specified")
+ self.error_msg("--channel must be specified")
if not options.label:
quit = True
- print("--label must be specified")
-
- self.log_file = options.logfile
- if self.log_file:
- rhnLog.initLOG(self.log_file)
-
- self.error_msg(str(sys.argv))
+ self.error_msg("--label must be specified")
if quit:
sys.exit(1)
+ self.log_msg(str(sys.argv))
self.type = options.type
self.url = options.url
@@ -70,9 +75,8 @@ class RepoSync:
self.fail = options.fail
self.repo_label = options.label
self.channel = self.load_channel()
- self.log_file = options.logfile
- if not self.channel or not \
+ if not self.channel or not \
rhnChannel.isCustomChannel(self.channel['id']):
print "Channel does not exist or is not custom"
sys.exit(1)
@@ -89,7 +93,6 @@ class RepoSync:
self.parser.add_option('-t', '--type', action='store',
dest='type', help='The type of repo, currently only "yum" is
supported')
self.parser.add_option('-l', '--label', action='store',
dest='label', help='A friendly label to refer to the repo')
self.parser.add_option('-f', '--fail',
action='store_true', dest='fail', default=False , help="If a package
import fails, fail the entire operation")
- self.parser.add_option('-g', '--logfile', action='store',
dest='logfile', help="The log file to log to. Default is to stderr and
stdout.")
return self.parser.parse_args()
def load_plugin(self):
@@ -101,7 +104,7 @@ class RepoSync:
def import_packages(self, packages):
to_link = []
to_download = []
- self.print_msg("Repo " + self.url + " has " +
str(len(packages)) + ".")
+ self.print_msg("Repo " + self.url + " has " +
str(len(packages)) + " packages.")
for pack in packages:
pid = None
if pack.checksums.has_key('md5sum'):
@@ -202,16 +205,17 @@ class RepoSync:
def print_msg(self, message):
- if self.log_file:
- rhnLog.log_clean(0, message)
+ rhnLog.log_clean(0, message)
print message
def error_msg(self, message):
- if self.log_file:
- rhnLog.log_clean(0, message)
+ rhnLog.log_clean(0, message)
sys.stderr.write(message)
+ def log_msg(self, message):
+ rhnLog.log_clean(0, message)
+
class ContentPackage:
#map of checksums. Valid keys are 'md5sum' & 'sha256'
diff --git a/backend/spacewalk-backend.spec b/backend/spacewalk-backend.spec
index 1fe9866..d9d77c6 100644
--- a/backend/spacewalk-backend.spec
+++ b/backend/spacewalk-backend.spec
@@ -538,6 +538,7 @@ rm -f %{rhnconf}/rhnSecret.py*
%{rhnroot}/satellite_tools/disk_dumper/dumper.py*
%{rhnroot}/satellite_tools/disk_dumper/string_buffer.py*
%dir %{rhnroot}/satellite_tools/repo_plugins
+%attr(770,root,apache) %dir %{_var}/log/rhn/reposync
%{rhnroot}/satellite_tools/repo_plugins/__init__.py*
%{rhnroot}/satellite_tools/repo_plugins/yum_src.py*
%config %attr(644,root,apache) %{rhnconf}/default/rhn_server_iss.conf