Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

parameter override expects key to be string #72

Open
afletch opened this issue Mar 16, 2017 · 1 comment
Open

parameter override expects key to be string #72

afletch opened this issue Mar 16, 2017 · 1 comment

Comments

@afletch
Copy link

afletch commented Mar 16, 2017

@Rtzq0
If a key is not a string, it will error[1]

Changing

if key.startswith(ovrprfx) and not initmerge:
from:
if key.startswith(ovrprfx) and not initmerge:
to
if str(key).startswith(ovrprfx) and not initmerge:
.. seems to fix, but I'm unsure of the onward implications of this (my testing shows no problems)

[1]

  File "/usr/local/bin/reclass-salt", line 9, in <module>
    load_entry_point('reclass==1.4.1', 'console_scripts', 'reclass-salt')()
  File "build/bdist.macosx-10.12-intel/egg/reclass/adapters/salt.py", line 105, in cli
  File "build/bdist.macosx-10.12-intel/egg/reclass/adapters/salt.py", line 38, in ext_pillar
  File "build/bdist.macosx-10.12-intel/egg/reclass/core.py", line 136, in nodeinfo
  File "build/bdist.macosx-10.12-intel/egg/reclass/core.py", line 119, in _nodeinfo
  File "build/bdist.macosx-10.12-intel/egg/reclass/core.py", line 100, in _recurse_entity
  File "build/bdist.macosx-10.12-intel/egg/reclass/core.py", line 94, in _recurse_entity
  File "build/bdist.macosx-10.12-intel/egg/reclass/storage/memcache_proxy.py", line 56, in get_class
  File "build/bdist.macosx-10.12-intel/egg/reclass/storage/memcache_proxy.py", line 39, in _cache_proxy
  File "build/bdist.macosx-10.12-intel/egg/reclass/storage/yaml_fs/__init__.py", line 96, in get_class
  File "build/bdist.macosx-10.12-intel/egg/reclass/storage/yaml_fs/yamlfile.py", line 48, in get_entity
  File "build/bdist.macosx-10.12-intel/egg/reclass/datatypes/parameters.py", line 51, in __init__
  File "build/bdist.macosx-10.12-intel/egg/reclass/datatypes/parameters.py", line 217, in merge
  File "build/bdist.macosx-10.12-intel/egg/reclass/datatypes/parameters.py", line 191, in _merge_recurse
  File "build/bdist.macosx-10.12-intel/egg/reclass/datatypes/parameters.py", line 163, in _merge_dict
  File "build/bdist.macosx-10.12-intel/egg/reclass/datatypes/parameters.py", line 191, in _merge_recurse
  File "build/bdist.macosx-10.12-intel/egg/reclass/datatypes/parameters.py", line 163, in _merge_dict
  File "build/bdist.macosx-10.12-intel/egg/reclass/datatypes/parameters.py", line 191, in _merge_recurse
  File "build/bdist.macosx-10.12-intel/egg/reclass/datatypes/parameters.py", line 163, in _merge_dict
  File "build/bdist.macosx-10.12-intel/egg/reclass/datatypes/parameters.py", line 191, in _merge_recurse
  File "build/bdist.macosx-10.12-intel/egg/reclass/datatypes/parameters.py", line 163, in _merge_dict
  File "build/bdist.macosx-10.12-intel/egg/reclass/datatypes/parameters.py", line 191, in _merge_recurse
  File "build/bdist.macosx-10.12-intel/egg/reclass/datatypes/parameters.py", line 159, in _merge_dict
AttributeError: 'float' object has no attribute 'startswith'```
@Rtzq0
Copy link
Collaborator

Rtzq0 commented Mar 16, 2017

Och, yeah unfair presumption on my part. I think that fix is probably a sane suggestion. YAML spec does not require keys to be strings, but in the case that they are not I'm not sure how we'd specify the override functionality.

Would you be willing to submit a PR for this or would you prefer that I do so?

alexandruavadanii pushed a commit to alexandruavadanii/reclass that referenced this issue Nov 20, 2018
Allow to use '..' as a reference to higher level in class structure
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants