Bug 809905 - RFE: Enhancement for kickstart_addscript command to allow for setting of cobbler templating option via command line
RFE: Enhancement for kickstart_addscript command to allow for setting of cobb...
Product: Spacewalk
Classification: Community
Component: Server (Show other bugs)
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Stephen Herr
Red Hat Satellite QA List
Depends On:
Blocks: space18
  Show dependency treegraph
Reported: 2012-04-04 12:04 EDT by Jose Simonelli
Modified: 2012-11-01 12:20 EDT (History)
4 users (show)

See Also:
Fixed In Version: spacecmd-1.8.9-1
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2012-11-01 12:20:06 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Jose Simonelli 2012-04-04 12:04:33 EDT
Description of problem:
While writing some scripts that use spacecmd to query data to do backups and recovery of kickstart profiles.  From these backups I have found that during the kickstart_addscript command one can set all of the options with the exception of the Template option which had to be done manually after the kickstart was imported and the scripts added using the GUI.   After looking at the http://host/rpc/api documentation I found that the template option is not mentioned at all in kickstart.profile.addScript but while query the system call using api.getApiNamespaceCallList for the kickstart.profile.addScript

Once I was able to test on my system that I could set the template checkmark it displays on the web GUI I was able to do so by adding the code outlined at the end of this report

Version-Release number of selected component (if applicable):
- Tested on spacecmd-1.2.2-1.el5
- Also tested on EL6 version
- Also tested against nightly git build

How reproducible:
Use the following patch to add the enhancement

 diff -crB a/lib/kickstart.py b/lib/kickstart.py
*** a/lib/kickstart.py  2012-04-03 16:34:13.000000000 -0400
--- b/lib/kickstart.py  2012-04-04 11:56:13.000000000 -0400
*** 1638,1643 ****
--- 1638,1644 ----
      options = [ Option('-p', '--profile', action='store'),
                  Option('-e', '--execution-time', action='store'),
                  Option('-c', '--chroot', action='store_true'),
+                 Option('-t', '--template', action='store_true'),
                  Option('-i', '--interpreter', action='store'),
                  Option('-f', '--file', action='store') ]

*** 1668,1673 ****
--- 1669,1679 ----
              options.chroot = True

+         if re.match('n', options.template, re.I):
+             options.template = False
+         else:
+             options.template = True
          if re.match('pre', options.execution_time, re.I):
              options.execution_time = 'pre'
*** 1698,1703 ****
--- 1704,1710 ----
      print 'Profile Name:   %s' % options.profile
      print 'Execution Time: %s' % options.execution_time
      print 'Chroot:         %s' % options.chroot
+     print 'Template:       %s' % options.template
      print 'Interpreter:    %s' % options.interpreter
      print 'Contents:'
      print options.contents
*** 1709,1715 ****
!                                             options.chroot)


--- 1716,1723 ----
!                                             options.chroot,
!                                             options.template)


Steps to Reproduce:
1. Apply the patch
2. Test by adding a script using snippets
3. Answer Y on the addscript questionaire, or use -t or --template on the command line to pass the setting to enable templating
4. Check on the GUI to assure it is checked after its added
5. Optional. Provision a system using the kickstart with said template script and assure its working as expected. 
Actual results:
Capability to set the template boolean option from the command line using the -t or --template or it will prompt you when its blank and you are at the spacecmd prompt much like other prompts

Expected results:
When used on the command line to add the script with the template option it will enable the setting to use the script being added as a template.

Additional info:
This is an enhancement fix that will allow for people to write a script to set the template option on the script being added to the kickstart without having to do it from the Web GUI.
Comment 1 Miroslav Suchý 2012-04-04 13:54:35 EDT
Forwarded to upstream.
Comment 2 Stephen Herr 2012-04-05 14:54:14 EDT
Hey Jose, this looks great, thanks for the patch!

And as a side note RE template option not being mentioned in the API doc, it actually is there, but there are two versions of the addScript method and the template option is available in the second form. So you have to scroll a little bit further down the page, but it should be there. :)

Committed to Spacewalk master as b9a232dd1f79ab46e23d0654189bf4fd0009f5fb.
Comment 3 Zailo Leite 2012-05-21 18:55:14 EDT
While we're at it, there's also:

<             options.chroot = True
>             options.chroot = False

Without that the "-c" switch can not e turned off. 

Comment 4 Stephen Herr 2012-05-31 15:09:44 EDT
(In reply to comment #3)
> While we're at it, there's also:
> 1701c1701
> <             options.chroot = True
> ---
> >             options.chroot = False
> Without that the "-c" switch can not e turned off. 
> Z

Good point. Committed to Spacewalk master: 03c611ea7710bd606d46d44a432ae67c3af1b875
Comment 5 Jan Pazdziora 2012-10-30 15:24:44 EDT
Moving ON_QA. Packages that address this bugzilla should now be available in yum repos at http://yum.spacewalkproject.org/nightly/
Comment 6 Jan Pazdziora 2012-11-01 12:20:06 EDT
Spacewalk 1.8 has been released: https://fedorahosted.org/spacewalk/wiki/ReleaseNotes18

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