Browse Source

* Correct puppet-lint warnings.

master
gardouille 5 years ago
parent
commit
6c86d61854
7 changed files with 36 additions and 37 deletions
  1. +1
    -0
      CHANGELOG.md
  2. +8
    -8
      manifests/hypervisor/config.pp
  3. +2
    -2
      manifests/hypervisor/group.pp
  4. +12
    -14
      manifests/hypervisor/install.pp
  5. +5
    -5
      manifests/hypervisor/preconfig.pp
  6. +6
    -6
      manifests/hypervisor/service.pp
  7. +2
    -2
      tests/group_management.pp

+ 1
- 0
CHANGELOG.md View File

@@ -10,6 +10,7 @@
* The network management for an OpenVZ CT now works for all Debian family and not only Debian >=7.
* Modification in OpenVZ's configuration file notify the 'vz' service.
* Set an option to manage iptables modules in OpenVZ configuration.
* Correct puppet-lint warnings.

---------------------------------------
### 0.2.0 - 2015/01/27


+ 8
- 8
manifests/hypervisor/config.pp View File

@@ -19,24 +19,24 @@ class proxmox::hypervisor::config {
if $::is_proxmox == 'true' {

# Pveproxy access control list
file { "${proxmox::hypervisor::pveproxy_default_path}":
file { $proxmox::hypervisor::pveproxy_default_path:
ensure => present,
content => template("${proxmox::hypervisor::pveproxy_default_content}"),
notify => Service["${proxmox::hypervisor::pveproxy_service_name}"],
content => template($proxmox::hypervisor::pveproxy_default_content),
notify => Service[$proxmox::hypervisor::pveproxy_service_name],
}
->

# Remove the Subscription message
exec { 'remove_subscription_message':
command => 'rm -f /usr/share/pve-manager/ext4/pvemanagerlib.js.bak; sed -i".bak" -r -e "s/if \(data.status !== \'Active\'\) \{/if (false) {/" /usr/share/pve-manager/ext4/pvemanagerlib.js',
onlyif => 'grep "if (data.status !== \'Active\') {" /usr/share/pve-manager/ext4/pvemanagerlib.js',
command => 'rm -f /usr/share/pve-manager/ext4/pvemanagerlib.js.bak; sed -i".bak" -r -e "s/if \(data.status !== \'Active\'\) \{/if (false) {/" /usr/share/pve-manager/ext4/pvemanagerlib.js',
onlyif => 'grep "if (data.status !== \'Active\') {" /usr/share/pve-manager/ext4/pvemanagerlib.js',
}

## OpenVZ configuration
file { "${proxmox::hypervisor::vz_config_file_path}":
file { $proxmox::hypervisor::vz_config_file_path:
ensure => present,
content => template("${proxmox::hypervisor::vz_config_file_tpl}"),
notify => Service["${proxmox::hypervisor::vz_service_name}"],
content => template($proxmox::hypervisor::vz_config_file_tpl),
notify => Service[$proxmox::hypervisor::vz_service_name],
}

}


+ 2
- 2
manifests/hypervisor/group.pp View File

@@ -63,8 +63,8 @@ define proxmox::hypervisor::group ( $group = $title, $acl_path = '/', $permissio
}

# The permissions file
if ! defined(File["${permission_file}"]) {
file { "${permission_file}":
if ! defined(File[$permission_file]) {
file { $permission_file:
ensure => present,
}
}


+ 12
- 14
manifests/hypervisor/install.pp View File

@@ -19,19 +19,17 @@ class proxmox::hypervisor::install {
if $proxmox::hypervisor::kvm_only == true {
notify { "Need to install a PVE kernel (${proxmox::hypervisor::kernel_kvm_pkg_name}) and reboot the system to run it ...": }
->
# Don't use "${...}" because the kernel_kvm_pkg_name variable is an array
package { $proxmox::hypervisor::kernel_kvm_pkg_name:
ensure => "${proxmox::hypervisor::ve_pkg_ensure}",
notify => Exec['update_grub','reboot_to_pve'],
ensure => $proxmox::hypervisor::ve_pkg_ensure,
notify => Exec['update_grub','reboot_to_pve'],
}
}
else {
notify { "Need to install a PVE kernel (${proxmox::hypervisor::kernel_pkg_name}) and reboot the system to run it ...": }
->
# Don't use "${...}" because the kernel_pkg_name variable is an array
package { $proxmox::hypervisor::kernel_pkg_name:
ensure => "${proxmox::hypervisor::ve_pkg_ensure}",
notify => Exec['update_grub','grub_reboot'],
ensure => $proxmox::hypervisor::ve_pkg_ensure,
notify => Exec['update_grub','grub_reboot'],
}
# The kernel that allow KVM + OpenVZ is older than the standard Debian's
# kernel, so grub reboot must be used
@@ -41,12 +39,12 @@ class proxmox::hypervisor::install {

# Installation of Virtual Environnment
package { $proxmox::hypervisor::ve_pkg_name:
ensure => "${proxmox::hypervisor::ve_pkg_ensure}",
ensure => $proxmox::hypervisor::ve_pkg_ensure,
} ->

# Remove useless packages (such as the standard kernel, acpid, ...)
package { $proxmox::hypervisor::old_pkg_name:
ensure => "${proxmox::hypervisor::old_pkg_ensure}",
ensure => $proxmox::hypervisor::old_pkg_ensure,
notify => Exec['update_grub'],
}

@@ -54,30 +52,30 @@ class proxmox::hypervisor::install {
# come from Proxmox and standard Debian repository
if ! defined(Package["${proxmox::hypervisor::rec_pkg_name}"]) {
package { $proxmox::hypervisor::rec_pkg_name:
ensure => "${proxmox::hypervisor::ve_pkg_ensure}",
ensure => $proxmox::hypervisor::ve_pkg_ensure,
}
} else {
notice("Warning: cannot manage the installation of ${proxmox::hypervisor::rec_pkg_name}, as another resource (perhaps ...?) is managing it.")
notice("Warn: can't manage ${proxmox::hypervisor::rec_pkg_name}.")
}

}
}

# Ensure the grub is update
exec { 'update_grub':
command => "update-grub",
command => 'update-grub',
refreshonly => true,
}

# Choose a different line in the grub
exec { 'grub_reboot':
command => "grub-reboot 2",
command => 'grub-reboot 2',
refreshonly => true,
notify => Exec['reboot_to_pve'],
}

# Reboot on a PVE Kernel
exec { 'reboot_to_pve':
command => "shutdown -r 1",
command => 'shutdown -r 1',
refreshonly => true,
}



+ 5
- 5
manifests/hypervisor/preconfig.pp View File

@@ -17,7 +17,7 @@ class proxmox::hypervisor::preconfig {
#/files/etc/hosts/2/alias[1] = 'hypervisor'
#/files/etc/hosts/1/ipaddr = '127.0.0.1'
#/files/etc/hosts/1/canonical = 'localhost'
augeas { "${::fqdn}":
augeas { $::fqdn:
context => '/files/etc/hosts',
changes => [
#"ins ipaddr ${::ipaddress}",
@@ -32,7 +32,7 @@ class proxmox::hypervisor::preconfig {
->
# Remove Enterprise repository (need a subscription)
file { '/etc/apt/sources.list.d/pve-enterprise.list':
ensure => "${proxmox::hypervisor::pve_enterprise_repo_ensure}",
ensure => $proxmox::hypervisor::pve_enterprise_repo_ensure,
notify => Exec[apt_update],
}
->
@@ -47,7 +47,7 @@ class proxmox::hypervisor::preconfig {
key_server => 'keyserver.ubuntu.com',
}

# Set the grub default to saved to be able to use grub-set-default during
# Set the grub default to saved to be able to use grub-set-default during
# the installation
if ! defined(Augeas['grub_default']) {
augeas { 'grub_default':
@@ -66,9 +66,9 @@ class proxmox::hypervisor::preconfig {

$values = [ 'v1', 'v2' ]

file { "${proxmox::hypervisor::pve_modules_file_path}":
file { $proxmox::hypervisor::pve_modules_file_path:
ensure => present,
content => template("${proxmox::hypervisor::pve_modules_file_content}"),
content => template($proxmox::hypervisor::pve_modules_file_content),
require => File['/etc/modules-load.d'],
}



+ 6
- 6
manifests/hypervisor/service.pp View File

@@ -21,18 +21,18 @@ class proxmox::hypervisor::service {
if $::is_proxmox == 'true' {

if $proxmox::hypervisor::pveproxy_service_manage == true {
service { "${proxmox::hypervisor::pveproxy_service_name}":
ensure => "${pveproxy_service_ensure}",
enable => "${proxmox::hypervisor::pveproxy_service_enabled}",
service { $proxmox::hypervisor::pveproxy_service_name:
ensure => $pveproxy_service_ensure,
enable => $proxmox::hypervisor::pveproxy_service_enabled,
hasstatus => false,
hasrestart => true,
}
}

if $proxmox::hypervisor::vz_service_manage == true {
service { "${proxmox::hypervisor::vz_service_name}":
ensure => "${vz_service_ensure}",
enable => "${proxmox::hypervisor::pveproxy_service_enabled}",
service { $proxmox::hypervisor::vz_service_name:
ensure => $vz_service_ensure,
enable => $proxmox::hypervisor::pveproxy_service_enabled,
hasstatus => true,
hasrestart => true,
}


+ 2
- 2
tests/group_management.pp View File

@@ -1,8 +1,8 @@
proxmox::hypervisor::group { 'sysadmin':
role => "Administrator",
role => 'Administrator',
users => [ 'user1@pam', 'toto@pve' ],
}
proxmox::hypervisor::group { 'audit':
role => "PVEAuditor",
role => 'PVEAuditor',
users => [ 'user2@pam' ],
}

Loading…
Cancel
Save