From 8b371996547903c1ebaed63441e4a3062b3c5707 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Tue, 22 May 2018 09:34:02 -0400 Subject: [PATCH 1/6] Fix wrong port name for G8332 Was using the incorrect half of the return, which broke on G8332. --- confluent_server/confluent/networking/lldp.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/confluent_server/confluent/networking/lldp.py b/confluent_server/confluent/networking/lldp.py index e8fdc009..a54e7b55 100644 --- a/confluent_server/confluent/networking/lldp.py +++ b/confluent_server/confluent/networking/lldp.py @@ -88,7 +88,7 @@ _chassisidbyswitch = {} def lenovoname(idx, desc): if desc.isdigit(): - return 'Ethernet' + str(idx) + return 'Ethernet' + str(desc) return desc nameoverrides = [ From ca7711b37325fc338fde8efdcdecbecb24b6d7b6 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Tue, 22 May 2018 09:36:09 -0400 Subject: [PATCH 2/6] Fix missing portname in lldp data Root cause was pysnmp returning extraneous leftover data causing calling code to overrite good data. --- confluent_server/confluent/snmputil.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/confluent_server/confluent/snmputil.py b/confluent_server/confluent/snmputil.py index aa48b93e..ae6c39b6 100644 --- a/confluent_server/confluent/snmputil.py +++ b/confluent_server/confluent/snmputil.py @@ -99,6 +99,10 @@ class Session(object): elif errnum: raise exc.ConfluentException(errnum.prettyPrint()) for ans in answers: + if not obj[0].isPrefixOf(ans[0]): + # PySNMP returns leftovers in a bulk command + # filter out such leftovers + break yield ans except snmperr.WrongValueError: raise exc.TargetEndpointBadCredentials('Invalid SNMPv3 password') From be3ecf60a5373479ced5590d2f844157a45e297d Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Tue, 22 May 2018 09:56:53 -0400 Subject: [PATCH 3/6] Fix bad error message on {} in nodeshell/noderun {} used in awk is likely, give proper error message. --- .../confluent/plugins/configuration/attributes.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/confluent_server/confluent/plugins/configuration/attributes.py b/confluent_server/confluent/plugins/configuration/attributes.py index 2e7ddf98..ccbaab97 100644 --- a/confluent_server/confluent/plugins/configuration/attributes.py +++ b/confluent_server/confluent/plugins/configuration/attributes.py @@ -183,8 +183,10 @@ def _expand_expression(nodes, configmanager, inputdata): pernodeexpressions[expanded[0]] = expanded[1] for node in util.natural_sort(pernodeexpressions): yield msg.KeyValueData({'value': pernodeexpressions[node]}, node) - except ValueError as e: - raise exc.InvalidArgumentException(str(e)) + except (SyntaxError, ValueError) as e: + raise exc.InvalidArgumentException( + 'Bad confluent expression syntax (must use "{{" and "}}" if not ' + 'desiring confluent exparnsion): ' + str(e)) From 8ede0fd8effe19d583935b0e1f6d571764b659eb Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Tue, 22 May 2018 09:59:30 -0400 Subject: [PATCH 4/6] Document {{}} escape on noderun and nodeshell Documentation did not explain that --- confluent_client/doc/man/noderun.ronn | 4 ++++ confluent_client/doc/man/nodeshell.ronn | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/confluent_client/doc/man/noderun.ronn b/confluent_client/doc/man/noderun.ronn index 626bb685..d8298ffd 100644 --- a/confluent_client/doc/man/noderun.ronn +++ b/confluent_client/doc/man/noderun.ronn @@ -48,6 +48,10 @@ themselves, see nodeshell(8). `n4: 01 10 00` `n2: 01 10 00` + +* If wanting to use literal {} in the command, they must be escaped by doubling: + `# noderun n1-n4 "echo {node} | awk '{{print $1}}'"` + ## SEE ALSO nodeshell(8) diff --git a/confluent_client/doc/man/nodeshell.ronn b/confluent_client/doc/man/nodeshell.ronn index 7c4c57ba..6dc81ccb 100644 --- a/confluent_client/doc/man/nodeshell.ronn +++ b/confluent_client/doc/man/nodeshell.ronn @@ -27,7 +27,10 @@ as stderr, unlike psh which combines all stdout and stderr into stdout. `n4: hi` * Setting a new static ip address temporarily on secondary interface of four nodes: - `# nodeshell n1-n4 ifconfig eth1 172.30.93.{n1}` + `# nodeshell n1-n4 ifconfig eth1 172.30.93.{n1}` + +* If wanting to use literal {} in the command, they must be escaped by doubling: + `# nodeshell n1-n4 "ps | awk '{{print $1}}'"` ## SEE ALSO From 3ace7747ab5464f72c8c6ae75767875ab3c71511 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Tue, 22 May 2018 10:11:37 -0400 Subject: [PATCH 5/6] Fix typo --- confluent_server/confluent/plugins/configuration/attributes.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/confluent_server/confluent/plugins/configuration/attributes.py b/confluent_server/confluent/plugins/configuration/attributes.py index ccbaab97..36baf330 100644 --- a/confluent_server/confluent/plugins/configuration/attributes.py +++ b/confluent_server/confluent/plugins/configuration/attributes.py @@ -186,7 +186,7 @@ def _expand_expression(nodes, configmanager, inputdata): except (SyntaxError, ValueError) as e: raise exc.InvalidArgumentException( 'Bad confluent expression syntax (must use "{{" and "}}" if not ' - 'desiring confluent exparnsion): ' + str(e)) + 'desiring confluent expansion): ' + str(e)) From 57e323786e6ab16c3510b7fe3db4ee80cd8cb021 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Tue, 22 May 2018 11:00:30 -0400 Subject: [PATCH 6/6] Fix syntax error in the recent code --- confluent_server/confluent/config/configmanager.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/confluent_server/confluent/config/configmanager.py b/confluent_server/confluent/config/configmanager.py index 420dda28..b4c03952 100644 --- a/confluent_server/confluent/config/configmanager.py +++ b/confluent_server/confluent/config/configmanager.py @@ -200,7 +200,7 @@ def _rpc_master_del_nodes(tenant, nodes): ConfigManager(tenant).del_nodes(nodes) -def _rpc_del_nodes(tenant, nodes) +def _rpc_del_nodes(tenant, nodes): ConfigManager(tenant)._true_del_nodes(nodes)