Bug 1065674

Summary: RFE: extend anaconda addon API to allow additional arguments on %addon line
Product: Red Hat Enterprise Linux 7 Reporter: David Shea <dshea>
Component: anacondaAssignee: David Shea <dshea>
Status: CLOSED ERRATA QA Contact: Release Test Team <release-test-team-automation>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.0CC: atodorov, borgan
Target Milestone: rcKeywords: FutureFeature
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: anaconda-19.31.82-1 Doc Type: Enhancement
Doc Text:
Feature: Add support for arguments to the kickstart %addon command. Reason: More flexible addons. Result: You can now use addon commands like %addon org_fedora_hello_word --reverse-text --text-color="blue"
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-03-05 13:57:56 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1070558, 1115914, 1116335, 1118527, 1118529, 1176483    
Attachments:
Description Flags
anaconda.log
none
program.log
none
syslog none

Description David Shea 2014-02-15 17:33:54 UTC
Anaconda provides an extension to kickstart to allow for addons, but the API for AddonData limits the parser to the text contents of the %addon section. In other words, you can currently work with something like:

%addon org_fedora_hello_world
Text goes here
%end

but it would be nice if the %addon line itself could accept additional arguments, like other kickstart sections and commands do, so that you could define an AddonData class to handle something like:

%addon org_fedora_hello_word --reverse-text --text-color="blue"
Text goes here
%end


This functionality is provided in upstream commit 3a512e4f9e15977f0ce2d0bbe39e841b881398f3

Comment 2 Alexander Todorov 2014-11-25 10:41:02 UTC
With anaconda-19.31.109-1 and exactly the same section in my ks.cfg

> %addon org_fedora_hello_word --reverse-text --text-color="blue"
> Text goes here
> %end
> 


I get an error before stage2 loads the UI:

The following problem occured on line 22 of the kickstart file:

Unhandled arguments on %addon line for org_fedora_hello_world

Comment 3 Alexander Todorov 2014-11-25 10:48:21 UTC
Looking at the addon code it does have a --reverse option but even with 

%addon org_fedora_hello_word --reverse
Text goes here
%end


I get the same error so moving back to ASSIGNED for more info.

Comment 4 Alexander Todorov 2014-11-25 10:50:37 UTC
Created attachment 961138 [details]
anaconda.log

Comment 5 Alexander Todorov 2014-11-25 10:50:55 UTC
Created attachment 961139 [details]
program.log

Comment 6 Alexander Todorov 2014-11-25 10:51:05 UTC
Created attachment 961140 [details]
syslog

Comment 7 Alexander Todorov 2014-11-25 10:57:56 UTC
I think I'm seeing the same error as in bug #1155955 which is fixed in 19.31.110

Comment 8 David Shea 2014-11-25 14:20:51 UTC
Is the addon loaded? I don't see a traceback.

Comment 9 Alexander Todorov 2014-11-26 07:13:11 UTC
(In reply to David Shea from comment #8)
> Is the addon loaded? I don't see a traceback.

I think this happens before it is loaded, while anaconda does ks.cfg parsing just before loading stage2 GUI. I will provide more info once anaconda 19.31.110-1 becomes available for testing.

Comment 10 Alexander Todorov 2014-11-26 14:59:07 UTC
Tested with anaconda 19.31.111-1 and the resulting file /root/hello_world_addon_output.txt is now present but empty. I need to see if this addon is still functioning correctly.

Comment 11 David Shea 2014-12-02 22:18:49 UTC
(In reply to Alexander Todorov from comment #3)
> %addon org_fedora_hello_word --reverse

You forgot an l (word -> world)

It does look like there's a bug in the addon related to creating the anaconda-ks.cfg file, though, so you may end up with a line

%addon org_fedora_hello_world--reverse

with no spaces. I'll send a pull request for that.

Comment 12 Alexander Todorov 2014-12-03 21:18:30 UTC
(In reply to David Shea from comment #11)
> (In reply to Alexander Todorov from comment #3)
> > %addon org_fedora_hello_word --reverse
> 
> You forgot an l (word -> world)
> 

OK, tried with correct syntax this time. I got the resulting /root/hello_world_addon_output.txt file, containing the text:
hello world


It was not reversed however.


> It does look like there's a bug in the addon related to creating the
> anaconda-ks.cfg file, though, so you may end up with a line
> 
> %addon org_fedora_hello_world--reverse
> 
> with no spaces. I'll send a pull request for that.

Also add a newline at the end. My resulting anaconda-ks.cfg is:

%addon org_fedora_hello_world--reverse
hello world
%end%addon com_redhat_kdump --enable --reserve-mb='auto'

%end



where I didn't specify the kdump addon in the original ks.cfg.

Comment 13 David Shea 2014-12-03 21:44:57 UTC
(In reply to Alexander Todorov from comment #12)
> (In reply to David Shea from comment #11)
> > (In reply to Alexander Todorov from comment #3)
> > > %addon org_fedora_hello_word --reverse
> > 
> > You forgot an l (word -> world)
> > 
> 
> OK, tried with correct syntax this time. I got the resulting
> /root/hello_world_addon_output.txt file, containing the text:
> hello world
> 
> 
> It was not reversed however.

The reversal is just in the display on the summary hub. If you use an incomplete kickstart it should show up in status reversed. It won't be reversed in the outputed kickstart, since if you had --reverse with reversed text that would be double reversed.

> > It does look like there's a bug in the addon related to creating the
> > anaconda-ks.cfg file, though, so you may end up with a line
> > 
> > %addon org_fedora_hello_world--reverse
> > 
> > with no spaces. I'll send a pull request for that.
> 
> Also add a newline at the end. My resulting anaconda-ks.cfg is:
> 
> %addon org_fedora_hello_world--reverse
> hello world
> %end%addon com_redhat_kdump --enable --reserve-mb='auto'
> 
> %end

Yep.  https://github.com/vpodzime/hello-world-anaconda-addon/commit/491bdcf10a7fdd9aa798454e49d2b37ae8991ab7

> where I didn't specify the kdump addon in the original ks.cfg.

It gets loaded since it's on the installation media.

Comment 14 Alexander Todorov 2014-12-03 21:48:20 UTC
Ok, my copy of this addon didn't do anything useful with the --reverse option. I've modified it to indicate that it was used and can now verify the original issue. 


David,
in which version do you expect to have the space/newline issue fixed? Do you need me to open another bug for that ?

Comment 15 Alexander Todorov 2014-12-03 21:50:12 UTC
(In reply to David Shea from comment #13)

> Yep. 
> https://github.com/vpodzime/hello-world-anaconda-addon/commit/
> 491bdcf10a7fdd9aa798454e49d2b37ae8991ab7
> 

OK great. Moving to VERIFIED then.

Comment 16 David Shea 2014-12-03 21:50:22 UTC
The space/newline issue is a problem in the hello world addon. The addon itself outputs its string representation, and besides getting the %addon line right it's expected to put a newline at the end. It's been fixed.

Comment 18 errata-xmlrpc 2015-03-05 13:57:56 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2015-0312.html