summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Collet <fedora@famillecollet.com>2010-12-30 17:10:31 +0100
committerRemi Collet <fedora@famillecollet.com>2010-12-30 17:10:31 +0100
commit81056ffba0033d21744d006483e02b27ff558fbd (patch)
tree26996b6b6f1c4becc7b96490ab17cc5cce859efe
parent207af2b6a0b357e7b0ba0ed3046bac5e3dafc9c4 (diff)
improves yum-plugin, now compatible with EL-4
-rw-r--r--fusioninventory-agent.conf7
-rw-r--r--fusioninventory-agent.py22
-rw-r--r--fusioninventory-agent.spec12
3 files changed, 30 insertions, 11 deletions
diff --git a/fusioninventory-agent.conf b/fusioninventory-agent.conf
new file mode 100644
index 0000000..27b04c1
--- /dev/null
+++ b/fusioninventory-agent.conf
@@ -0,0 +1,7 @@
+[main]
+enabled = 1
+
+# Port use to communicate with the agent
+# see --rpc-port service option (default 62354)
+#port = 62354
+
diff --git a/fusioninventory-agent.py b/fusioninventory-agent.py
index 08081d4..f011ce8 100644
--- a/fusioninventory-agent.py
+++ b/fusioninventory-agent.py
@@ -18,7 +18,7 @@ from yum.plugins import TYPE_CORE
from urlgrabber.grabber import urlread
from urlgrabber.grabber import URLGrabError
-requires_api_version = '2.5'
+requires_api_version = '2.1'
plugin_type = TYPE_CORE
def posttrans_hook(conduit):
@@ -27,13 +27,27 @@ def posttrans_hook(conduit):
Run only after an rpm transaction.
"""
try:
- res = urlread('http://localhost:62354/now', 2048)
+ port = conduit.confInt('main', 'port', default=62354)
+ url = "http://localhost:%d/now" % port
+ conduit.info(9, "calling %s" % url)
+ res = urlread(url, 2048)
+
except URLGrabError, e:
conduit.info(4, "Unable to send connect to FusionInventory service")
- conduit.info(6, "%s" %(e,))
+ if '403' in e.args[1]:
+ conduit.info(4, "Check than FusionInventory service runs with rpc-trust-localhost option")
+ else:
+ conduit.info(4, "Check than FusionInventory service is running")
+ conduit.info(6, "Error %s: %s" % (e.args[0], e.args[1]))
return
+
if res and 'Done.' in res:
conduit.info(2, "FusionInventory agent asked to run an inventory")
- else:
+
+ elif res:
conduit.info(4, "Bad anwser from FusionInventory agent")
+ conduit.info(8, res)
+
+ else:
+ conduit.info(4, "No anwser from FusionInventory agent")
diff --git a/fusioninventory-agent.spec b/fusioninventory-agent.spec
index f69f7e5..3996780 100644
--- a/fusioninventory-agent.spec
+++ b/fusioninventory-agent.spec
@@ -18,7 +18,9 @@ Source0: http://search.cpan.org/CPAN/authors/id/F/FU/FUSINV/FusionInventory-Ag
Source1: %{name}.cron
Source2: %{name}.init
+# Will be in 2.1.8 archive
Source3: %{name}.py
+Source4: %{name}.conf
Group: Applications/System
License: GPLv2+
@@ -105,7 +107,7 @@ Summary: Ask FusionInventory agent to send an inventory when yum exits
Summary(fr): Demande à l'agent FusionInventory l'envoi d'un inventaire
Group: System Environment/Base
BuildRequires: python-devel
-Requires: yum >= 3.0
+Requires: yum >= 2.4
Requires: %{name}
%description yum-plugin
@@ -208,13 +210,9 @@ find %{buildroot} -type d -depth -exec rmdir {} 2>/dev/null ';'
%{__install} -m 755 -Dp %{SOURCE1} %{buildroot}%{_sysconfdir}/cron.hourly/%{name}
%{__install} -m 755 -Dp %{SOURCE2} %{buildroot}%{_initrddir}/%{name}
-# Yum plugin
+# Yum plugin installation
%{__install} -m 644 -D %{SOURCE3} %{buildroot}/usr/lib/yum-plugins/%{name}.py
-%{__mkdir_p} %{buildroot}%{_sysconfdir}/yum/pluginconf.d
-cat <<EOF >%{buildroot}%{_sysconfdir}/yum/pluginconf.d/%{name}.conf
-[main]
-enabled=1
-EOF
+%{__install} -m 644 -D %{SOURCE4} %{buildroot}%{_sysconfdir}/yum/pluginconf.d/%{name}.conf
%check