Class: Bixby::Provision::Packager::Yum
- Inherits:
-
PackagerBase
show all
- Defined in:
- lib/bixby/provision/dsl/packager/yum.rb,
lib/bixby/provision/dsl/packager/yum/epel.rb,
lib/bixby/provision/dsl/packager/yum/mongodb.rb
Defined Under Namespace
Modules: EPEL, MongoDB
Constant Summary
collapse
- YUM_REPOS_D =
"/etc/yum.repos.d/"
- REPOS =
{}
Constants inherited
from Base
Base::PATH
Instance Attribute Summary
Attributes inherited from Base
#manifest, #proxy
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Base
#get_gid, #get_group, #get_uid, #get_user, #initialize, #tap
Methods included from Util::File
#chmod, #chown, #sha256sum, #which
Class Method Details
.register_plugin(mod, method = nil, name = nil) ⇒ Object
12
13
14
15
16
17
18
19
20
21
22
|
# File 'lib/bixby/provision/dsl/packager/yum.rb', line 12
def self.register_plugin(mod, method=nil, name=nil)
if name.nil? then
name = mod.name.split(/::/).last.downcase
end
if method.nil? then
method = "install_#{name}".to_sym
end
logger.debug "[yum] registered plugin: #{name}"
REPOS[name] = method
include(mod)
end
|
Instance Method Details
#install(*packages) ⇒ Object
42
43
44
45
46
47
48
49
50
51
|
# File 'lib/bixby/provision/dsl/packager/yum.rb', line 42
def install(*packages)
packages.flatten!
installed = query_installed_packages(packages)
needed = packages.find_all{ |s| !installed.include? s }
return if needed.empty?
logged_sudo("yum -q -y install " + needed.join(" "))
end
|
#install_repo(name, opts = {}) ⇒ Object
33
34
35
36
37
38
39
40
|
# File 'lib/bixby/provision/dsl/packager/yum.rb', line 33
def install_repo(name, opts={})
name.downcase!
if REPOS.include? name then
return self.send(REPOS[name], opts)
elsif name =~ /^https?.*\.repo$/ then
return install_repo_url(name, opts)
end
end
|
#installed?(package) ⇒ Boolean
53
54
55
|
# File 'lib/bixby/provision/dsl/packager/yum.rb', line 53
def installed?(package)
query_installed_packages(package).include? package
end
|
#refresh ⇒ Object
24
25
26
27
|
# File 'lib/bixby/provision/dsl/packager/yum.rb', line 24
def refresh
sudo("yum -q clean all")
sudo("yum -q -y check-update")
end
|
#upgrade_system ⇒ Object
29
30
31
|
# File 'lib/bixby/provision/dsl/packager/yum.rb', line 29
def upgrade_system
logged_sudo('yum -q -y upgrade')
end
|