mirror of
https://github.com/inspec/inspec
synced 2024-11-27 07:00:39 +00:00
supermarket tools get and filter by tool_type (#1254)
Signed-off-by: Alex Pop <apop@chef.io>
This commit is contained in:
parent
755f24ed6f
commit
d40ee684f8
1 changed files with 3 additions and 3 deletions
|
@ -11,11 +11,11 @@ module Supermarket
|
||||||
|
|
||||||
# displays a list of profiles
|
# displays a list of profiles
|
||||||
def self.profiles(supermarket_url = SUPERMARKET_URL)
|
def self.profiles(supermarket_url = SUPERMARKET_URL)
|
||||||
url = "#{supermarket_url}/api/v1/tools-search"
|
url = "#{supermarket_url}/api/v1/tools"
|
||||||
_success, data = get(url, { q: 'compliance_profile' })
|
_success, data = get(url, { start: 0, items: 100, order: 'recently_added' })
|
||||||
if !data.nil?
|
if !data.nil?
|
||||||
profiles = JSON.parse(data)
|
profiles = JSON.parse(data)
|
||||||
profiles['items'].map { |x|
|
profiles['items'].select { |p| p['tool_type'] == 'compliance_profile' }.map { |x|
|
||||||
m = %r{^#{supermarket_url}/api/v1/tools/(?<slug>[\w-]+)(/)?$}.match(x['tool'])
|
m = %r{^#{supermarket_url}/api/v1/tools/(?<slug>[\w-]+)(/)?$}.match(x['tool'])
|
||||||
x['slug'] = m[:slug]
|
x['slug'] = m[:slug]
|
||||||
x
|
x
|
||||||
|
|
Loading…
Reference in a new issue