Skip to content

Commit

Permalink
Merge pull request #126 from tuxmea/types_providers_4_10
Browse files Browse the repository at this point in the history
Types providers 4 10
  • Loading branch information
rwaffen committed Feb 5, 2015
2 parents ae3511d + 2c7e64e commit fb6454d
Show file tree
Hide file tree
Showing 22 changed files with 186 additions and 38 deletions.
5 changes: 3 additions & 2 deletions lib/puppet/provider/onecluster/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#
# Copyright
# initial provider had no copyright
# Deutsche Post E-POST Development GmbH - 2014
# Deutsche Post E-POST Development GmbH - 2014,2015
#

require 'rexml/document'
Expand Down Expand Up @@ -73,7 +73,8 @@ def exists?


def self.instances
REXML::Document.new(onecluster('list', '-x')).elements.collect("CLUSTER_POOL/CLUSTER") do |cluster|
clusters = REXML::Document.new(onecluster('list', '-x')).elements.collect("CLUSTER_POOL/CLUSTER")
clusters.collect do |cluster|
datastores = cluster.elements.collect("DATASTORES/ID") do |id|
REXML::Document.new(onedatastore('show', id.text, '-x')).elements["DATASTORE/NAME"].text
end
Expand Down
6 changes: 4 additions & 2 deletions lib/puppet/provider/onedatastore/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@
#
# Copyright
# initial provider had no copyright
# Deutsche Post E-POST Development GmbH - 2014
# Deutsche Post E-POST Development GmbH - 2014, 2015
#

require 'rubygems'
require 'nokogiri'

Puppet::Type.type(:onedatastore).provide(:cli) do
Expand Down Expand Up @@ -55,7 +56,8 @@ def exists?
end

def self.instances
Nokogiri::XML(onedatastore('list','-x')).root.xpath('/DATASTORE_POOL/DATASTORE').map do |datastore|
datastores = Nokogiri::XML(onedatastore('list','-x')).root.xpath('/DATASTORE_POOL/DATASTORE').map
datastores.collect do |datastore|
new(
:name => datastore.xpath('./NAME').text,
:ensure => :present,
Expand Down
17 changes: 16 additions & 1 deletion lib/puppet/provider/onehost/cli.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
# OpenNebula Puppet provider for onehost
#
# License: APLv2
#
# Authors:
# Based upon initial work from Ken Barber
# Modified by Martin Alfke
#
# Copyright
# initial provider had no copyright
# Deutsche Post E-POST Development GmbH - 2014, 2015
#

require 'rubygems'
require 'nokogiri'

Puppet::Type.type(:onehost).provide(:cli) do
Expand All @@ -24,7 +38,8 @@ def exists?
end

def self.instances
Nokogiri::XML(onehost('list','-x')).root.xpath('/HOST_POOL/HOST') do | host|
hosts = Nokogiri::XML(onehost('list','-x')).root.xpath('/HOST_POOL/HOST')
hosts.collect do |host|
new(
:name => host.xpath('./NAME').text,
:ensure => :present,
Expand Down
17 changes: 16 additions & 1 deletion lib/puppet/provider/oneimage/cli.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
# OpenNebula Puppet provider for oneimage
#
# License: APLv2
#
# Authors:
# Based upon initial work from Ken Barber
# Modified by Martin Alfke
#
# Copyright
# initial provider had no copyright
# Deutsche Post E-POST Development GmbH - 2014, 2015
#

require 'rubygems'
require 'nokogiri'

Puppet::Type.type(:oneimage).provide(:cli) do
Expand Down Expand Up @@ -67,7 +81,8 @@ def exists?

# Return the full hash of all existing oneimage resources
def self.instances
Nokogiri::XML(oneimage('list','-x')).root.xpath('/IMAGE_POOL/IMAGE').map do |image|
images = Nokogiri::XML(oneimage('list','-x')).root.xpath('/IMAGE_POOL/IMAGE').map
images.collect do |image|
new(
:name => image.xpath('./NAME').text,
:ensure => :present,
Expand Down
17 changes: 16 additions & 1 deletion lib/puppet/provider/onetemplate/cli.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
# OpenNebula Puppet provider for onetemplate
#
# License: APLv2
#
# Authors:
# Based upon initial work from Ken Barber
# Modified by Martin Alfke
#
# Copyright
# initial provider had no copyright
# Deutsche Post E-POST Development GmbH - 2014, 2015
#

require 'rubygems'
require 'nokogiri'

Puppet::Type.type(:onetemplate).provide(:cli) do
Expand Down Expand Up @@ -75,7 +89,8 @@ def exists?

# Return the full hash of all existing onevm resources
def self.instances
Nokogiri::XML(onetemplate('list', '-x')).root.xpath('/VMTEMPLATE_POOL/VMTEMPLATE') do | template|
templates = Nokogiri::XML(onetemplate('list', '-x')).root.xpath('/VMTEMPLATE_POOL/VMTEMPLATE')
templates.collect do |template|
new(
:name => template.xpath('./NAME').text,
:ensure => :present,
Expand Down
19 changes: 17 additions & 2 deletions lib/puppet/provider/onevm/cli.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,18 @@
require 'rexml/document'
# OpenNebula Puppet provider for onevm
#
# License: APLv2
#
# Authors:
# Based upon initial work from Ken Barber
# Modified by Martin Alfke
#
# Copyright
# initial provider had no copyright
# Deutsche Post E-POST Development GmbH - 2014, 2015
#

require 'rubygems'
require 'nokogiri'
require 'tempfile'
require 'erb'

Expand Down Expand Up @@ -33,7 +47,8 @@ def exists?

# Return the full hash of all existing onevm resources
def self.instances
Nokogiri::XML(omevm('list','-x')).root.xpath('/VM_POOL/VM') do |vm|
vms = Nokogiri::XML(omevm('list','-x')).root.xpath('/VM_POOL/VM')
vms.collect do |vm|
new(
:name => vm.xpath('./NAME').text,
:ensure => :present,
Expand Down
10 changes: 4 additions & 6 deletions lib/puppet/provider/onevnet/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,10 @@
#
# Copyright
# initial provider had no copyright
# Deutsche Post E-POST Development GmbH - 2014
# Deutsche Post E-POST Development GmbH - 2014, 2015
#

# require section:
# we read onevnet structure by using xml
# we write tempfiles as erb templates for creating resources and setting properties
#
require 'rubygems'
require 'nokogiri'

Puppet::Type.type(:onevnet).provide(:cli) do
Expand Down Expand Up @@ -104,7 +101,8 @@ def exists?

# Return the full hash of all existing onevnet resources
def self.instances
Nokogiri::XML(onevnet('list','-x')).root.xpath('/VNET_POOL/VNET').map do |vnet|
vnets = Nokogiri::XML(onevnet('list','-x')).root.xpath('/VNET_POOL/VNET').map
vnets.collect do |vnet|
hash = {
:name => vnet.xpath('./NAME').text,
:ensure => :present,
Expand Down
13 changes: 13 additions & 0 deletions lib/puppet/type/onecluster.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
# OpenNebula Puppet type for onecluster
#
# License: APLv2
#
# Authors:
# Based upon initial work from Ken Barber
# Modified by Martin Alfke
#
# Copyright
# initial provider had no copyright
# Deutsche Post E-POST Development GmbH - 2014, 2015
#

Puppet::Type.newtype(:onecluster) do
@doc = "Type for managing clusters in OpenNebula using the onecluster" +
"wrapper command."
Expand Down
12 changes: 12 additions & 0 deletions lib/puppet/type/onedatastore.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
# OpenNebula Puppet type for onedatastore
#
# License: APLv2
#
# Authors:
# Based upon initial work from Ken Barber
# Modified by Martin Alfke
#
# Copyright
# initial provider had no copyright
# Deutsche Post E-POST Development GmbH - 2014, 2015
#
Puppet::Type.newtype(:onedatastore) do
@doc = "Type for managing datastores in OpenNebula using the onedatastore" +
"wrapper command."
Expand Down
14 changes: 13 additions & 1 deletion lib/puppet/type/onehost.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
# OpenNebula Puppet type for onehost
#
# License: APLv2
#
# Authors:
# Based upon initial work from Ken Barber
# Modified by Martin Alfke
#
# Copyright
# initial provider had no copyright
# Deutsche Post E-POST Development GmbH - 2014, 2015
#
Puppet::Type.newtype(:onehost) do
@doc = <<-EOS
Type for managing hypervisor hosts in OpenNebula using the onehost wrapper
Expand All @@ -22,7 +34,7 @@
newproperty(:vm_mad) do
desc "Virtualization Driver"
defaultto :dummy
newvalues(:kvm, :xen, :vmware, :ec2, :dummy)
newvalues(:kvm, :xen, :vmware, :ec2, :dummy, :qemu)
end

newproperty(:vn_mad) do
Expand Down
12 changes: 12 additions & 0 deletions lib/puppet/type/oneimage.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
# OpenNebula Puppet type for oneimage
#
# License: APLv2
#
# Authors:
# Based upon initial work from Ken Barber
# Modified by Martin Alfke
#
# Copyright
# initial provider had no copyright
# Deutsche Post E-POST Development GmbH - 2014, 2015
#
Puppet::Type.newtype(:oneimage) do
@doc = "Type for managing Images, Files and Kernels in OpenNebula using the oneimage " +
"wrapper command."
Expand Down
12 changes: 12 additions & 0 deletions lib/puppet/type/onetemplate.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
# OpenNebula Puppet type for onetemplate
#
# License: APLv2
#
# Authors:
# Based upon initial work from Ken Barber
# Modified by Martin Alfke
#
# Copyright
# initial provider had no copyright
# Deutsche Post E-POST Development GmbH - 2014, 2015
#
Puppet::Type.newtype(:onetemplate) do
@doc = "Type for managing templates in OpenNebula using the onevm" +
"wrapper command."
Expand Down
12 changes: 12 additions & 0 deletions lib/puppet/type/onevm.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
# OpenNebula Puppet type for onevm
#
# License: APLv2
#
# Authors:
# Based upon initial work from Ken Barber
# Modified by Martin Alfke
#
# Copyright
# initial provider had no copyright
# Deutsche Post E-POST Development GmbH - 2014, 2015
#
Puppet::Type.newtype(:onevm) do
@doc = "Type for managing virtual machines in OpenNebula using the onevm" +
"wrapper command."
Expand Down
12 changes: 12 additions & 0 deletions lib/puppet/type/onevnet.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
# OpenNebula Puppet type for onevnet
#
# License: APLv2
#
# Authors:
# Based upon initial work from Ken Barber
# Modified by Martin Alfke
#
# Copyright
# initial provider had no copyright
# Deutsche Post E-POST Development GmbH - 2014, 2015
#
#require 'IPAddress'
Puppet::Type.newtype(:onevnet) do
@doc = "Type for managing networks in OpenNebula using the onevnet" +
Expand Down
7 changes: 6 additions & 1 deletion manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
# - vmware
# - ec2
# - dummy
# - qemu
#
# $ntype - default 802.1Q
# set network type for opennebula compute node
Expand Down Expand Up @@ -72,6 +73,9 @@
# $puppetdb true|false - default false
# defines to use puppetDB to discover peer nodes
#
# $debug_level - default 0
# defines the debug level under which oned and sunstone are running
#
# === Usage
#
# install compute node
Expand Down Expand Up @@ -113,10 +117,11 @@
$backend = 'sqlite',
$ha_setup = false,
$puppetdb = false,
$debug_level = '0',
) {
include one::params
if ($oned) {
if ( member(['kvm','xen3','xen4','vmware','ec2'], $vtype) ) {
if ( member(['kvm','xen3','xen4','vmware','ec2', 'qemu'], $vtype) ) {
if ( member(['802.1Q','ebtables','firewall','ovswitch'], $ntype) ) {
include one::oned
} else {
Expand Down
3 changes: 2 additions & 1 deletion manifests/oned/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@
$backup_db_password = $one::params::backup_db_password,
$backup_db_host = $one::params::backup_db_host,
$backup_intervall = $one::params::backup_intervall,
$backup_keep = $one::params::backup_keep
$backup_keep = $one::params::backup_keep,
$debug_level = $one::debug_level,
) {

File {
Expand Down
11 changes: 9 additions & 2 deletions manifests/oned/service.pp
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,17 @@
# http://www.apache.org/licenses/LICENSE-2.0.html
#
class one::oned::service {
if ($one::ha_setup) {
$oned_enable = false
$oned_ensure = undef
} else {
$oned_enable = true
$oned_ensure = 'running'
}
service {'opennebula':
ensure => $one::params::oned_ensure,
ensure => $oned_ensure,
hasstatus => true,
enable => $one::params::oned_enable,
enable => $oned_enable,
require => Class['one::oned::install'],
subscribe => Class['one::oned::config'],
}
Expand Down
2 changes: 1 addition & 1 deletion manifests/oned/sunstone/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
# http://www.apache.org/licenses/LICENSE-2.0.html
#
class one::oned::sunstone::config (
$listen_ip = $::ipaddress
$listen_ip = $::one::params::sunstone_listen_ip,

){
File {
Expand Down
Loading

0 comments on commit fb6454d

Please sign in to comment.