more updates anc cleanups
This commit is contained in:
parent
ba55ab4338
commit
70eb194615
@ -13,6 +13,7 @@ class base {
|
|||||||
$pid_path = "/var/run"
|
$pid_path = "/var/run"
|
||||||
$log_path = "/var/log"
|
$log_path = "/var/log"
|
||||||
$local_path = $install_path
|
$local_path = $install_path
|
||||||
|
$share_path = "/usr/local/share"
|
||||||
}
|
}
|
||||||
|
|
||||||
node default {
|
node default {
|
||||||
|
@ -32,7 +32,6 @@ class nginx($version, $max_pool_size = 20) {
|
|||||||
restart => "${nginx_stop} ; ${nginx_start}",
|
restart => "${nginx_stop} ; ${nginx_start}",
|
||||||
pid_file => $pid_file,
|
pid_file => $pid_file,
|
||||||
ensure => present,
|
ensure => present,
|
||||||
notify => Service['god'],
|
|
||||||
require => Exec['install-passenger']
|
require => Exec['install-passenger']
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ class ruby($version, $configure = "--disable-install-doc", $build_path = '') {
|
|||||||
path => "${base::path}:${path}:${build_path}"
|
path => "${base::path}:${path}:${build_path}"
|
||||||
}
|
}
|
||||||
|
|
||||||
gem { [ 'bundler', 'penchant' ]:
|
gem { [ 'bundler', 'penchant', 'thor' ]:
|
||||||
require => Build_and_install[$name],
|
require => Build_and_install[$name],
|
||||||
path => $with_ruby_path,
|
path => $with_ruby_path,
|
||||||
ensure => present
|
ensure => present
|
||||||
|
@ -24,6 +24,10 @@ module Puppet
|
|||||||
def pid_path(pid_path, name)
|
def pid_path(pid_path, name)
|
||||||
File.join(pid_path, "#{name}.pid")
|
File.join(pid_path, "#{name}.pid")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def share_path(share_path, name)
|
||||||
|
File.join(share_path, name)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
module Puppet::Parser::Functions
|
module Puppet::Parser::Functions
|
||||||
newfunction(:share_path, :type => :rvalue) do |args|
|
newfunction(:share_path, :type => :rvalue) do |args|
|
||||||
File.join(lookupvar('base::share_path'), *args)
|
share_path(lookupvar('base::share_path'), *args)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -4,14 +4,18 @@ Puppet::Type.type(:download_and_unpack).provide(:action) do
|
|||||||
def create
|
def create
|
||||||
system %{bash -c 'cd #{@resource[:src_path]} ; (curl #{@resource[:url]} | tar #{tar_command} -)'}
|
system %{bash -c 'cd #{@resource[:src_path]} ; (curl #{@resource[:url]} | tar #{tar_command} -)'}
|
||||||
raise StandardError.new("Could not download") if $?.exitstatus != 0
|
raise StandardError.new("Could not download") if $?.exitstatus != 0
|
||||||
|
|
||||||
|
if original_name
|
||||||
|
system %{bash -c 'cd #{@resource[:src_path]} && mv #{original_name} #{target_dir}'}
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def destroy
|
def destroy
|
||||||
FileUtils.rm_rf dir
|
FileUtils.rm_rf target_dir
|
||||||
end
|
end
|
||||||
|
|
||||||
def exists?
|
def exists?
|
||||||
File.directory?(dir)
|
File.directory?(File.join(@resource[:src_path], target_dir))
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
@ -19,10 +23,18 @@ Puppet::Type.type(:download_and_unpack).provide(:action) do
|
|||||||
File.join(@resource[:src_path], File.basename(@resource[:url]))
|
File.join(@resource[:src_path], File.basename(@resource[:url]))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def target_dir
|
||||||
|
"#{@resource[:name]}-#{@resource[:version]}"
|
||||||
|
end
|
||||||
|
|
||||||
def dir
|
def dir
|
||||||
file.gsub(%r{\.tar\.(gz|bz2)$}, '')
|
file.gsub(%r{\.tar\.(gz|bz2)$}, '')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def original_name
|
||||||
|
(@resource[:original_name] || '').empty? ? nil : @resource[:original_name]
|
||||||
|
end
|
||||||
|
|
||||||
def tar_command
|
def tar_command
|
||||||
case @resource[:url]
|
case @resource[:url]
|
||||||
when /\.gz/
|
when /\.gz/
|
||||||
|
@ -18,5 +18,9 @@ Puppet::Type.newtype(:download_and_unpack) do
|
|||||||
newparam(:version) do
|
newparam(:version) do
|
||||||
desc "The version to install"
|
desc "The version to install"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
newparam(:original_name) do
|
||||||
|
desc "The directory name that the software unpacks as"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
define build_and_install($version, $source, $path = '', $configure = '', $config_status = 'config.status') {
|
define build_and_install($version, $original_name = '', $source, $path = '', $configure = '', $config_status = 'config.status') {
|
||||||
$full_source = inline_template($source)
|
$full_source = inline_template($source)
|
||||||
|
|
||||||
$build_path = build_path($name, $version)
|
$build_path = build_path($name, $version)
|
||||||
@ -8,6 +8,8 @@ define build_and_install($version, $source, $path = '', $configure = '', $config
|
|||||||
download_and_unpack { $name:
|
download_and_unpack { $name:
|
||||||
url => $full_source,
|
url => $full_source,
|
||||||
src_path => $base::src_path,
|
src_path => $base::src_path,
|
||||||
|
original_name => $original_name,
|
||||||
|
version => $version,
|
||||||
ensure => present
|
ensure => present
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user