Skip to content

Commit

Permalink
Merge pull request #905 from amousset/ust_7291/exit_sending_inventory…
Browse files Browse the repository at this point in the history
…_to_rudder_webapp_if_the_queue_is_full

Fixes #7291: Exit sending inventory to rudder-webapp if the queue is full
  • Loading branch information
jooooooon committed Apr 6, 2016
2 parents c30d97b + 6e459a2 commit c0ea52a
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -89,43 +89,32 @@ bundle agent sendInventoryToCmdb
ifvarclass => "!role_rudder_inventory_endpoint_server_defined";
"rudder_inventory_endpoint_server" string => "${rudder_servers_by_role.roles[rudder-inventory-endpoint]}",
ifvarclass => "role_rudder_inventory_endpoint_server_defined";
"incoming_inventory_files" slist => findfiles("${g.rudder_inventories}/incoming/*.ocs", "${g.rudder_inventories}/incoming/*.ocs.gz");
"updates_inventory_files" slist => findfiles("${g.rudder_inventories}/accepted-nodes-updates/*.ocs", "${g.rudder_inventories}/accepted-nodes-updates/*.ocs.gz");

files:

root_server::

"${g.rudder_inventories}/incoming"
"${incoming_inventory_files}"
transformer => "${g.rudder_tools}/send-clean.sh http://${rudder_inventory_endpoint_server}:8080/endpoint/upload/ ${this.promiser} ${g.rudder_inventories}/received/ ${g.rudder_inventories}/failed/",
depth_search => recurse_visible(1),
file_select => all_inventory_files,
classes => if_else("inventory_sent", "rudder_send_inventory_to_cmdb_cant_send_inventory"),
ifvarclass => "!rudder_send_inventory_to_cmdb_cant_send_inventory",
comment => "Sending the inventory to the cmdb";

"${g.rudder_inventories}/accepted-nodes-updates"
"${updates_inventory_files}"
transformer => "${g.rudder_tools}/send-clean.sh http://${rudder_inventory_endpoint_server}:8080/endpoint/upload/ ${this.promiser} ${g.rudder_inventories}/received/ ${g.rudder_inventories}/failed/",
depth_search => recurse_visible(1),
file_select => all_inventory_files,
classes => if_else("inventory_sent", "rudder_send_inventory_to_cmdb_cant_send_inventory"),
ifvarclass => "!rudder_send_inventory_to_cmdb_cant_send_inventory",
comment => "Sending the inventory to the cmdb";

# NEED TO DO THE RSYNC PART

reports:
inventory_sent.!rudder_send_inventory_to_cmdb_cant_send_inventory::
"@@DistributePolicy@@result_success@@root-DP@@root-distributePolicy@@00@@reports@@None@@${g.execRun}##${g.uuid}@#Incoming inventories were successfully added to Rudder";
rudder_send_inventory_to_cmdb_cant_send_inventory::
"@@DistributePolicy@@result_error@@root-DP@@root-distributePolicy@@00@@reports@@None@@${g.execRun}##${g.uuid}@#Some inventories failed to add successfully to Rudder";
}


body file_select all_inventory_files
{
leaf_name => { "uuid\.hive" };
file_types => { "plain" };
file_result => "file_types.!leaf_name";
}


body file_select no_license_dat
{
leaf_name => { "license\.dat" };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,18 +79,17 @@ bundle agent propagatePromises
# Sending the inventory to cmdb (or syncing with the server if we are a simple relay)
bundle agent sendInventoryToCmdb
{
vars:
"incoming_inventory_files" slist => findfiles("${g.rudder_inventories}/incoming/*.ocs", "${g.rudder_inventories}/incoming/*.ocs.gz");

files:
root_server::
"${g.rudder_inventories}/incoming"
"${incoming_inventory_files}"
transformer => "${g.rudder_tools}/send-clean.sh http://localhost:8080/endpoint/upload/ ${this.promiser} ${g.rudder_inventories}/received/ ${g.rudder_inventories}/failed/",
depth_search => recurse_visible(1),
file_select => all_inventory_files,
classes => if_else("inventory_sent", "cant_send_inventory"),
ifvarclass => "!cant_send_inventory",
comment => "Sending the inventory to the cmdb";

# NEED TO DO THE RSYNC PART

reports:
inventory_sent::
"@@DistributePolicy@@Success@@root-DP#@root-distributePolicy##${g.uuid}@#The inventory has been successfully added to the cmdb";
Expand Down
27 changes: 10 additions & 17 deletions techniques/system/distributePolicy/1.0/propagatePromises.st
Original file line number Diff line number Diff line change
Expand Up @@ -140,26 +140,28 @@ bundle agent propagatePromises
}

# Sending the inventory to cmdb (or syncing with the server if we are a simple relay)
# We cannot use list of paths to send the inventories because it cause the transformer to fail
# for some unknown reason
# We cannot use list of paths (i.e. {"incoming", "accepted-nodes-updates"}) to send the inventories because it cause the transformer to fail
# for some unknown reason, see https://www.rudder-project.org/redmine/issues/4094
bundle agent sendInventoryToCmdb
{
vars:
"incoming_inventory_files" slist => findfiles("${g.rudder_inventories}/incoming/*.ocs", "${g.rudder_inventories}/incoming/*.ocs.gz");
"updates_inventory_files" slist => findfiles("${g.rudder_inventories}/accepted-nodes-updates/*.ocs", "${g.rudder_inventories}/accepted-nodes-updates/*.ocs.gz");

files:
# Root server and relay-top send to the endpoint, every other send as usual to their policy server
root_server|role_rudder_relay_top::

"${g.rudder_inventories}/incoming"
"${incoming_inventory_files}"
transformer => "${g.rudder_tools}/send-clean.sh &CMDBENDPOINT& ${this.promiser} ${g.rudder_inventories}/received/ ${g.rudder_inventories}/failed/",
depth_search => recurse_visible(1),
file_select => all_inventory_files,
classes => rudder_common_classes("rudder_inventory_processing"),
ifvarclass => "!rudder_inventory_processing_error",
comment => "Processing a local inventory";

"${g.rudder_inventories}/accepted-nodes-updates"
"${updates_inventory_files}"
transformer => "${g.rudder_tools}/send-clean.sh &CMDBENDPOINT& ${this.promiser} ${g.rudder_inventories}/received/ ${g.rudder_inventories}/failed/",
depth_search => recurse_visible(1),
file_select => all_inventory_files,
classes => rudder_common_classes("rudder_inventory_processing"),
ifvarclass => "!rudder_inventory_processing_error",
comment => "Processing a local inventory";

policy_server.!(root_server|role_rudder_relay_top)::
Expand Down Expand Up @@ -222,15 +224,6 @@ bundle agent sendInventoryToCmdb

}


body file_select all_inventory_files
{
leaf_name => { "uuid\.hive" };
file_types => { "plain" };
file_result => "file_types.!leaf_name";
}


body file_select no_license_dat
{
leaf_name => { "license\.dat" };
Expand Down

0 comments on commit c0ea52a

Please sign in to comment.