agent-2.0rc3 (and 4) ignores server setting from /etc/sysconfig/

Bug #767290 reported by Matthias Schroder
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OCS Inventory: Unified Unix Agent
Fix Released
Medium
mortheres

Bug Description

I am trying ocsinventory-agent-2.0rc3 on a SLC5.6 box, but I have some problems with the config files.

For the 1.1.2.1 agent, I get my settings from /etc/sysconfig/ocsinventory-agent, and did not have to touch /etc/ocsinventory/ocsinventory-agent.cfg. But for the 2.0rc3 agent, that does not work anymore. The agent takes the 'local' setting from /etc/ocsinventory/ocsinventory-agent.cfg, and later refuses to accept the 'server' setting from /etc/sysconfig/ocsinventory-agent: "--server ignored since you also use --local".

I guess this is due to the following code that was in 1.1.2.1, but is not in 2.0rc3 any more:

# allow "server" from command line when "local" in config. file
if (defined($config->{config}{'optserver'})) {
    $config->{config}{'server'}=$config->{config}{'optserver'};
    undef $config->{config}{'local'};
    undef $config->{config}{'optserver'};
}

Best regards,

Matthias

Revision history for this message
mortheres (mortheres) wrote :

Hi Matthias,

Thanks a lot for our report but it is a strange behaviour you had because I can find any piece of code like the one you gave us in your report in the OCS Unix agent 1.1.2.1 :S :S. I take a look to the 1.1.2.1 source and it never integrated the /etc/sysconfig/ocsinventory-agent directory as a directory where the agent reads it configuration :S :S.

How does the 1.1.2 agent was installed ? Using source code ? Using a rpm package ? In which source file is the piece of code you gave us in your report ?

Anyway, integrate the /etc/sysconfig/ocsinventory-agent directory as a directory should be very easy to do. I attach a patch to integrarte the /etc/sysconfig/ocsinventory-agent/ as a configuration directory. This directory must include a configuration file named ocsinventory-agent.cfg . Tell us if this patch works for you.

Kind regards,

Guillaume

Revision history for this message
Matthias Schroder (matthias-schroder) wrote :

Hi Guillaume,

thanks for your reply. What you are saying is very interesting. Is what I am seeing the difference between OCS Inventory and OCS Inventory-NG??? I had been wondering about that a few times, but never saw any hint confirming this.

Anyhow, the code I use is ocsinventory-agent-1.1.2.1, I got the source rpm from the EPEL repositories for RHEL4/5/6-like distros (we are using SLC). We have modified the rpm to add a collector for very site specific parameters. But we had not modified the way the config is done. That change is mentioned in the changelog by:

* Sun Feb 17 2008 Remi Collet <email address hidden> 0.0.8.1-0.1.20080217
- update to 0.0.8.1 from CVS
- change config file used
   from /etc/ocsinventory-agent/ocsinv.conf
     to /etc/ocsinventory/ocsinventory-agent.cfg

The code I quoted is from Agent.pm.

Thanks for your patch, I will check whether it applies, and what it does exactly. I will also have to check whether at the time being I get all parameters from /etc/sysconfig, or whether some are taken from there and some from /etc/ocsinventory.

Cheers,

Matthias

Revision history for this message
Matthias Schroder (matthias-schroder) wrote :

Hi Guillaume,

after I brought the koffein level to the required value, I noticed that I forgot to mention an important feature: In the OCS version we use, it is the cron-job that parses /etc/sysconfig/ocsinventory-agent and passes the extracted values as command line options to the agent itself. That is why we get some parameters from /etc/sysconfig/ocsinventory-agent and some from /etc/ocsinventory/ocsinventory-agent.cfg, which can be quite confusing. Luckily for 1.1.2, we only needed to modify the settings in /etc/sysconfig/ocsinventory-agent, but when I picked up 2.0rc3 and 4, I noticed that now the command line server setting was able to not overwrite the 'local' setting from ocsinventory-agent.cfg anymore, since the snippet I quoted in the initial report is not in Agent.pm 2.0rc

Matthias

Revision history for this message
Remi Collet (remicollet) wrote :

Full patch (code in #1 is only partial) to allow command line to override config setting (required for cron job), used in RPM is available

http://pkgs.fedoraproject.org/gitweb/?p=ocsinventory-agent.git;a=blob_plain;f=ocsinventory-agent-options.patch;hb=HEAD

Revision history for this message
mortheres (mortheres) wrote : Re: [Bug 767290] Re: agent-2.0rc3 (and 4) ignores server setting from /etc/sysconfig/

Salut Remi,

Je suis en train de regarder ton patch. En fait je me demande pourquoi tu reforce la valeur du paramètre "server" avec celui de "optserver" ? Tu ne peux pas reecraser la valeur "server" de la config en la spécifiant dans le fichier de /etc/sysconfig ? Je n'ai pas de chapeau rouge sous la main donc je ne peux pas le tester et me rendre compte.

Ce que je pensais faire, c'etait de t'ajouter une option "--force-server". Si celle-ci est activé, alors ça désactive le paramètre --local qui aurait pu être mis dans le fichier de conf ou en ligne de commande. Donc toi tu aurais juste à mettre "server" (avec l'adresse du server) et "forceserver" (à 1 par exemple) dans ton fichier de /etc/sysconfig.

ça te conviens ça ?

--
Guillaume

----- Mail original -----
De: "Remi Collet" <email address hidden>
À: "guillaume protet" <email address hidden>
Envoyé: Mercredi 27 Avril 2011 08:57:12
Objet: [Bug 767290] Re: agent-2.0rc3 (and 4) ignores server setting from /etc/sysconfig/

Full patch (code in #1 is only partial) to allow command line to
override config setting (required for cron job), used in RPM is
available

http://pkgs.fedoraproject.org/gitweb/?p=ocsinventory-
agent.git;a=blob_plain;f=ocsinventory-agent-options.patch;hb=HEAD

--
You received this bug notification because you are a member of OCS
Inventory Dev Team, which is the registrant for OCS Inventory: OCS
Unified Unix Agent.
https://bugs.launchpad.net/bugs/767290

Title:
  agent-2.0rc3 (and 4) ignores server setting from /etc/sysconfig/

Status in OCS Unified Unix Agent:
  New

Bug description:
  I am trying ocsinventory-agent-2.0rc3 on a SLC5.6 box, but I have some
  problems with the config files.

  For the 1.1.2.1 agent, I get my settings from /etc/sysconfig
  /ocsinventory-agent, and did not have to touch /etc/ocsinventory
  /ocsinventory-agent.cfg. But for the 2.0rc3 agent, that does not work
  anymore. The agent takes the 'local' setting from /etc/ocsinventory
  /ocsinventory-agent.cfg, and later refuses to accept the 'server'
  setting from /etc/sysconfig/ocsinventory-agent: "--server ignored
  since you also use --local".

  I guess this is due to the following code that was in 1.1.2.1, but is
  not in 2.0rc3 any more:

  # allow "server" from command line when "local" in config. file
  if (defined($config->{config}{'optserver'})) {
      $config->{config}{'server'}=$config->{config}{'optserver'};
      undef $config->{config}{'local'};
      undef $config->{config}{'optserver'};
  }

  Best regards,

  Matthias

Changed in ocsinventory-unix-agent:
assignee: nobody → mortheres (mortheres)
milestone: none → 2.0
importance: Undecided → Medium
Revision history for this message
mortheres (mortheres) wrote :

Sorry for my last comment in French but I made a mistake when I answer to a mail....:( :(

Yes I have to pay my beer for this mistake :) :)

I am talking with Remi about his patch integration in OCS Unix agent....

--
Guillaume

Revision history for this message
Matthias Schroder (matthias-schroder) wrote :

Salut Guillaume,

On 04/28/2011 11:48 PM, mortheres wrote:
> Sorry for my last comment in French but I made a mistake when I answer
> to a mail....:( :(
>

Pas de probleme, je preferre d'ecrire en anglais, mais je comprend un
peut le francais.

>
> Yes I have to pay my beer for this mistake :) :)

Un bierre est toujours un bonne idee ;)

Bon journee,

Matthias

>
>
> I am talking with Remi about his patch integration in OCS Unix agent....
>
> --
> Guillaume
>

Revision history for this message
mortheres (mortheres) wrote :

Hi Matthias,

Anyway, it is better to post in English here because it is a public bug and for the people who can not speak French :) :).

Regards,

Guillaume

Revision history for this message
mortheres (mortheres) wrote :

Using the idea from Remi's patch, I added a new option in Unix agent: --nolocal. This option desactivate local mode even if it is set in config file or command line. To fix the problem, you just have to add the "nolocal" option in /etc/sysconfig/ocsinventory-agent file and this will disable the "local" option set in /etc/ocsinventory-agent/ocsinventory-agent.cfg file :) :). You can use the --nolocal option when you launch the agent from command line too.

The fix has been commited in the stable-2.0 branch of the OCS Unix agent : http://bazaar.launchpad.net/~ocsinventory-dev/ocsinventory-unix-agent/stable-2.0/revision/1041. The fix will be released in the 2.0 final release :) :).

Kind regards,

Guillaume

Changed in ocsinventory-unix-agent:
status: New → Fix Committed
Revision history for this message
Matthias Schroder (matthias-schroder) wrote :

Hi Remi,

On 04/27/2011 08:57 AM, Remi Collet wrote:
> Full patch (code in #1 is only partial) to allow command line to
> override config setting (required for cron job), used in RPM is
> available
>
> http://pkgs.fedoraproject.org/gitweb/?p=ocsinventory-
> agent.git;a=blob_plain;f=ocsinventory-agent-options.patch;hb=HEAD
>

Thanks, yes I missed the introduction of the optserver, and without that
it does not work.

But I am a bit puzzled about the nosoftware setting also added in that
patch, that is a change of defaults with respect to 1.2, or do I (again)
miss something?

Matthias

mortheres (mortheres)
Changed in ocsinventory-unix-agent:
status: Fix Committed → In Progress
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.