Skip to content

mgr/dashboard: fix None value for ints and floats - #35521

Merged
tchaikov merged 2 commits into
ceph:masterfrom
sebastian-philipp:dashboard-mgr-module-option-default-value-none-for-it-or-float
Jun 11, 2020
Merged

tchaikov merged 2 commits into
ceph:masterfrom
sebastian-philipp:dashboard-mgr-module-option-default-value-none-for-it-or-float

Conversation

@sebastian-philipp

@sebastian-philipp sebastian-philipp commented Jun 10, 2020 •

Copy link
Copy Markdown
Contributor

Signed-off-by: Sebastian Wagner [email protected]

Fixes: https://tracker.ceph.com/issues/45963

Checklist

  • References tracker ticket
  • Updates documentation if necessary
  • Includes tests for new functionality or reproducer for bug

Show available Jenkins commands
  • jenkins retest this please
  • jenkins test classic perf
  • jenkins test crimson perf
  • jenkins test signed
  • jenkins test make check
  • jenkins test make check arm64
  • jenkins test submodules
  • jenkins test dashboard
  • jenkins test dashboard backend
  • jenkins test docs
  • jenkins render docs
  • jenkins test ceph-volume all
  • jenkins test ceph-volume tox

@sebastian-philipp
sebastian-philipp requested review from a team and votdev June 10, 2020 12:07
@sebastian-philipp
sebastian-philipp force-pushed the dashboard-mgr-module-option-default-value-none-for-it-or-float branch from 7c88c53 to 7857a29 Compare June 10, 2020 12:07

@votdev votdev left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO this is only a workaround and as such the comments should be added. To finally fix this the corresponding modules must set a correct value. None is Python specific and not a value that can be set by a user via CLI for example. If a type is set to int then it should be not None but something like -1 or 0 or any value that represents a Nonein the real world and the specific behavior of the configuration option.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
option[name] = None
# Note, this is a workaround, to finally fix this
# the module must set a correct value.
option[name] = None

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think in this specific case, the dashboard should be forgiving here. if we want to assert the type, we have to do it in mgr_module.get_module_option

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
option[name] = None
# Note, this is a workaround, to finally fix this
# the module must set a correct value.
option[name] = None

@sebastian-philipp

Copy link
Copy Markdown
Contributor Author

pylint failed with controllers/mgr_modules.py:147:4: R0912: Too many branches (14/12) (too-many-branches)

@sebastian-philipp
sebastian-philipp force-pushed the dashboard-mgr-module-option-default-value-none-for-it-or-float branch from da3126b to bfcb93f Compare June 10, 2020 13:43
@sebastian-philipp
sebastian-philipp force-pushed the dashboard-mgr-module-option-default-value-none-for-it-or-float branch from bfcb93f to 4215ad5 Compare June 10, 2020 13:44
@tchaikov

This comment has been minimized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants