From bd2f2fc3a01bc86630d277c100befde63c114187 Mon Sep 17 00:00:00 2001 From: Josef Stribny Date: Tue, 12 May 2015 16:30:42 +0200 Subject: [PATCH] Add Atomic guest support --- plugins/guests/atomic/cap/change_host_name.rb | 11 ++++++++ plugins/guests/atomic/cap/docker.rb | 11 ++++++++ plugins/guests/atomic/guest.rb | 11 ++++++++ plugins/guests/atomic/plugin.rb | 25 +++++++++++++++++++ 4 files changed, 58 insertions(+) create mode 100644 plugins/guests/atomic/cap/change_host_name.rb create mode 100644 plugins/guests/atomic/cap/docker.rb create mode 100644 plugins/guests/atomic/guest.rb create mode 100644 plugins/guests/atomic/plugin.rb diff --git a/plugins/guests/atomic/cap/change_host_name.rb b/plugins/guests/atomic/cap/change_host_name.rb new file mode 100644 index 000000000..aecec88e2 --- /dev/null +++ b/plugins/guests/atomic/cap/change_host_name.rb @@ -0,0 +1,11 @@ +module VagrantPlugins + module GuestAtomic + module Cap + class ChangeHostName + def self.change_host_name(machine, name) + machine.communicate.sudo("hostnamectl set-hostname #{name}") + end + end + end + end +end diff --git a/plugins/guests/atomic/cap/docker.rb b/plugins/guests/atomic/cap/docker.rb new file mode 100644 index 000000000..55052c8a7 --- /dev/null +++ b/plugins/guests/atomic/cap/docker.rb @@ -0,0 +1,11 @@ +module VagrantPlugins + module GuestAtomic + module Cap + module Docker + def self.docker_daemon_running(machine) + machine.communicate.test("test -S /run/docker.sock") + end + end + end + end +end diff --git a/plugins/guests/atomic/guest.rb b/plugins/guests/atomic/guest.rb new file mode 100644 index 000000000..3fbb439db --- /dev/null +++ b/plugins/guests/atomic/guest.rb @@ -0,0 +1,11 @@ +require "vagrant" + +module VagrantPlugins + module GuestAtomic + class Guest < Vagrant.plugin("2", :guest) + def detect?(machine) + machine.communicate.test("grep 'ostree=' /proc/cmdline") + end + end + end +end diff --git a/plugins/guests/atomic/plugin.rb b/plugins/guests/atomic/plugin.rb new file mode 100644 index 000000000..a410ed2fc --- /dev/null +++ b/plugins/guests/atomic/plugin.rb @@ -0,0 +1,25 @@ +require 'vagrant' + +module VagrantPlugins + module GuestAtomic + class Plugin < Vagrant.plugin("2") + name "Atomic Host guest" + description "Atomic Host guest support." + + guest("atomic", "fedora") do + require File.expand_path("../guest", __FILE__) + Guest + end + + guest_capability("atomic", "change_host_name") do + require_relative "cap/change_host_name" + Cap::ChangeHostName + end + + guest_capability("atomic", "docker_daemon_running") do + require_relative "cap/docker" + Cap::Docker + end + end + end +end