From ce3de96397e3075f6528023143da7cf8aacb9a48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Cabessa?= Date: Wed, 22 May 2013 09:41:29 +0200 Subject: [PATCH] add ACCESSLOG node in inventory for Android OCSInventory does not support ACCESSLOG (but fusioninventory does) We add this node in cfengine. An possible improvement is to check for the existence of this node before adding it in order to be compatible with fusioninventory --- .../node-server/inventory/1.0/fusionAgent.cf | 19 +++++++++++++++++++ .../system/inventory/1.0/fusionAgent.st | 17 +++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/initial-promises/node-server/inventory/1.0/fusionAgent.cf b/initial-promises/node-server/inventory/1.0/fusionAgent.cf index 8cea04964..7316c8992 100644 --- a/initial-promises/node-server/inventory/1.0/fusionAgent.cf +++ b/initial-promises/node-server/inventory/1.0/fusionAgent.cf @@ -331,6 +331,7 @@ bundle agent addInformationsToInventory { "android_name" string => "Android"; "android_version" string => execresult("/system/bin/getprop ro.build.version.release", "noshell"); "android_fullname" string => "Android $(android_version)"; + "logdate" string => execresult("/system/bin/date '+%Y-%m-%d %H:%M:%S'", "noshell"); classes: xen:: @@ -367,6 +368,10 @@ bundle agent addInformationsToInventory { edit_line => add_information_to_android_inventory($(android_fullname), $(android_kernelname), $(android_kernelversion), $(android_name), $(android_version)), edit_defaults => def_no_backup; + "${g.rudder_var_tmp}/inventory/.*.ocs" + edit_line => add_accesslog_to_android_inventory($(logdate)), + edit_defaults => def_no_backup; + } # Move the inventory file in the shared directory @@ -485,6 +490,20 @@ insert_lines: } +#this bundle is necessary for OCSInventory (but not for fusioninventory) +bundle edit_line add_accesslog_to_android_inventory(logdate) +{ +insert_lines: + + android:: + + "$(logdate)" + location => after_location(""), + comment => "Adding log date"; + +} + + bundle edit_line add_users_information_to_inventory(userlist) { insert_lines: diff --git a/techniques/system/inventory/1.0/fusionAgent.st b/techniques/system/inventory/1.0/fusionAgent.st index 6cd55a792..209cfe2ce 100644 --- a/techniques/system/inventory/1.0/fusionAgent.st +++ b/techniques/system/inventory/1.0/fusionAgent.st @@ -345,6 +345,7 @@ bundle agent addInformationsToInventory { "android_name" string => "Android"; "android_version" string => execresult("/system/bin/getprop ro.build.version.release", "noshell"); "android_fullname" string => "Android $(android_version)"; + "logdate" string => execresult("/system/bin/date '+%Y-%m-%d %H:%M:%S'", "noshell"); classes: @@ -381,6 +382,9 @@ bundle agent addInformationsToInventory { edit_line => add_information_to_android_inventory($(android_fullname), $(android_kernelname), $(android_kernelversion), $(android_name), $(android_version)), edit_defaults => def_no_backup; + "${g.rudder_var_tmp}/inventory/.*.ocs" + edit_line => add_accesslog_to_android_inventory($(logdate)), + edit_defaults => def_no_backup; } @@ -500,6 +504,19 @@ insert_lines: } +#this bundle is necessary for OCSInventory (but not for fusioninventory) +bundle edit_line add_accesslog_to_android_inventory(logdate) +{ +insert_lines: + + android:: + + "$(logdate)" + location => after_location(""), + comment => "Adding log date"; + +} + bundle edit_line add_users_information_to_inventory(userlist) { insert_lines: