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

mgr/dashboard: dashboard help command showing wrong syntax for login-banner #46765

Merged
merged 1 commit into from Jun 22, 2022

Conversation

Sarthak0702
Copy link
Member

@Sarthak0702 Sarthak0702 commented Jun 21, 2022

Fixes: https://tracker.ceph.com/issues/56137
Signed-off-by: Sarthak0702 sarthak.dev.0702@gmail.com

Contribution Guidelines

Checklist

  • Tracker (select at least one)
    • References tracker ticket
    • Very recent bug; references commit where it was introduced
    • New feature (ticket optional)
    • Doc update (no ticket needed)
    • Code cleanup (no ticket needed)
  • Component impact
    • Affects Dashboard, opened tracker ticket
    • Affects Orchestrator, opened tracker ticket
    • No impact that needs to be tracked
  • Documentation (select at least one)
    • Updates relevant documentation
    • No doc update is appropriate
  • Tests (select at least one)
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 cephadm
  • jenkins test api
  • jenkins test docs
  • jenkins render docs
  • jenkins test ceph-volume all
  • jenkins test ceph-volume tox
  • jenkins test windows

@Sarthak0702 Sarthak0702 requested a review from a team as a code owner June 21, 2022 09:53
@Sarthak0702 Sarthak0702 requested review from bryanmontalvan, nizamial09, sunilangadi2, pereman2 and epuertat and removed request for a team June 21, 2022 09:53
@Sarthak0702 Sarthak0702 added this to In progress in Dashboard via automation Jun 21, 2022
Dashboard automation moved this from In progress to Reviewer approved Jun 21, 2022
src/pybind/mgr/dashboard/module.py Outdated Show resolved Hide resolved
Comment on lines 12 to 13
def set_login_banner_mgr(inbuf: str):
mgr.set_store(ITEM_KEY, inbuf)
Copy link
Member

Choose a reason for hiding this comment

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

These services look more anemic now. What about removing this file and moving this code inside the CLI commands (encapsulating service logic makes sense when it's complex, but in this case it's almost trivial: the service itself is provided by the mgr.set|get_store).

Copy link
Member Author

Choose a reason for hiding this comment

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

I remember this was your concern in the original PR too. And I vouched for code duplication. But now I too feel this doesn't need a separate file.



def get_login_banner_mgr():
banner_text = mgr.get_store('custom_login_banner')
banner_text = mgr.get_store(ITEM_KEY)
logger.info('Reading custom login banner: %s', banner_text)
Copy link
Member

Choose a reason for hiding this comment

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

BTW this should better be a debug trace (info level is usually kept for operator meaningful events: service restarts, etc.,).

Copy link
Member Author

Choose a reason for hiding this comment

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

ahh thats correct will update that too.

def set_login_banner_mgr(inbuf: str, mgr_id: Optional[str] = None):
item_key = 'custom_login_banner'
if mgr_id is not None:
mgr.set_store(_get_localized_key(mgr_id, item_key), inbuf)
Copy link
Member

Choose a reason for hiding this comment

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

And yes, the localized here didn't make any sense (show a different message per mgr instance?).

Copy link
Member Author

Choose a reason for hiding this comment

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

Yup, I confirmed this with @pereman2. We agreed different message per mgr instance was not required probably.

…banner

Signed-off-by: Sarthak0702 <sarthak.dev.0702@gmail.com>
@epuertat epuertat merged commit 873dd32 into ceph:main Jun 22, 2022
13 checks passed
Dashboard automation moved this from Reviewer approved to Done Jun 22, 2022
@epuertat epuertat deleted the login-banner-cli-bug branch June 22, 2022 11:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Dashboard
  
Done
3 participants