Modify

Ticket #901 (closed defect: worksforme)

Opened 12 years ago

Last modified 11 years ago

bcfg2-info doesn't (completely) honor -C flag

Reported by: https://www.google.com/accounts/o8/id?id=AItOawnSjgovXZr-_V3vGkvMSR0pc5LDykRc1Nc Owned by: solj
Priority: minor Milestone: Bcfg2 1.1.0 Release
Component: bcfg2-client Version: 1.0
Keywords: Cc: sol.jerome@…

Description

When giving bcfg2-info the -C flag to use an alternate config file, it still attempts to read /etc/bcfg2.conf and complains if it cannot. For instance, if /etc/bcfg2.conf has permissions that make it unreadable to normal users, those users cannot run bcfg2-info, for instance to test templates. E.g.:

/usr/sbin/bcfg2-info -d -Q /home/stpierre/bcfg2/trunk -C /home/stpierre/bcfg2/trunk/Cfg/etc/bcfg2.conf/bcfg2.conf.H_bcfg.example.com buildfile /etc/bacula/bacula-dir.conf backup.example.com Failed to load configuration settings. No section: 'statistics'

Although /home/stpierre/bcfg2/trunk/Cfg/etc/bcfg2.conf/bcfg2.conf.H_bcfg.example.com was a valid bcfg2.conf (in fact, it was the same file as /etc/bcfg2.conf) and was readable, bcfg2-info still errored out after trying to read /etc/bcfg2.conf. From an 'strace' on the above command:

open("/etc/bcfg2.conf", O_RDONLY) = -1 EACCES (Permission denied) open("/etc/bcfg2-web.conf", O_RDONLY) = -1 ENOENT (No such file or directory) close(7) = 0 write(2, "Failed to load configuration set"..., 64Failed to load configuration settings. No section: 'statistics' ) = 64

To replicate this issue:

Create a local copy of /etc/bcfg2.conf.

Change permissions on /etc/bcfg2.conf such that you can no longer read it.

Attempt to run bcfg2-info using the -C flag against your local copy of bcfg2.conf.

Attachments

Change History

comment:1 Changed 11 years ago by solj

  • Cc sol.jerome@… added
  • Owner changed from desai to solj
  • Status changed from new to accepted
  • Milestone set to Bcfg2 1.1.0 Release

comment:2 follow-up: ↓ 3 Changed 11 years ago by solj

  • Status changed from accepted to closed
  • Resolution set to worksforme

This appears to be a bug in an older release. I can no longer reproduce this behavior with trunk:

solj@bcfg2:~$ bcfg2-info -C /root/bcfg2.conf 
Handled 17 events in 0.002s
Welcome to bcfg2-info
Type "help" for more information
>

comment:3 in reply to: ↑ 2 Changed 11 years ago by solj

Replying to solj:

This appears to be a bug in an older release. I can no longer reproduce this behavior with trunk:

solj@bcfg2:~$ bcfg2-info -C /root/bcfg2.conf 
Handled 17 events in 0.002s
Welcome to bcfg2-info
Type "help" for more information
>

Forgot to add this:

solj@bcfg2:~$ ls -l /etc/bcfg2.conf
ls: cannot access /etc/bcfg2.conf: No such file or directory

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.