Method: Compliance::API.exist?

Defined in:
lib/bundles/inspec-compliance/api.rb

.exist?(config, profile) ⇒ Boolean

verifies that a profile

Returns:

  • (Boolean)


90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
# File 'lib/bundles/inspec-compliance/api.rb', line 90

def self.exist?(config, profile)
  owner, id, ver = profile_split(profile)

  # ensure that we do not manipulate the configuration object

  user_config = config.dup
  user_config['owner'] = owner
  _msg, profiles = Compliance::API.profiles(user_config)

  if !profiles.empty?
    profiles.any? do |p|
      p['owner_id'] == owner &&
        p['name'] == id &&
        (ver.nil? || p['version'] == ver)
    end
  else
    false
  end
end