Alon Bar-Lev has posted comments on this change.
Change subject: core: Remove Windows ProductKey* from db
......................................................................
Patch Set 5:
(6 comments)
*NICE* for first plugin!
some comments.
....................................................
File packaging/setup/plugins/ovirt-engine-setup/config/__init__.py
Line 34: from . import tools
Line 35: from . import iso_domain
Line 36: from . import macrange
Line 37: from . import websocket_proxy
Line 38: from . import productkey
can you please rename to productkey_upgrade so we know to remove in future?
Line 39:
Line 40:
Line 41: @util.export
Line 42: def createPlugins(context):
....................................................
File packaging/setup/plugins/ovirt-engine-setup/config/productkey.py
Line 45: osetupcons.Stages.DB_CONNECTION_AVAILABLE,
Line 46: ),
Line 47: )
Line 48: def _misc(self):
Line 49: f = osetupcons.FileLocations.EXTRACTED_PRODUCTKEYS
no need for this f...
Line 50:
Line 51: prefix = 'os.'
Line 52: suffix = '.productKey.value='
Line 53:
Line 61: dbToOsinfo['ProductKeyWindow7'] = prefix + 'windows_7' + suffix
Line 62: dbToOsinfo['ProductKeyWindow7x64'] = prefix + 'windows_7x64' +
suffix
Line 63: dbToOsinfo['ProductKeyWindows8'] = prefix + 'windows_8' +
suffix
Line 64: dbToOsinfo['ProductKeyWindows8x64'] = prefix + 'windows_8x64'
+ suffix
Line 65: dbToOsinfo['ProductKeyWindows2012x64'] = prefix +
'windows_2012x64' + suffix
minor... I would have used pre-initialized dict without the prefix and
suffix... and as constant at class level.
DB_TO_OSINFO = {
'ProductKey2003': 'windows_2003',
....
}
then:
Line 66:
Line 67: content = []
Line 68: for key in dbToOsinfo.keys():
Line 69: val =
self.environment[osetupcons.DBEnv.STATEMENT].getVdcOption(key)
Line 67: content = []
Line 68: for key in dbToOsinfo.keys():
Line 69: val =
self.environment[osetupcons.DBEnv.STATEMENT].getVdcOption(key)
Line 70: if len(val) > 0:
Line 71: content.append(dbToOsinfo[key] + val)
then:
content.append('os.%s.productKey.value=%s' % (self.DB_TO_OSINFO[key], val)
Line 72:
Line 73: if not os.path.exists(f) and len(content) > 0:
Line 74:
self.environment[otopicons.CoreEnv.MAIN_TRANSACTION].append(
Line 75: filetransaction.FileTransaction(
Line 69: val =
self.environment[osetupcons.DBEnv.STATEMENT].getVdcOption(key)
Line 70: if len(val) > 0:
Line 71: content.append(dbToOsinfo[key] + val)
Line 72:
Line 73: if not os.path.exists(f) and len(content) > 0:
move exists condition up, so we do not do anything if file exist.
Line 74:
self.environment[otopicons.CoreEnv.MAIN_TRANSACTION].append(
Line 75: filetransaction.FileTransaction(
Line 76: name=f,
Line 77: content=content,
Line 72:
Line 73: if not os.path.exists(f) and len(content) > 0:
Line 74:
self.environment[otopicons.CoreEnv.MAIN_TRANSACTION].append(
Line 75: filetransaction.FileTransaction(
Line 76: name=f,
name=osetupcons.FileLocations.EXTRACTED_PRODUCTKEYS
Line 77: content=content,
Line 78: modifiedList=self.environment[
Line 79: otopicons.CoreEnv.MODIFIED_FILES
Line 80: ],
--
To view, visit http://gerrit.ovirt.org/19743
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I876894e7ba5fcd28ee0d435b4a2561f662140174
Gerrit-PatchSet: 5
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Frank Kobzik <[email protected]>
Gerrit-Reviewer: Alon Bar-Lev <[email protected]>
Gerrit-Reviewer: Eli Mesika <[email protected]>
Gerrit-Reviewer: Frank Kobzik <[email protected]>
Gerrit-Reviewer: Itamar Heim <[email protected]>
Gerrit-Reviewer: Michal Skrivanek <[email protected]>
Gerrit-Reviewer: Omer Frenkel <[email protected]>
Gerrit-Reviewer: Roy Golan <[email protected]>
Gerrit-Reviewer: Sandro Bonazzola <[email protected]>
Gerrit-Reviewer: Yedidyah Bar David <[email protected]>
Gerrit-Reviewer: oVirt Jenkins CI Server
Gerrit-HasComments: Yes
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches