Move plugins-related tasks from nailgun to library
All plugins-related hardcoded tasks was dropped from nailgun code, so recreate them in library side. Change-Id: Icfb08104d31aeea7d5d14c8efacdf9cf8731c1da Closes-Bug: #1565061
This commit is contained in:
parent
fa99880763
commit
4fa000c39e
|
@ -0,0 +1,30 @@
|
|||
module Puppet::Parser::Functions
|
||||
newfunction(
|
||||
:generate_plugins_repos,
|
||||
:type => :rvalue,
|
||||
:arity => 1,
|
||||
:docs => <<-EOS
|
||||
Transforms plugins array provided by astute.yaml to a form easily
|
||||
usable with create_resources and the puppetlabs/apt's apt::source type.
|
||||
EOS
|
||||
) do |args|
|
||||
plugins = args[0]
|
||||
|
||||
raise(Puppet::ParseError, "generate_plugins_repos(): Requires array to " +
|
||||
"work with") unless plugins.is_a?(Array)
|
||||
|
||||
result = {}
|
||||
|
||||
plugins.each do |plugin|
|
||||
plugin['repositories'].each do |repo|
|
||||
result.store repo['name'], {
|
||||
'repos' => repo['section'],
|
||||
'release' => repo['suite'],
|
||||
'location' => repo['uri'],
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
return result
|
||||
end
|
||||
end
|
|
@ -0,0 +1,30 @@
|
|||
module Puppet::Parser::Functions
|
||||
newfunction(
|
||||
:generate_plugins_rsync,
|
||||
:type => :rvalue,
|
||||
:arity => 1,
|
||||
:docs => <<-EOS
|
||||
Transforms plugins array provided by astute.yaml to a form easily
|
||||
usable with create_resources and the puppetlabs/rsync's rsync::get type.
|
||||
EOS
|
||||
) do |args|
|
||||
plugins = args[0]
|
||||
|
||||
raise(Puppet::ParseError, "generate_plugins_rsync(): Requires array to " +
|
||||
"work with") unless plugins.is_a?(Array)
|
||||
|
||||
result = {}
|
||||
|
||||
plugins.each do |plugin|
|
||||
plugin['scripts'].each do |script|
|
||||
result.store script['local_path'], {
|
||||
'path' => script['local_path'],
|
||||
'source' => script['remote_url'],
|
||||
'recursive' => 'true',
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
return result
|
||||
end
|
||||
end
|
|
@ -0,0 +1,17 @@
|
|||
class osnailyfacter::plugins::plugins_rsync {
|
||||
|
||||
notice('MODULAR: plugins/plugins_rsync.pp')
|
||||
|
||||
$plugins = hiera('plugins', {})
|
||||
$rsync_data = generate_plugins_rsync($plugins)
|
||||
|
||||
if ! empty($rsync_data) {
|
||||
file { '/etc/fuel/plugins/':
|
||||
ensure => directory,
|
||||
}
|
||||
|
||||
create_resources(rsync::get, $rsync_data)
|
||||
}
|
||||
|
||||
File <| |> -> Rsync::Get <| |>
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
class osnailyfacter::plugins::plugins_setup_repositories {
|
||||
|
||||
notice('MODULAR: plugins/plugins_setup_repositories.pp')
|
||||
|
||||
$plugins = hiera('plugins')
|
||||
|
||||
if $::osfamily == 'Debian' {
|
||||
include ::apt
|
||||
|
||||
$repositories = generate_plugins_repos($plugins)
|
||||
|
||||
if ! empty($repositories) {
|
||||
create_resources(apt::source, $repositories)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
include ::osnailyfacter::plugins::plugins_rsync
|
|
@ -0,0 +1 @@
|
|||
include ::osnailyfacter::plugins::plugins_setup_repositories
|
|
@ -0,0 +1,25 @@
|
|||
- id: plugins_rsync
|
||||
type: puppet
|
||||
version: 2.1.0
|
||||
groups: ['/.*/']
|
||||
requires: [pre_deployment_start, configuration_symlink]
|
||||
required_for: [pre_deployment_end]
|
||||
condition:
|
||||
yaql_exp: &have_plugins "changed($.plugins) and (len($.plugins) > 0)"
|
||||
parameters:
|
||||
puppet_manifest: /etc/puppet/modules/osnailyfacter/modular/plugins/plugins_rsync.pp
|
||||
puppet_modules: /etc/puppet/modules
|
||||
timeout: 600
|
||||
|
||||
- id: plugins_setup_repositories
|
||||
type: puppet
|
||||
version: 2.1.0
|
||||
groups: ['/.*/']
|
||||
requires: [pre_deployment_start, plugins_rsync]
|
||||
required_for: [pre_deployment_end]
|
||||
condition:
|
||||
yaql_exp: *have_plugins
|
||||
parameters:
|
||||
puppet_manifest: /etc/puppet/modules/osnailyfacter/modular/plugins/plugins_setup_repositories.pp
|
||||
puppet_modules: /etc/puppet/modules
|
||||
timeout: 600
|
|
@ -0,0 +1,27 @@
|
|||
# RUN: neut_tun.ceph.murano.sahara.ceil-mongo ubuntu
|
||||
# RUN: neut_tun.ceph.murano.sahara.ceil-primary-mongo ubuntu
|
||||
# RUN: neut_vlan.murano.sahara.ceil-mongo ubuntu
|
||||
# RUN: neut_vlan.murano.sahara.ceil-primary-mongo ubuntu
|
||||
# RUN: neut_vlan.murano.sahara.ceil-cinder ubuntu
|
||||
# RUN: neut_tun.ironic-ironic ubuntu
|
||||
# RUN: neut_tun.ceph.murano.sahara.ceil-ceph-osd ubuntu
|
||||
# RUN: neut_vlan.ceph-ceph-osd ubuntu
|
||||
# RUN: neut_tun.ceph.murano.sahara.ceil-controller ubuntu
|
||||
# RUN: neut_tun.ceph.murano.sahara.ceil-primary-controller ubuntu
|
||||
# RUN: neut_tun.ironic-primary-controller ubuntu
|
||||
# RUN: neut_tun.l3ha-primary-controller ubuntu
|
||||
# RUN: neut_vlan.ceph-primary-controller ubuntu
|
||||
# RUN: neut_vlan.dvr-primary-controller ubuntu
|
||||
# RUN: neut_vlan.murano.sahara.ceil-controller ubuntu
|
||||
# RUN: neut_vlan.murano.sahara.ceil-primary-controller ubuntu
|
||||
# RUN: neut_tun.ceph.murano.sahara.ceil-compute ubuntu
|
||||
# RUN: neut_vlan.ceph-compute ubuntu
|
||||
# RUN: neut_vlan.murano.sahara.ceil-compute ubuntu
|
||||
# R_N: neut_gre.generate_vms ubuntu
|
||||
require 'spec_helper'
|
||||
require 'shared-examples'
|
||||
manifest = 'plugins/plugins_rsync.pp'
|
||||
|
||||
describe manifest do
|
||||
test_ubuntu manifest
|
||||
end
|
|
@ -0,0 +1,27 @@
|
|||
# RUN: neut_tun.ceph.murano.sahara.ceil-mongo ubuntu
|
||||
# RUN: neut_tun.ceph.murano.sahara.ceil-primary-mongo ubuntu
|
||||
# RUN: neut_vlan.murano.sahara.ceil-mongo ubuntu
|
||||
# RUN: neut_vlan.murano.sahara.ceil-primary-mongo ubuntu
|
||||
# RUN: neut_vlan.murano.sahara.ceil-cinder ubuntu
|
||||
# RUN: neut_tun.ironic-ironic ubuntu
|
||||
# RUN: neut_tun.ceph.murano.sahara.ceil-ceph-osd ubuntu
|
||||
# RUN: neut_vlan.ceph-ceph-osd ubuntu
|
||||
# RUN: neut_tun.ceph.murano.sahara.ceil-controller ubuntu
|
||||
# RUN: neut_tun.ceph.murano.sahara.ceil-primary-controller ubuntu
|
||||
# RUN: neut_tun.ironic-primary-controller ubuntu
|
||||
# RUN: neut_tun.l3ha-primary-controller ubuntu
|
||||
# RUN: neut_vlan.ceph-primary-controller ubuntu
|
||||
# RUN: neut_vlan.dvr-primary-controller ubuntu
|
||||
# RUN: neut_vlan.murano.sahara.ceil-controller ubuntu
|
||||
# RUN: neut_vlan.murano.sahara.ceil-primary-controller ubuntu
|
||||
# RUN: neut_tun.ceph.murano.sahara.ceil-compute ubuntu
|
||||
# RUN: neut_vlan.ceph-compute ubuntu
|
||||
# RUN: neut_vlan.murano.sahara.ceil-compute ubuntu
|
||||
# R_N: neut_gre.generate_vms ubuntu
|
||||
require 'spec_helper'
|
||||
require 'shared-examples'
|
||||
manifest = 'plugins/plugins_setup_repositories.pp'
|
||||
|
||||
describe manifest do
|
||||
test_ubuntu manifest
|
||||
end
|
Loading…
Reference in New Issue