Add patch to fix dependencies handling on custom provider
This patch adds a new Puppet.feature called faraday based on this: https://projects.puppetlabs.com/issues/14822 , which allows to make dependencies available during the puppet run to be used by the custom providers/types without needing successive runs or failing catalog compilation. Change-Id: I1f84aa3133605abb38d697c1a593216aafe3e7ef
This commit is contained in:
parent
aed06df979
commit
2223cc9df6
@ -2,3 +2,9 @@
|
||||
# Repository-based attributes
|
||||
midonet::repository::midonet_openstack_repo: 'http://repo.midonet.org/openstack-juno/RHEL'
|
||||
midonet::repository::openstack_release: 'juno'
|
||||
# Temporary source for faraday package and dependencies until it gets included
|
||||
# in EPEL repositories
|
||||
midonet::faraday_package: 'ruby193-rubygem-faraday'
|
||||
midonet::faraday_url: 'http://yum.theforeman.org/nightly/el7/x86_64/ruby193-rubygem-faraday-0.9.1-1.el7.noarch.rpm'
|
||||
midonet::multipart_post_package: 'ruby193-rubygem-multipart-post'
|
||||
midonet::multipart_post_url: 'http://yum.theforeman.org/nightly/el7/x86_64/ruby193-rubygem-multipart-post-1.2.0-2.el7.noarch.rpm'
|
||||
|
@ -6,6 +6,8 @@ midonet::repository::midonet_repo: 'http://repo.midonet.org/midonet/v2015.06/RHE
|
||||
midonet::repository::midonet_thirdparty_repo: 'http://repo.midonet.org/misc/RHEL'
|
||||
midonet::repository::midonet_stage: 'stable'
|
||||
midonet::repository::midonet_key_url: 'http://repo.midonet.org/packages.midokura.key'
|
||||
midonet::repository::midonet_openstack_repo: 'http://repo.midonet.org/openstack-juno/RHEL'
|
||||
midonet::repository::openstack_release: 'juno'
|
||||
|
||||
# Midonet Host Agent-based attributes
|
||||
midonet::midonet_agent::zk_servers:
|
||||
@ -32,3 +34,10 @@ midonet::neutron_plugin::project_id: 'service'
|
||||
midonet::cassandra::pid_dir: '/var/run/cassandra'
|
||||
midonet::cassandra::conf_dir: '/etc/cassandra/default.conf'
|
||||
midonet::cassandra::service_path: '/sbin'
|
||||
|
||||
# Temporary source for faraday package and dependencies until it gets included
|
||||
# in EPEL repositories
|
||||
midonet::faraday_package: 'ruby193-rubygem-faraday'
|
||||
midonet::faraday_url: 'http://yum.theforeman.org/nightly/el7/x86_64/ruby193-rubygem-faraday-0.9.1-1.el7.noarch.rpm'
|
||||
midonet::multipart_post_package: 'ruby193-rubygem-multipart-post'
|
||||
midonet::multipart_post_url: 'http://yum.theforeman.org/nightly/el7/x86_64/ruby193-rubygem-multipart-post-1.2.0-2.el7.noarch.rpm'
|
||||
|
1
lib/puppet/feature/faraday.rb
Normal file
1
lib/puppet/feature/faraday.rb
Normal file
@ -0,0 +1 @@
|
||||
Puppet.features.add(:faraday, :libs => ["faraday"])
|
@ -3,11 +3,13 @@ if RUBY_VERSION == '1.8.7'
|
||||
end
|
||||
|
||||
require 'uri'
|
||||
require 'faraday'
|
||||
require 'faraday' if Puppet.features.faraday?
|
||||
require 'json'
|
||||
|
||||
Puppet::Type.type(:midonet_host_registry).provide(:midonet_api_caller) do
|
||||
|
||||
confine :feature => :faraday
|
||||
|
||||
def create
|
||||
define_connection(resource[:midonet_api_url])
|
||||
tz = call_get_tunnelzone()
|
||||
|
@ -64,14 +64,31 @@ class midonet {
|
||||
# Add midonet-cli
|
||||
class {'midonet::midonet_cli':}
|
||||
|
||||
if ! defined(Package['faraday']) {
|
||||
package { 'faraday':
|
||||
ensure => present,
|
||||
provider => 'gem',
|
||||
before => Midonet_host_registry[$::hostname]
|
||||
# TODO(carmela): This workaround has been added in order to be able to handle
|
||||
# dependencies on the custom providers. Currently there's no official faraday
|
||||
# package for RHEL-based. We are working on getting it included in EPEL repos.
|
||||
# Detailed info: https://midonet.atlassian.net/browse/PUP-30
|
||||
|
||||
if ! defined(Package["hiera('midonet::faraday', 'ruby-faraday')"]) {
|
||||
if $::osfamily == 'RedHat' {
|
||||
package { "hiera('midonet::multipart', 'rubygem-multipart-post')":
|
||||
ensure => present,
|
||||
source => "hiera('midonet::multipart_post_url'"
|
||||
} ->
|
||||
package { "hiera('midonet::faraday', 'ruby-faraday')":
|
||||
ensure => present,
|
||||
source => "hiera('midonet::faraday_url')"
|
||||
}
|
||||
}
|
||||
else {
|
||||
package { 'ruby-faraday':
|
||||
ensure => present,
|
||||
before => Midonet_host_registry[$::hostname]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# Register the host
|
||||
midonet_host_registry { $::hostname:
|
||||
ensure => present,
|
||||
|
Loading…
x
Reference in New Issue
Block a user