Last active
          July 4, 2021 12:49 
        
      - 
      
- 
        Save ixs/d91c71e679ce3d459a68a3f566f11dfd to your computer and use it in GitHub Desktop. 
Revisions
- 
        ixs revised this gist Jul 4, 2021 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewingThis 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 charactersOriginal file line number Diff line number Diff line change @@ -6,7 +6,7 @@ # Similar functionality was added in https://github.com/saltstack/salt/pull/59682 # but has not been released yet. # # To install, drop this code into /svc/salt/_grains/ and run # `salt '*' saltutil.sync_all` _OS_FAMILY_MAP = {"Rocky Linux": "RedHat"} 
- 
        ixs created this gist Jul 4, 2021 .There are no files selected for viewingThis 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,28 @@ #!/usr/bin/env python3 # Override os_family grain to ensure Rocky Linux is seen # as part of the RedHat OS family. # # Similar functionality was added in https://github.com/saltstack/salt/pull/59682 # but has not been released yet. # # To install, drop this code into /src/salt/_grains/ and run # `salt '*' saltutil.sync_all` _OS_FAMILY_MAP = {"Rocky Linux": "RedHat"} def main(): os_data = {} with open("/etc/os-release", "r") as f: for line in f.readlines(): try: k, v = line.strip().split("=", 1) os_data.update({k: v.replace('"', '')}) except ValueError: continue if os_data["NAME"] in _OS_FAMILY_MAP: return {"os_family": _OS_FAMILY_MAP[os_data["NAME"]]} if __name__ == "__main__": print(main())