539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
|
# File 'lib/onceover/controlrepo.rb', line 539
def self.generate_nodesets(repo)
warn "[DEPRECATION] #{__method__} is deprecated due to the removal of Beaker"
require 'onceover/beaker'
require 'multi_json'
require 'net/http'
hosts_hash = {}
repo.facts.each do |fact_set|
node_name = File.basename(repo.facts_files[repo.facts.index(fact_set)], '.json')
boxname = Onceover::Beaker.facts_to_vagrant_box(fact_set)
platform = Onceover::Beaker.facts_to_platform(fact_set)
logger.debug "Querying hashicorp API for Vagrant box that matches #{boxname}"
uri = URI("https://atlas.hashicorp.com:443/api/v1/box/#{boxname}")
request = Net::HTTP.new(uri.host, uri.port)
request.use_ssl = true
response = request.get(uri)
url = 'URL goes here'
if response.code == "404"
= true
else
= false
box_info = MultiJson.load(response.body)
box_info['current_version']['providers'].each do |provider|
if provider['name'] == 'virtualbox'
url = provider['original_url']
end
end
end
hosts_hash[node_name] = {
:platform => platform,
:boxname => boxname,
:url => url,
:comment_out =>
}
end
evaluate_template('nodeset.yaml.erb', binding)
end
|