Skip to content

[hostcfgd] Get service enable/disable feature working#4676

Merged
lguohan merged 2 commits intosonic-net:masterfrom
jleveque:use_systemctl_mask
Jun 2, 2020
Merged

[hostcfgd] Get service enable/disable feature working#4676
lguohan merged 2 commits intosonic-net:masterfrom
jleveque:use_systemctl_mask

Conversation

@jleveque
Copy link
Copy Markdown
Contributor

@jleveque jleveque commented May 31, 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.

Copy link
Copy Markdown
Contributor

@prsunny prsunny left a comment

Choose a reason for hiding this comment

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

lgtm

@lguohan lguohan merged commit eff8a89 into sonic-net:master Jun 2, 2020
@jleveque jleveque deleted the use_systemctl_mask branch June 2, 2020 16:00
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.
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