Skip to content

Fix -e attribute setting for dotted attribute names - #261

Merged
jjohnson42 merged 1 commit into
xcat2:masterfrom
Obihoernchen:attrib_env
Aug 3, 2026
Merged

Fix -e attribute setting for dotted attribute names#261
jjohnson42 merged 1 commit into
xcat2:masterfrom
Obihoernchen:attrib_env

Conversation

@Obihoernchen

Copy link
Copy Markdown
Member

Found this during testing:

nodeattrib/nodegroupattrib -e replaced '.' with '_' in the attribute name before handing it to the server, not just when looking up the environment variable. Any attribute with a dot in it was therefore rejected, e.g.

$ export info_note=test
$ nodeattrib -e gpu1 info.note
Traceback (most recent call last):
  File "/opt/confluent/bin/nodeattrib", line 97, in <module>
    exitcode=client.updateattrib(session,args,nodetype, noderange, options, argassign)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/confluent/lib/python/confluent/client.py", line 688, in updateattrib
    key, os.environ[key.upper()])
         ~~~~~~~~~~^^^^^^^^^^^^^
  File "<frozen os>", line 714, in __getitem__
KeyError: 'INFO_NOTE'
$ export INFO_NOTE=test
$ nodeattrib -e gpu1 info.note
Error: Bad Request - info_note attribute on node gpu1 is invalid

Keep the attribute name intact and derive the environment variable name from it separately. A missing environment variable now reports which variable names were looked for instead of raising a bare KeyError traceback.

nodeattrib/nodegroupattrib -e replaced '.' with '_' in the attribute name
before handing it to the server, not just when looking up the environment
variable.  Any attribute with a dot in it was therefore rejected, e.g.

$ export info_note=test
$ nodeattrib -e gpu1 info.note
Traceback (most recent call last):
  File "/opt/confluent/bin/nodeattrib", line 97, in <module>
    exitcode=client.updateattrib(session,args,nodetype, noderange, options, argassign)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/confluent/lib/python/confluent/client.py", line 688, in updateattrib
    key, os.environ[key.upper()])
         ~~~~~~~~~~^^^^^^^^^^^^^
  File "<frozen os>", line 714, in __getitem__
KeyError: 'INFO_NOTE'
$ export INFO_NOTE=test
$ nodeattrib -e gpu1 info.note
Error: Bad Request - info_note attribute on node gpu1 is invalid

Keep the attribute name intact and derive the environment variable name
from it separately.  A missing environment variable now reports which
variable names were looked for instead of raising a bare KeyError
traceback.
@jjohnson42
jjohnson42 merged commit a23ab6d into xcat2:master Aug 3, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants