Skip to content

Instantly share code, notes, and snippets.

Created May 8, 2017 09:04
Show Gist options
  • Save anonymous/7bab3155b373b1a12d5d49281f982989 to your computer and use it in GitHub Desktop.
Save anonymous/7bab3155b373b1a12d5d49281f982989 to your computer and use it in GitHub Desktop.
def checkIfPTExists(pt_name)
hosts = %x( /usr/bin/hammer --output=json partition-table info --name "#{pt_name}" 2>/dev/null )
exists = false
if $?.exitstatus == 0
hosts = JSON.parse(hosts)
exists = true if hosts["Name"] == pt_name
end
puts exists
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment