Modify

Ticket #990 (closed enhancement: fixed)

Opened 11 years ago

Last modified 10 years ago

Possible bug in "bcfg2-info buildfile"

Reported by: m4z <686f6c6d@…> Owned by: desai
Priority: minor Milestone: Bcfg2 1.2.1 Release (Bugfix)
Component: bcfg2-server Version: 1.0
Keywords: Cc:

Description

How is "bcfg2-info buildfile" supposed to be used? (This is on 1.1.1)

I'm specifically trying to debug a TGenshi template that is not yet part of any clients config (it is not bundled for any client, if that makes it more clear). AFAICT, "buildfile" is the only option that builds a single file instead of the whole configuration for a client, and that really is what I'd like to do.

But, for example, when I try (in bash) to pipe a long file into less, tail, into a file with ">" or ">>" or "tee", a) I also see the informal messages from bcfg2-info startup (which is not too bad), and worse, b) characters at the end of the file are missing (about 110 lines(!) at the end of the file, for the file I tested).

Sometimes it also causes tracebacks. For example, this is from a pipe into "head -40":

hostname:/var/lib/bcfg2 # bcfg2-info buildfile /etc/somefile.test hostname | head -40 Searching for new models to add to the statistics database Running upgrade of models to the new one Presently at version 17 updated the 2010-10-05T11:08:52.865277 Initialized git plugin with git directory /var/lib/bcfg2/.git Loading experimental plugin(s): Guppy NOTE: Interfaces subject to change Handled 1609 events in 0.930s <?xml version='1.0' encoding='UTF-8'?> <Path type="file" name="/etc/somefile.test" perms="644" paranoid="true" important="False" group="root" owner="root">[...snippet of file...] [...some more lines...] Traceback (most recent call last):

File "/usr/sbin/bcfg2-info", line 468, in <module>

loop.Run(setupargs?)

File "/usr/sbin/bcfg2-info", line 437, in Run

self.onecmd(" ".join(args))

File "/usr/lib64/python2.6/cmd.py", line 219, in onecmd

return func(arg)

File "/usr/sbin/bcfg2-info", line 275, in do_buildfile

print(lxml.etree.tostring(entry, encoding="UTF-8", xml_declaration=True))

IOError: [Errno 32] Broken pipe hostname:/var/lib/bcfg2 #

So, my questions are:

  • Am I doing it wrong?
  • What command can I use to build a single file for a single client and drop it on disk or pipe it into "head" or "tail" or something similar for inspection?

Attachments

Change History

comment:1 Changed 11 years ago by m4z <686f6c6d@…>

Thanks to solj!

s/print/self.logger.info/ in /usr/sbin/bcfg2-info, line 275 is a fine temporary workaround.

comment:2 Changed 10 years ago by solj

  • Milestone changed from Bcfg2 1.2.0 Release to Bcfg2 1.2.1 Release (Bugfix)

comment:3 Changed 10 years ago by https://www.google.com/accounts/o8/id?id=AItOawnSjgovXZr-_V3vGkvMSR0pc5LDykRc1Nc

  • Status changed from new to closed
  • Resolution set to fixed

This appears to have been fixed at some point, but I can't find the commit. At any rate, the current version of bcfg2-info definitely uses print() and definitely works when the output is redirected.

WARNING! You need to establish a session before you can create or edit tickets. Otherwise the ticket will get treated as spam.

View

Add a comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
The resolution will be deleted. Next status will be 'reopened'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.