diff --git a/src/sonic-host-services/scripts/hostcfgd b/src/sonic-host-services/scripts/hostcfgd index 95c8e122140..b178f265142 100755 --- a/src/sonic-host-services/scripts/hostcfgd +++ b/src/sonic-host-services/scripts/hostcfgd @@ -180,6 +180,7 @@ class FeatureHandler(object): disable = feature.state in ("always_disabled", "disabled") elif cached_feature.state in ("always_enabled", "always_disabled"): disable = feature.state == "always_disabled" + enable = feature.state == "always_enabled" elif cached_feature.state in ("enabled", "disabled"): enable = feature.state == "enabled" disable = feature.state == "disabled" diff --git a/src/sonic-host-services/tests/hostcfgd/test_vectors.py b/src/sonic-host-services/tests/hostcfgd/test_vectors.py index f70e4a11c45..aaba66b64e4 100644 --- a/src/sonic-host-services/tests/hostcfgd/test_vectors.py +++ b/src/sonic-host-services/tests/hostcfgd/test_vectors.py @@ -146,6 +146,15 @@ "state": "enabled", "status": "enabled" }, + "sflow": { + "auto_restart": "enabled", + "has_global_scope": "True", + "has_per_asic_scope": "False", + "has_timer": "False", + "high_mem_alert": "disabled", + "set_owner": "local", + "state": "always_enabled" + }, }, }, "expected_config_db": { @@ -178,6 +187,15 @@ "state": "enabled", "status": "enabled" }, + "sflow": { + "auto_restart": "enabled", + "has_global_scope": "True", + "has_per_asic_scope": "False", + "has_timer": "False", + "high_mem_alert": "disabled", + "set_owner": "local", + "state": "always_enabled" + }, }, }, "expected_subprocess_calls": [ @@ -188,6 +206,9 @@ call("sudo systemctl unmask telemetry.timer", shell=True), call("sudo systemctl enable telemetry.timer", shell=True), call("sudo systemctl start telemetry.timer", shell=True), + call("sudo systemctl unmask sflow.service", shell=True), + call("sudo systemctl enable sflow.service", shell=True), + call("sudo systemctl start sflow.service", shell=True), ], "popen_attributes": { 'communicate.return_value': ('output', 'error')