From 5e6c66826ff5b2b81392c1be79bc26ed263ccd1e Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Mon, 11 Feb 2019 16:01:30 -0500 Subject: [PATCH] Provide error on useless api call If making an api call against a noderange to set attributes and that noderange is blank, provide feedback to help user know that nothing happened. --- .../confluent/plugins/configuration/attributes.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/confluent_server/confluent/plugins/configuration/attributes.py b/confluent_server/confluent/plugins/configuration/attributes.py index e16dad19..d9a4d59e 100644 --- a/confluent_server/confluent/plugins/configuration/attributes.py +++ b/confluent_server/confluent/plugins/configuration/attributes.py @@ -197,6 +197,10 @@ def create(nodes, element, configmanager, inputdata): def update_nodes(nodes, element, configmanager, inputdata): updatedict = {} + if not nodes: + raise exc.InvalidArgumentException( + 'No action to take, noderange is empty (if trying to define ' + 'group attributes, use nodegroupattrib)') for node in nodes: updatenode = inputdata.get_attributes(node, allattributes.node) clearattribs = []