Remove yaql call when building logging_groups
authorThomas Herve <therve@redhat.com>
Mon, 20 Mar 2017 17:07:37 +0000 (18:07 +0100)
committerThomas Herve <therve@redhat.com>
Mon, 10 Apr 2017 10:15:52 +0000 (10:15 +0000)
yaql calls are fairly expensive. Let's try to not nest them when we can
avoid it.

Change-Id: I5e7dbc42be625bbfe7989867794a67ebae08687d

puppet/services/services.yaml

index a2286d1..9820b43 100644 (file)
@@ -90,14 +90,11 @@ outputs:
         # fluentd user.
         yaql:
           expression: >
-            set($.data.groups.flatten()).where($)
+            set(($.data.default + $.data.extra + $.data.role_data.where($ != null).select($.get('logging_groups'))).flatten()).where($)
           data:
-            groups:
-              - [{get_attr: [LoggingConfiguration, LoggingDefaultGroups]}]
-              - yaql:
-                  expression: list($.data.role_data.where($ != null).select($.get('logging_groups')).where($ != null))
-                  data: {role_data: {get_attr: [ServiceChain, role_data]}}
-              - [{get_attr: [LoggingConfiguration, LoggingExtraGroups]}]
+            default: {get_attr: [LoggingConfiguration, LoggingDefaultGroups]}
+            extra: {get_attr: [LoggingConfiguration, LoggingExtraGroups]}
+            role_data: {get_attr: [ServiceChain, role_data]}
       config_settings: {map_merge: {get_attr: [ServiceChain, role_data, config_settings]}}
       global_config_settings:
         map_merge: