Re: ksvalidator - can't detect errors?

whitivery <[email protected]>
Newsgroups gmane.linux.redhat.kickstart.general
Message-ID <[email protected]>
Matt Rose <[email protected]> wrote:

>
>On Wed, 17 Aug 2011, whitivery wrote:
>
>> Sometimes ksvalidator will complain but not return an error, for
>> instance:
>>
>>   # ksvalidator -v RHEL5 /tmp/tmp.57yMAuel5v
>>   The following problem occurred on line 2 of the kickstart file:
>>   Unknown command: somesetting1
>>   # echo $?
>>   0
>>
>> I want to be able to detect such problems.  But when I try to
>> redirect or pipe the output of ksvalidator, it produces no
>> output.
>>
>> How can I detect such problems within a shell script?
>>
>> Fedora 14, pykickstart-1.77-2.
>
>Just another note that both problems mentioned above have been fixed in 
>pykickstart 1.82-1
>
>$ cat /etc/fedora-release ; rpm -q pykickstart ; ksvalidator /tmp/foo ; 
>echo $?
>Fedora release 15 (Lovelock)
>pykickstart-1.82-1.fc15.noarch
>The following problem occurred on line 188 of the kickstart file:
>
>Section does not end with %%end.
>
>1

Thanks for the response.

Just to be clear, the kinds of errors I want to detect are those that
don't currently return 1.  Here's an example showing both the inability to
capture output, and errors that return 1 vs. those that return 0.

# ksvalidator /tmp/foo
Error reading /tmp/foo:
[Errno 2] Local file does not exist: /tmp/foo
# echo $?
1
# Y=$(ksvalidator /tmp/foo 2>&1)
# echo $Y

#
# echo abc > /tmp/foo
# ksvalidator /tmp/foo 2>&1
The following problem occurred on line 1 of the kickstart file:
Unknown command: abc
# echo $?
0

If 1.82 solves these, I hope it shows up soon - my Fedora 14 "yum info
pykickstart" still shows 1.77.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.