Yedidyah Bar David has posted comments on this change. Change subject: WIP: packaging: setup: host rename ......................................................................
Patch Set 11: (27 inline comments) Fixed most comments, but not all. .................................................... Commit Message Line 3: AuthorDate: 2013-07-28 16:04:03 +0300 Line 4: Commit: Yedidyah Bar David <[email protected]> Line 5: CommitDate: 2013-08-01 09:07:25 +0300 Line 6: Line 7: WIP: packaging: setup: host rename Done Line 8: Line 9: Change-Id: I28cb0285424236fd3e6907694f6bf1ce6ce3367f .................................................... File packaging/bin/pki-pkcs12-nopasskey.sh Line 1: #!/bin/sh Moved to http://gerrit.ovirt.org/17562 Line 2: Line 3: extractkey() { Line 4: local name="$1" Line 5: local pass="$2" .................................................... File packaging/setup/bin/ovirt-engine-rename Line 31: Load configuration files. Line 32: --config-append=file Line 33: Load extra configuration files. Line 34: --generate-answer=file Line 35: Generate answer file. Will look at this later Line 36: Line 37: __EOF__ Line 38: exit 1 Line 39: } .................................................... File packaging/setup/ovirt_engine_setup/constants.py Line 975: summary=True, Line 976: description=_('New FQDN'), Line 977: ) Line 978: def FQDN(self): Line 979: return 'OSETUP_RENAME/fqdn' It did not complain, not sure why. Added. Line 980: CONFIRM_FORCE_OVERWRITE = 'OSETUP_RENAME/confirmForceOverwrite' Line 981: Line 982: Line 983: @util.export .................................................... File packaging/setup/plugins/ovirt-engine-common/core/misc.py Line 48: ], Line 49: ) Line 50: def _preinit(self): Line 51: self.environment.setdefault( Line 52: otopicons.CoreEnv.LOG_DIR, Reverted anyway. Line 53: osetupcons.FileLocations.OVIRT_SETUP_LOGDIR Line 54: ) Line 55: self.environment.setdefault( Line 56: otopicons.CoreEnv.CONFIG_FILE_NAME, .................................................... File packaging/setup/plugins/ovirt-engine-rename/core/database.py Line 44: @plugin.event( Line 45: stage=plugin.Stages.STAGE_MISC, Line 46: after=[ Line 47: osetupcons.Stages.DB_CONNECTION_AVAILABLE, Line 48: ], Done Line 49: ) Line 50: def _misc(self): Line 51: option = 'RedirectServletReportsPage' Line 52: try: Line 55: except RuntimeError: Line 56: self.logger.debug("Option {option} not found in db".format( Line 57: option=option Line 58: ) Line 59: return What instead? Use flag variables? Line 60: Line 61: pattern=r""" Line 62: (?P<proto>[a-z]+) Line 63: :// Line 57: option=option Line 58: ) Line 59: return Line 60: Line 61: pattern=r""" I didn't know about urlparse. Thanks. Not sure it's that much nicer. Why do they insist on the hostname:port to be a single item? Line 62: (?P<proto>[a-z]+) Line 63: :// Line 64: (?P<host>[a-zA-Z0-9.-]+) Line 65: : Line 78: newfqdn = self.environment[osetupcons.RenameEnv.FQDN] Line 79: replacement_pattern = '\g<proto>://' + newfqdn + ':\g<port>/\g<appname>' Line 80: newvalue = match.expand(replacement_pattern) Line 81: self.environment[osetupcons.DBEnv.STATEMENT].updateVdcOptions( Line 82: options=[ Done Line 83: { Line 84: 'name': option, Line 85: 'value': newvalue, Line 86: }, .................................................... File packaging/setup/plugins/ovirt-engine-rename/core/engine.py Line 53: ) Line 54: self.services.startup( Line 55: name=osetupcons.Const.ENGINE_SERVICE_NAME, Line 56: state=True, Line 57: ) I guess you meant "state" and not "startup". Done. Line 58: Line 59: .................................................... File packaging/setup/plugins/ovirt-engine-rename/core/pki.py Line 67: osetupcons.Defaults.DEFAULT_PKI_COUNTRY Line 68: ) Line 69: self.environment.setdefault( Line 70: osetupcons.PKIEnv.ORG, Line 71: None I decided, everywhere, to not parse and edit existing files, but instead recreate them, using (basically) the same code in setup. I also alert if the files were externally changed. I think it's cleaner, safer, and provides a more direct path at merging the setup and rename code in the future. Line 72: ) Line 73: Line 74: @plugin.event( Line 75: stage=plugin.Stages.STAGE_SETUP, Line 126: ).format( Line 127: aia=authorityInfoAccess, Line 128: ), Line 129: ) Line 130: if not dialog.queryBoolean( Will look at this later Line 131: dialog=self.dialog, Line 132: name='OVESETUP_RENAME_AIA_BYPASS', Line 133: note=_('Do you want to continue? (@VALUES@) [@DEFAULT@]: '), Line 134: prompt=True, Line 166: osetupcons.FileLocations.OVIRT_ENGINE_PKI_APACHE_KEY, Line 167: osetupcons.FileLocations.OVIRT_ENGINE_PKI_APACHE_CERT, Line 168: osetupcons.FileLocations.OVIRT_ENGINE_PKI_CERT_TEMPLATE[ Line 169: :-len('.in')], Line 170: osetupcons.FileLocations.OVIRT_ENGINE_PKI_CERT_CONF Not really, there are a few bugs here, changed. Thanks. Line 171: ) Line 172: ) Line 173: Line 174: localtransaction = transaction.Transaction() Line 243: os.chown( Line 244: f['name'], Line 245: osetuputil.getUid(f['owner']), Line 246: -1 Line 247: ) OK, I remove here. Line 248: Line 249: @plugin.event( Line 250: stage=plugin.Stages.STAGE_CLOSEUP, Line 251: before=[ Line 254: after=[ Line 255: osetupcons.Stages.DIALOG_TITLES_S_SUMMARY, Line 256: ], Line 257: ) Line 258: def _closeup(self): Done Line 259: rc, stdout, stderr = self.execute( Line 260: ( Line 261: self.command.get('openssl'), Line 262: 'x509', .................................................... File packaging/setup/plugins/ovirt-engine-rename/core/postinstall.py Line 38: Line 39: Line 40: @util.export Line 41: class Plugin(plugin.PluginBase): Line 42: """post install config file plugin.""" I'll look at this Line 43: Line 44: def __init__(self, context): Line 45: super(Plugin, self).__init__(context=context) Line 46: Line 50: def _setup(self): Line 51: self.environment[ Line 52: osetupcons.CoreEnv.FILES_TO_BE_MODIFIED Line 53: ].append(osetupcons.FileLocations. Line 54: OVIRT_SETUP_POST_INSTALL_CONFIG) Sorry, fixed. Line 55: Line 56: @plugin.event( Line 57: stage=plugin.Stages.STAGE_MISC, Line 58: priority=plugin.Stages.PRIORITY_LAST, Line 64: ) Line 65: ) Line 66: self.environment[osetupcons.ConfigEnv.FQDN] = self.environment[ Line 67: osetupcons.RenameEnv.FQDN Line 68: ] OK, moved Line 69: content = ['[environment:default]'] Line 70: for c in osetupcons.__dict__['__osetup_attrs__']: Line 71: for k in c.__dict__.values(): Line 72: if hasattr(k, '__osetup_attrs__'): Line 89: modifiedList=self.environment[ Line 90: otopicons.CoreEnv.MODIFIED_FILES Line 91: ], Line 92: ) Line 93: ) Replied in another comment. Decided to not edit files. Line 94: Line 95: .................................................... File packaging/setup/plugins/ovirt-engine-rename/core/protocols.py Line 79: ) Line 80: self.environment.setdefault( Line 81: osetupcons.ConfigEnv.JBOSS_DIRECT_HTTPS_PORT, Line 82: None Line 83: ) Perhaps, but I did only the minimum changes - see code comment in the beginning Line 84: Line 85: @plugin.event( Line 86: stage=plugin.Stages.STAGE_SETUP, Line 87: ) Line 135: ) Line 136: def _misc(self): Line 137: def flag(o): Line 138: return 'true' if o else 'false' Line 139: content = ( same Line 140: 'ENGINE_FQDN={fqdn}\n' Line 141: 'ENGINE_PROXY_ENABLED={proxyFlag}\n' Line 142: 'ENGINE_PROXY_HTTP_PORT={proxyHttpPort}\n' Line 143: 'ENGINE_PROXY_HTTPS_PORT={proxyHttpsPort}\n' Line 214: self.dialog.note( Line 215: text=_( Line 216: 'Web access is enabled at:\n' Line 217: ' http://{fqdn}:{httpPort}{engineURI}\n' Line 218: ' https://{fqdn}:{httpsPort}{engineURI}\n' The fqdn has changed :-) Line 219: ).format( Line 220: fqdn=self.environment[osetupcons.RenameEnv.FQDN], Line 221: httpPort=self.environment[ Line 222: osetupcons.ConfigEnv.PUBLIC_HTTP_PORT Line 227: engineURI=engineURI, Line 228: ) Line 229: ) Line 230: Line 231: if self.environment[osetupcons.CoreEnv.DEVELOPER_MODE]: same... minimal changes Line 232: self.dialog.note( Line 233: text=_( Line 234: 'JBoss is listening for debug connection at: {address}' Line 235: ).format( .................................................... File packaging/setup/plugins/ovirt-engine-rename/core/uninstall.py Line 104: ) Line 105: Line 106: all_modified_files = self.environment[ Line 107: osetupcons.CoreEnv.FILES_TO_BE_MODIFIED Line 108: ] sorry Line 109: Line 110: externally_modified_files = [] Line 111: Line 112: for f in all_modified_files: Line 112: for f in all_modified_files: Line 113: if ( Line 114: f in self._existing_conf_files and Line 115: self._digestFile(f) != self._existing_conf_files[f] Line 116: ): sorry. My .vimrc is not conifgured well, I have to fix this all the time. Line 117: externally_modified_files.append(f) Line 118: Line 119: self.logger.info(_('The following files will be updated:')) Line 120: for f in sorted(all_modified_files): Line 122: Line 123: if (externally_modified_files and Line 124: self.environment[ Line 125: osetupcons.RenameEnv.CONFIRM_FORCE_OVERWRITE] Line 126: ): Done Line 127: self.logger.warn( Line 128: _( Line 129: 'The following files were externally modified - outside ' Line 130: 'of package management and/or engine-setup - perhaps by ' Line 133: ) Line 134: for f in sorted(externally_modified_files): Line 135: self.dialog.note(text=f) Line 136: Line 137: if not dialog.queryBoolean( I'll look at this Line 138: dialog=self.dialog, Line 139: name='FORCE_OVERWRITE_FILES', Line 140: note=_( Line 141: 'Do you want to overwrite all of the above files ' -- To view, visit http://gerrit.ovirt.org/17408 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I28cb0285424236fd3e6907694f6bf1ce6ce3367f Gerrit-PatchSet: 11 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Yedidyah Bar David <[email protected]> Gerrit-Reviewer: Alex Lourie <[email protected]> Gerrit-Reviewer: Alon Bar-Lev <[email protected]> Gerrit-Reviewer: Moran Goldboim <[email protected]> Gerrit-Reviewer: Ofer Schreiber <[email protected]> Gerrit-Reviewer: Sandro Bonazzola <[email protected]> Gerrit-Reviewer: Yedidyah Bar David <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
