parent
e925f3793a
commit
c8ceb06f6d
|
@ -0,0 +1,14 @@
|
|||
module VagrantPlugins
|
||||
module GuestAmazon
|
||||
module Cap
|
||||
class Flavor
|
||||
def self.flavor(machine)
|
||||
# Amazon AMI is a frankenstien RHEL, mainly based on 6
|
||||
# Maybe in the future if they incoporate RHEL 7 elements
|
||||
# this should be extended to read /etc/os-release or similar
|
||||
return :rhel
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,9 @@
|
|||
module VagrantPlugins
|
||||
module GuestAmazon
|
||||
class Guest < Vagrant.plugin("2", :guest)
|
||||
def detect?(machine)
|
||||
machine.communicate.test("grep 'Amazon Linux AMI' /etc/os-release")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,20 @@
|
|||
require "vagrant"
|
||||
|
||||
module VagrantPlugins
|
||||
module GuestAmazon
|
||||
class Plugin < Vagrant.plugin("2")
|
||||
name "Amazon Linux guest"
|
||||
description "Amazon linux guest support."
|
||||
|
||||
guest(:amazon, :redhat) do
|
||||
require_relative "guest"
|
||||
Guest
|
||||
end
|
||||
|
||||
guest_capability(:amazon, :flavor) do
|
||||
require_relative "cap/flavor"
|
||||
Cap::Flavor
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,19 @@
|
|||
require_relative "../../../../base"
|
||||
|
||||
describe "VagrantPlugins::GuestAmazon::Cap::Flavor" do
|
||||
let(:caps) do
|
||||
VagrantPlugins::GuestAmazon::Plugin
|
||||
.components
|
||||
.guest_capabilities[:amazon]
|
||||
end
|
||||
|
||||
let(:machine) { double("machine") }
|
||||
|
||||
describe ".flavor" do
|
||||
let(:cap) { caps.get(:flavor) }
|
||||
|
||||
it "returns rhel" do
|
||||
expect(cap.flavor(machine)).to be(:rhel)
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue