Sha256: b36141bd73586d21e067dfd39e24770227f3f8a9f300c6c9c8b9e8a02a3bb334
Contents?: true
Size: 1.21 KB
Versions: 2
Compression:
Stored size: 1.21 KB
Contents
require 'itamae' module Itamae module Resource class Package < Base define_attribute :action, default: :install define_attribute :name, type: String, default_name: true define_attribute :version, type: String define_attribute :options, type: String def set_current_attributes installed = run_specinfra(:check_package_is_installed, name) @current_attributes[:installed?] = installed if installed @current_attributes[:version] = run_specinfra(:get_package_version, name).stdout.strip end if action == :install @attributes[:installed?] = true end end def install_action unless run_specinfra(:check_package_is_installed, name, version) if %w!ubuntu debian!.include?(backend.os[:family]) # TODO: delegate to Specinfra package_name = name package_name += "=#{version}" if version run_command("DEBIAN_FRONTEND='noninteractive' apt-get -y #{options} install #{shell_escape(package_name)}") updated! else run_specinfra(:install_package, name, version) updated! end end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
itamae-1.0.0.beta29 | lib/itamae/resource/package.rb |
itamae-1.0.0.beta28 | lib/itamae/resource/package.rb |