Bug 1162881 - ksflatten: error or passthrough when unknown commands are found
Summary: ksflatten: error or passthrough when unknown commands are found
Keywords:
Status: CLOSED EOL
Alias: None
Product: Fedora
Classification: Fedora
Component: pykickstart
Version: 21
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Chris Lumens
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-11-11 22:42 UTC by Matthew Miller
Modified: 2015-12-02 16:31 UTC (History)
3 users (show)

Fixed In Version: pykickstart-1.99.65-1
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-12-02 04:55:48 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Matthew Miller 2014-11-11 22:42:01 UTC
Description of problem:

For $WHATEVERREASON, the version of ksflatten used in Koji is the one on the builder, not in a chroot. This means that spin kickstarts which use new commands don't work. There is output on stderr, but the program returns success.

Returning failure in this case would help catch the problem when it occurs.

However, it seems like it might be nice to also have a "--tolerant" flag which warns but copies unknown commands verbatim.

Comment 1 Chris Lumens 2014-11-24 16:10:59 UTC
I can't really just copy unrecognized commands through, unfortunately.  ksflatten works by reading in the kickstart file and filling up a data object, just like if you were going to install from that kickstart or whatever.  Along the way, %includes are followed and added in to the same data object.  For an unrecognized command, there's no associated piece of data so there's nowhere to put it.  And I can't just make a list of unrecognized things to add on later, because context does matter (for the partitioning commands, at least - more of that may potentially happen later).

So, what other things could I do to take care of this?

Comment 2 Matthew Miller 2014-11-24 20:24:42 UTC
Thanks for the explanation, Chris. Makes what happens make sense.

Can you make the program return failure instead of success? That would make it much easier to catch when it happens rather than relying on a human to notice that the kickstart file seems truncated.

Comment 3 Chris Lumens 2014-11-24 20:30:40 UTC
Yeah, it should have been doing that all along.  I'll make the change right now, though of course to pick it up I'll have to do a new build and you'll have to install the new build, which kind of defeats the original purpose...

But whatever.

Comment 4 Matthew Miller 2014-11-24 20:32:23 UTC
(In reply to Chris Lumens from comment #3)
> But whatever.

Yeah. Eventually it will trickle down and improve things. :) Thanks!

Comment 5 Chris Lumens 2014-11-24 20:35:18 UTC
Here's a patch, unless you'd like specific error codes for specific cases.

From d6c81af33cca3866a841708fc3002819880f7036 Mon Sep 17 00:00:00 2001
From: Chris Lumens <clumens>
Date: Mon, 24 Nov 2014 15:34:30 -0500
Subject: [PATCH] When ksflatten fails, return a failure code (#1162881).

---
 tools/ksflatten | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/tools/ksflatten b/tools/ksflatten
index 46c4d2c..89e7bd3 100755
--- a/tools/ksflatten
+++ b/tools/ksflatten
@@ -5,6 +5,7 @@
 #
 # Copyright 2007-2014, Red Hat, Inc.
 # Jeremy Katz <katzj>
+# Chris Lumens <clumens>
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -57,12 +58,14 @@ def main():
         sys.exit(1)
     except pykickstart.errors.KickstartError as e:
         print(_("Failed to parse kickstart file '%s' : %s") % (opts.kscfg, e), file=sys.stderr)
+        sys.exit(1)
 
     if opts.output:
         try:
             f = open(opts.output, 'w')
         except IOError as msg:
             print(_("Failed to open output file '%s' : %s") % (opts.output, msg), file=sys.stderr)
+            sys.exit(1)
     else:
         f = sys.stdout
 
-- 
1.9.3

Comment 6 Fedora End Of Life 2015-11-04 15:59:12 UTC
This message is a reminder that Fedora 21 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 21. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '21'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 21 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 7 Fedora End Of Life 2015-12-02 04:55:50 UTC
Fedora 21 changed to end-of-life (EOL) status on 2015-12-01. Fedora 21 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.


Note You need to log in before you can comment on or make changes to this bug.