Stephen Hahn wrote: > * Rinaldo DiGiorgio <[EMAIL PROTECTED]> [2008-04-27 22:15]: > >> Dan Price wrote: >> >>> On Sun 27 Apr 2008 at 12:54PM, Rinaldo DiGiorgio wrote: >>> >>> >>>>>> [EMAIL PROTECTED]:~# cat /etc/motd >>>>>> Sun Microsystems Inc. SunOS 5.11 snv_86 January 2008 >>>>>> [EMAIL PROTECTED]:~# grep 11 /etc/motd >>>>>> Sun Microsystems Inc. SunOS 5.11 snv_86 January 2008 >>>>>> [EMAIL PROTECTED]:~# echo $? >>>>>> 0 >>>>>> [EMAIL PROTECTED]:~# grep 12 /etc/motd >>>>>> [EMAIL PROTECTED]:~# echo $? >>>>>> 1 >>>>>> >>>>>> >>>>>> >>>>> The analogy here isn't convincing, possibly because the pkg(1) >>>>> invocations above are a small subset of those available. pkg >>>>> uninstall of an unknown package gives a non-zero exit status; pkg >>>>> install of an unknown package gives a non-zero exit status. At the >>>>> completion of the pkg install invocation in both the cases above, the >>>>> requested package is actually installed. >>>>> >>> A similar command that you might use to make this test is >>> 'pkg list <pkgname>' -- this does indeed return 1 if the package >>> is not installed. I think that's the most analogous to grep, and >>> is the test we use in the test suite for this kind of checking. >>> >>> >> Excellent, thank you. I have put together a JSON interface available >> to any HTTP capable client for remote installation of packages. I >> typically manage about 100 systems. The ability for me to install >> from one server will save me quite a bit of time. I had something >> similar with the old packaging system but the commands were too >> verbose and asked too many questions. So far the new system is much >> better for me on this issue. >> > > So, since you're one of the first people to attempt to automate use of > pkg(1), what output would you like to see, or to see omitted? (We are > in complete accord about "no questions".) Dan has already made the > output sensitive to whether it is outputting to a tty or not, but > further output modifications are certainly possible. > > - Stephen > > I noticed that the pkg software was aware of a non tty access path and did not send screen control commands. Your output is currently easy to parse using regex. Many people will consider a regex approach a hack(negative sense) so it would be great if you considered a standard machine syntax or had some guarantee that output changes would be managed. I have seen some hints that you already have machine readable output but I did not look into that yet. The two formats that I see most often are JSON and XML when communicating with HTTP wrappers providing a RESTful interface to a remote service. It is not clear that it is the right approach for CLI commands. I personally would like to see every Solaris command have an option for JSON or XML output.
Rinaldo _______________________________________________ pkg-discuss mailing list [email protected] http://mail.opensolaris.org/mailman/listinfo/pkg-discuss
