Fix check_cmd behavior for file.managed state

Resolves #16926.
Merge pull request #17008 from terminalmage/issue16926

Fix check_cmd behavior for file.managed state