backend/common/TODO | 25 -----
backend/common/rhnConfig.py | 180 ------------------------------------------
backend/satellite_tools/TODO | 9 --
backend/server/TODO | 35 --------
backend/server/importlib/TODO | 3
backend/server/rhnServer/TODO | 15 ---
6 files changed, 267 deletions(-)
New commits:
commit a26f73cca9f8965b368e06eba6582e1dcf2057d8
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Fri Mar 1 09:53:33 2013 +0100
Removing writeConfig and dependencies, we do not use it anywhere in our code.
diff --git a/backend/common/rhnConfig.py b/backend/common/rhnConfig.py
index e9bd5a3..f301656 100644
--- a/backend/common/rhnConfig.py
+++ b/backend/common/rhnConfig.py
@@ -43,10 +43,6 @@ class ConfigParserError(Exception):
# TODO: need to be able to specify "" component and parse all files in
# the directory and form a _complete_ mapping structure.
# Or, if that is too difficult, take in a list of components...
-# TODO: add a writeConfig(hash) method that will take some dictionary
-# of config options, compare to the default options and write to
-# /etc/rhn/rhn.conf if those options differ at all.
-# XXX: almost done
class RHNOptions:
""" Main options class
The basic idea is to share the important pieces of information - the
@@ -197,120 +193,6 @@ class RHNOptions:
self.__configs[self.__component][key] = value
__setitem__ = set
- def writeConfig(self, userConfigDict, commentDict=None, stream=None):
- """given dictionaries in these formats:
- config dictionary:
- { component.component.key: value, ...}
- ***OR***
- { (comp0, comp1): {key: value}, ...}
-
- comment dictionary:
- { component.component.key: comment string, ...}
-
- Compare to defaults. If different, write to file, if not,
- leave as is. Comments are written to the file as well.
-
- NOTE: *DESTRUCTIVE* will overwrite file always.
- """
- if stream is None:
- stream = open(self.filename, 'wb')
- if commentDict is None:
- commentDict = {}
- _dict = {}
- # convert to a dict of the sort understood by the object if not
- # already converted
- for k in userConfigDict.keys():
- if type(k) == type(()):
- # already converted!
- _dict = userConfigDict
- break
- if not k:
- continue
- line = "%s = %s" % (k, userConfigDict[k])
- parsed = parse_line(line)
- component = tuple(parsed[0][:-1])
- key = parsed[0][-1]
- value = parsed[1]
- if not _dict.has_key(component):
- _dict[component] = {}
- _dict[component][key] = value
-
- # diff the dictionary in comparison to the defaults
- diffDict = self.diffConfig(_dict)
-
- # return the parsed state back to normal
- self.parse()
-
- ### write the file to stream
- # recombine the parsed lines
- stream.write("# Automatically generated Red Hat Network Satellite/" +
\
- "Proxy Server config file.\n\n")
- for comp, _dict in diffDict.items():
- for k, v in _dict.items():
- line = unparse_line(comp, k, v) + '\n'
- comment = ""
- if comp:
- # just for the comment lookup
- k = '.'.join(comp+(k, ))
- if commentDict.has_key(k):
- comment = '# %s\n' % commentDict[k]
- # write it
- stream.write(comment)
- stream.write(line)
- stream.write('\n')
- stream.close()
- return diffDict
-
- def diffConfig(self, configDict):
- """given configDict in this format:
- { (component0, component1) : {key: value}, ...}
- diff the settings against the defaults and return a dict of those
- that are truly different (removing the ones that == the defaults).
- """
- savedComponent = self.__component
-
- # prep the diff dictionary
- diffDict = {}
- unique = []
- for comp in configDict.keys():
- if comp not in unique:
- unique.append(comp)
- possible = parse_comps('.'.join(comp))
- for c in possible:
- if not diffDict.has_key(c):
- diffDict[c] = {}
-
- # examine all the components and keys
- for comp in unique:
- self.__component = '.'.join(comp)
- self._parseDefaults(allCompsYN=0)
- if self.__defaults.has_key(comp):
- for k in configDict[comp].keys():
- possible = parse_comps('.'.join(comp))
- keyFoundYN = 0
- # is the key at least in the component tree?
- for c in possible:
- if self.__defaults[c].has_key(k):
- keyFoundYN = 1
- if keyFoundYN:
- if not self.__defaults[comp].has_key(k):
- # setting in tree but not set at this level
- diffDict[comp][k] = configDict[comp][k]
- elif configDict[comp][k] != self.__defaults[comp][k]:
- # that setting exists and is different
- diffDict[comp][k] = configDict[comp][k]
- else:
- # doesn't have that key setting or settings are
- # identical.
- continue
- else:
- # component is not one of the defaults.
- continue
-
- # restore the component and return the result
- self.__component = savedComponent
- return diffDict
-
def show(self):
self.__check()
# display the configuration read from the file(s) and exit
@@ -511,31 +393,6 @@ def parse_line(line):
return (keys, vals)
-def unparse_line(component, key, value):
- """ component needs to be in (component1, component2) notation
- key is a string
- value can be a string, None, int or float ...or [value,value]
- ...or (value, linenum)
- return 'comonent1.component2.key = value, value
- """
- varSeparator = '.'
- optSeparator = ','
-
- k = key
- if component:
- k = varSeparator.join(component+(k, ))
- if type(value) == type(()):
- # ignore the line number
- value = value[0]
- v = value
- if type(value) == type([]):
- v = (optSeparator + " ").join(map(str, value))
- if v is None:
- v = ''
- v = str(v)
- return '%s = %s' % (k, v)
-
-
def parse_file(filename, single_key = 0):
"""
parse a config file (read it in, parse its lines)
@@ -694,43 +551,6 @@ def runTest():
print "=============== dump of all relevant dictionaries
================="
test_cfg.showall()
print
"==================================================================="
-# confDict = {
-# 'traceback_mail': 'testing(a)here.com, test2(a)here.com',
-# 'proxy.pkg_dir': '/var/up2date/xxx_packages',
-# 'proxy.redirect.http_proxy': 'someproxy:8080',
-# 'proxy.redirect.http_proxy_username': '',
-# 'proxy.redirect.http_proxy_password': '',
-# 'proxy.package_manager.http_proxy': '',
-# 'proxy.package_manager.http_proxy_username': '',
-# 'proxy.package_manager.http_proxy_password': '',
-# }
-# commentDict = {
-# 'traceback_mail': "Destination of all tracebacks, etc.",
-# 'proxy.pkg_dir': "Location of locally built, custom
packages",
-# 'proxy.redirect.http_proxy': "Corporate gateway http proxy, format:
\
-#corp_gateway.your_company.com:8080",
-# 'proxy.redirect.http_proxy_username': "Username for that corporate
\
-#gateway http proxy",
-# 'proxy.redirect.http_proxy_password': "Password for that corporate
\
-#gateway http proxy",
-# 'proxy.package_manager.http_proxy': "Corp. gateway http proxy -- \
-#should match the setting for proxy.redirect.http_proxy",
-# 'proxy.package_manager.http_proxy_username': "Username for that \
-#corporate gateway http proxy",
-# 'proxy.package_manager.http_proxy_password': "Password for that \
-#corporate gateway http proxy",
-# }
- confDict = {
- 'server.traceback_mail': 'testing(a)here.com, test2(a)here.com',
- 'server.satellite.rhn_parent': 'rhnapp.webdev-colo.redhat.com',
-# 'server.satellite.rhn_parent': 'xmlrpc.rhn.redhat.com',
- }
- commentDict = {
- 'server.traceback_mail': "Destination of all tracebacks,
etc.",
- 'server.satellite.rhn_parent': "RHN 'parent' server of this
satellite",
- 'server.BLAH': "TESTING... SHOULD NEVER WRITE THIS COMMENT!",
- }
- test_cfg.writeConfig(confDict, commentDict, stream=sys.stdout)
#------------------------------------------------------------------------------
commit fe5c47aacaff6f410f5760da6890d18bbddfc904
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Fri Mar 1 09:46:14 2013 +0100
The TODOs are not up-to-date, removing.
diff --git a/backend/common/TODO b/backend/common/TODO
deleted file mode 100644
index ce22e00..0000000
--- a/backend/common/TODO
+++ /dev/null
@@ -1,25 +0,0 @@
-$Id$
-
-Generated with:
-grep "TODO" * | sed -e "s/[ ]*#[ ]*TODO:[ ]*/ /" >> TODO
-grep "FIXME" * | sed -e "s/[ ]*#[ ]*FIXME:[ ]*/ /" >> TODO
-grep "XXX" * | sed -e "s/[ ]*#[a-zA-Z ]*XXX[:]*[ ]*/ /" >>
TODO
-
-rhnCache.py: There can be race conditions between the moment we check for the
-rhnConfig.py: need to be able to specify "" component and parse all files in
-rhnConfig.py: add a writeConfig(hash) method that will take some dictionary
-rhnConfig.py: needs an overhaul. Way way way too complex.
-rhn_rpm.py: replace with macro defination
-rhnApache.py: attempt to catch these KeyErrors sometime when there is
-rhnApache.py: attempt to catch these KeyErrors sometime when there is
-rhnCache.py: poking at gzip.zlib may not be such a good idea
-rhnConfig.py: almost done
-rhnConfig.py: Should we do timestamp checking for this one too?
-rhnConfig.py: we don't really want to force every item in the
-rhnConfig.py: needs more testing!!! (2003-04-17)
-rhnLockfile.py: potential race condition upon create?
-rhnRepository.py: stock 8.0 clients could not compress headers, we need to either
-rhnRepository.py: Interesting. Found that if returned just data, this
-rhnRepository.py: del s not neccessary?
-rhnRepository.py: del h not neccessary?
-rhn_rpm.py: Deal with exceptions better
diff --git a/backend/satellite_tools/TODO b/backend/satellite_tools/TODO
deleted file mode 100644
index 1ec68b7..0000000
--- a/backend/satellite_tools/TODO
+++ /dev/null
@@ -1,9 +0,0 @@
-taw/misa: source package imports/sync
-taw: check the headers to see if the data is gzipped.
- - make sure chip sends the data with the right transfer-encoding
-taw/misa: need deeper diffs (unsure of where to go with this).
- - see bugzilla
-taw/misa: fully document the backend code
- - inheritance tree diagram
- - comment the inherited methods in the child classes.
-taw/misa: code cleanup once ever-thang stabilizes (ie. very soon).
diff --git a/backend/server/TODO b/backend/server/TODO
deleted file mode 100644
index 4dec966..0000000
--- a/backend/server/TODO
+++ /dev/null
@@ -1,35 +0,0 @@
-$Id$
-
-NOTE: very dated!!!!
-
-These are things we need to still work on:
-
-- deal with the OEM entitlement fields in
- registration.register_product()
-
-- send mail on registration to org admins and the user registering the
- machine
-
-- take a deep look at the registration numbers problem (and possibly
- just ignore them altogether until we figure out a proper way to
- register a number)
-
-- create a script to mail out wake-up calls to people for servers
- being inactive
-
-- document the server API
-
-- column based preferences for
- rhnUserPrefs
- rhnServerPrefs
- - migrate rhnServerProperties into rhnServerPrefs
- rhnUserServerPrefs
-
-- fix cgiwrap to easily find the integer corresponding to a string
- representation of tranfers/encodings.
-
-- clean up auth_client/auth_proxy, looks like the declined return code is not
- needed. Maybe the same step as fixing rhnDefines.
-
-- taw: need an rhn.conf.sample file simular to what we have in the proxy.
- - created and started... not nearly finished.
diff --git a/backend/server/importlib/TODO b/backend/server/importlib/TODO
deleted file mode 100644
index b73b2d3..0000000
--- a/backend/server/importlib/TODO
+++ /dev/null
@@ -1,3 +0,0 @@
-- document the code layout
-- identify a better way to organize the code, once we have a different
- database backend
diff --git a/backend/server/rhnServer/TODO b/backend/server/rhnServer/TODO
deleted file mode 100644
index 9571a46..0000000
--- a/backend/server/rhnServer/TODO
+++ /dev/null
@@ -1,15 +0,0 @@
-$Id$
-
-Few things are left to do on this rhnServer conversion:
-
-- move the rpmdata stuff out of the rhnServer classes and into the
- rhnRPM top level module so we have a single place where we deal with
- rpm related stuff (database or not). There is no reason why rhnRPM
- could not behave pretty much the same way rhnChannel behaves
-
-- same thing for package_path stuff, which is again only marginally
- related to the whole server concept. The rhnServer module should
- only be dealing with stuff clearly connected to the server (ie,
- hardware, packages, history, channel subscriptions and so forth). A
- possible problem here is dealing with the PackageNotFoundError
- exception, which is tested for in some places in the code.