What relevance do you have so far? There are lots of ways to write this check. In an analysis, you could do something like
exists lines containing "https://www.elrepo.org/RPM-GPG-KEY-elrepo.org" of file "/etc/yum.conf"
That would return True if that file had that string and False if it didn’t. It would return an error if the file “/etc/yum.conf” didn’t exist. If you don’t care whether the file exists or not, you just want a True/False, you could modify it slightly to so file
became files
exists lines containing "https://www.elrepo.org/RPM-GPG-KEY-elrepo.org" of files "/etc/yum.conf"
That will return True if the string exists, and False if the file exists and doesn’t contain the string, or if the file doesn’t exist in the first place. There’s probably a better way to write it, though:
exists file "/etc/yum.conf" whose (exists lines containing "https://www.elrepo.org/RPM-GPG-KEY-elrepo.org" of it)
They are slightly different approaches – both accomplish the same thing, but this one is less error-prone if you forget a plural.
Since you are trying to use this in a fixlet, we have to get it in a state where the “undesired” state returns True and the “desired” state returns False. We can accomplish this in a couple ways:
not exists file "/etc/yum.conf" whose (exists lines containing "https://www.elrepo.org/RPM-GPG-KEY-elrepo.org" of it)
This is saying “is it true that there is NOT a file /etc/yum.conf with those lines?” It will be True if the file exists and doesn’t have those lines, OR if the file does not exist in the first place. If you only want it to return true if the file exists, but just doesn’t contain the line you want, you can do:
exists file "/etc/yum.conf" whose (not exists lines containing "https://www.elrepo.org/RPM-GPG-KEY-elrepo.org" of it)
That will only return True if the file exists, but it does not contain the line you care about.