[hostcfgd] Get service enable/disable feature working#4676
Merged
lguohan merged 2 commits intosonic-net:masterfrom Jun 2, 2020
jleveque:use_systemctl_mask
Merged
[hostcfgd] Get service enable/disable feature working#4676lguohan merged 2 commits intosonic-net:masterfrom jleveque:use_systemctl_mask
lguohan merged 2 commits intosonic-net:masterfrom
jleveque:use_systemctl_mask
Conversation
prsunny
reviewed
Jun 1, 2020
abdosi
pushed a commit
that referenced
this pull request
Jun 16, 2020
Fix hostcfgd so that changes to the "FEATURE" table in ConfigDB are properly handled. Three changes here: 1. Fix indenting such that the handling of each key actually occurs in the for key in status_data.keys(): loop 2. Add calls to sudo systemctl mask and sudo systemctl unmask as appropriate to ensure changes persist across reboots 3. Substitute returns with continues so that even if one service fails, we still try to handle the others Note that the masking is persistent, even if the configuration is not saved. We may want to consider only calling systemctl enable/disable in hostcfgd when the DB table changes, and only call systemctl mask/unmask upon calling config save.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix hostcfgd so that changes to the "FEATURE" table in ConfigDB are properly handled. Three changes here:
for key in status_data.keys():loopsudo systemctl maskandsudo systemctl unmaskas appropriate to ensure changes persist across rebootsreturns withcontinues so that even if one service fails, we still try to handle the othersNote that the masking is persistent, even if the configuration is not saved. We may want to consider only calling
systemctl enable/disablein hostcfgd when the DB table changes, and only callsystemctl mask/unmaskupon callingconfig save.