def _parse_optional(self, arg_string): def usedTooNew(action): return action.introduced and action.introduced > self.version def usedRemoved(action): return action.removed and action.removed <= self.version option_tuple = ArgumentParser._parse_optional(self, arg_string) if option_tuple is None or option_tuple[0] is None: return option_tuple action = option_tuple[0] if usedTooNew(action): mapping = {"option": action.option_strings[0], "intro": versionToString(action.introduced), "version": versionToString(self.version)} self.error(_("The %(option)s option was introduced in version %(intro)s, but you are using kickstart syntax version %(version)s.") % mapping) elif usedRemoved(action): mapping = {"option": action.option_strings[0], "removed": versionToString(action.removed), "version": versionToString(self.version)} if action.removed == self.version: self.error(_("The %(option)s option is no longer supported.") % mapping) else: self.error(_("The %(option)s option was removed in version %(removed)s, but you are using kickstart syntax version %(version)s.") % mapping) elif action.deprecated == True or (self.version and self.version >= action.deprecated): mapping = {"lineno": self.lineno, "option": action.option_strings[0]} warnings.warn(_("Ignoring deprecated option on line %(lineno)s: The %(option)s option has been deprecated and no longer has any effect. It may be removed from future releases, which will result in a fatal error from kickstart. Please modify your kickstart file to remove this option.") % mapping, DeprecationWarning) return option_tuple
def _parse_optional(self, arg_string): option_tuple = ArgumentParser._parse_optional(self, arg_string) if option_tuple is None or option_tuple[0] is None: return option_tuple action = option_tuple[0] option = action.option_strings[0] if action.deprecated: warnings.warn(_("Ignoring deprecated option on line %(lineno)s: The %(option)s option " "has been deprecated and no longer has any effect. It may be removed " "from future releases, which will result in a fatal error from " "kickstart. Please modify your kickstart file to remove this option.") % {"lineno": self.lineno, "option": option}, KickstartDeprecationWarning) return option_tuple
def _parse_optional(self, arg_string): option_tuple = ArgumentParser._parse_optional(self, arg_string) if option_tuple is None or option_tuple[0] is None: return option_tuple action = option_tuple[0] option = action.option_strings[0] if action.deprecated: warnings.warn( _("Ignoring deprecated option on line %(lineno)s: The %(option)s option " "has been deprecated and no longer has any effect. It may be removed " "from future releases, which will result in a fatal error from " "kickstart. Please modify your kickstart file to remove this option." ) % { "lineno": self.lineno, "option": option }, KickstartDeprecationWarning) return option_tuple