Sha256: ba0ac6c5ce5921401f65d7c7bb43a8f6ce0423177deba5d642bff31e9df52d82
Contents?: true
Size: 1.96 KB
Versions: 1
Compression:
Stored size: 1.96 KB
Contents
# encoding: UTF-8 # Copyright (c) 2019 António Meireles. All Rights Reserved. require 'vagrant' module VagrantPlugins module GuestClearLinux class BundlesConfig < Vagrant.plugin('2', :config) attr_accessor :bundles def initialize super @bundles = UNSET_VALUE end def finalize! @bundles = [] if @bundles == UNSET_VALUE end def bundles=(bundles) if bundles.kind_of?(Array) @bundles = Array.new(bundles) else @bundles = [ bundles ] end end end class BundleAddProvisioner < Vagrant.plugin('2', :provisioner) def provision @config.bundles.each do | item | @machine.ui.detail("installing '#{item}' bundle") @machine.communicate.sudo("swupd bundle-add '#{item}'") do |type, data| if [:stderr, :stdout].include?(type) color = type == :stdout ? :green : :red data = data.chomp break if data.empty? options = {} options[:color] = color @machine.ui.detail(data.chomp, options) end end # XXX: to avoid (!) ... # 'Error: cannot acquire lock file. Another swupd process is already running (possibly auto-update).' sleep 2 end end end class BundleRemoveProvisioner < Vagrant.plugin('2', :provisioner) def provision @config.bundles.each do | item | @machine.ui.detail("removing '#{item}' bundle") @machine.communicate.sudo("swupd bundle-remove '#{item}'") do |type, data| if [:stderr, :stdout].include?(type) color = type == :stdout ? :green : :red data = data.chomp break if data.empty? options = {} options[:color] = color @machine.ui.detail(data.chomp, options) end end sleep 2 end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
vagrant-guests-clearlinux-1.1.1 | lib/vagrant-guests-clearlinux/provisioner.rb |