Bug 605743
Summary: | No errors on why post failed with snippets. | ||
---|---|---|---|
Product: | Red Hat Satellite 5 | Reporter: | Charlie Wyse <cwyse> |
Component: | Provisioning | Assignee: | Stephen Herr <sherr> |
Status: | CLOSED CURRENTRELEASE | QA Contact: | Red Hat Satellite QA List <satqe-list> |
Severity: | high | Docs Contact: | |
Priority: | high | ||
Version: | 530 | CC: | akarlsso, cperry, cww, james.brown, pep, sudo, tao, xdmoon |
Target Milestone: | --- | ||
Target Release: | --- | ||
Hardware: | All | ||
OS: | Linux | ||
Whiteboard: | |||
Fixed In Version: | Doc Type: | Bug Fix | |
Doc Text: | Story Points: | --- | |
Clone Of: | Environment: | ||
Last Closed: | 2013-08-14 19:32:53 UTC | Type: | --- |
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: | 924171 |
Description
Charlie Wyse
2010-06-18 16:43:16 UTC
*** Bug 640106 has been marked as a duplicate of this bug. *** I agree, it's pretty irritating when that happens. Getting this features would save so much time troubleshooting and I haven't yet heard of someone that hasn't spend hours troubleshooting errors like this. Ofcourse, one can try and run a snippet locally on a machine first, after each and every change.. or if you hit such an issue start the first snippet with: while true; do sleep 1; done ..and then change tty to run each snippet manually. ..but that is just as fun as it sounds. It should be noted that this goes for any part of the kickstart, pre, post nochroot or post. Using "sh -n" and a fancy cronjob that runs once a minute I was with ~150 LoC able to implement an automatic syntax check for kickstart snippets. If a snippets is changed (you can see that by diffing against the files in /var/lib/rhn/kickstarts/snippets/1/) then I run "sh -n on /var/lib/rhn/kickstarts/snippets/1/my-post-snippet" and get an e-mail like below: From: root <root> Date: March 26, 2012 2:09:02 PM GMT+02:00 To: Magnus Glantz <my-email@address> Subject: Syntax error in kickstart snippet: dev-linuxts-post-main: Mon Mar 26 12:09:02 UTC 2012 /var/lib/rhn/kickstarts/snippets/1/dev-linuxts-post-main: line 72: syntax error near unexpected token `(' /var/lib/rhn/kickstarts/snippets/1/dev-linuxts-post-main: line 72: ` echo "Setting NTP server to $nsbserver ($reversensb)"' I'll see what I can do to share the code (written in company time..). Not sure how to syntax check Python or other languages, "sh -n" doesn't work with Python. The ability to log errors already exists today. Go to the kickstart profile details page and check the box next to "Log custom post scripts." If I do that and then run a kickstart with a 1-line script that is the sed command from comment 0, I end up with this in /root/ks-post-log.1: /tmp/ks-script-Vd6VzT: line1: unexpected EOF while looking for matching `'' /tmp/ks-script-Vd6VzT: line2: syntax error: unexpected end of file The logging feature may not be in the most intuitive place since it's on the kickstart details page and not enableable for individual scripts, but it is present. I will close this bug as current release. You may also find the errorOnFail option that will be selectable for kickstart scripts in Sat 5.6 useful. You can also play around with getting an interactive terminal during a pre / post script in order to really thoroughly debug your scripts: http://hintshop.ludvig.co.nz/show/interactive-pre-post-install-scripts-redhat-kickstart/ (the "text" option is settable at the Kickstart Details -> Advanced Options page in Satellite) I see now on a more careful reading of the bug that there are actually two competing requests here. One is the "there's no way to get an error log from my scripts" bug that is incorrect and that I addressed with comment 20. The other is a "it would be really nice if we could have syntax checking on scripts in Satellite without having to run an actual kickstart" idea. I believe the two should be separated. I consider this bug to be about the former since that was the main thrust of the original problem. The latter is a fine idea and in fact it would be really nice, but I think it should be filed as a separate RFE and tracked / prioritized appropriately. I hope this clears up some confusion. I've asked Anders Reyner-Karlsson to create a separeate RFE for the syntax check part. As a note, using diff to detect when a snippet is changed and "file" to detect what a kickstart snippet runs for kind of stuff in combination with.. sh -n /var/lib/rhn/kickstarts/snippets/1/$FILE or.. python -c "import py_compile; py_compile.compile(r'/var/lib/rhn/kickstarts/snippets/1/$FILE')" ..depending on what's detected, we've now got a working syntax check for kickstart snippets. Sorry, Anders Rayner-Karlsson (of Red Hat). |