add class to manage midonet subscriptions

Change-Id: If0f14124a8b866c0ee78ff69403abb30b74dadd4
This commit is contained in:
Alejandro Andreu 2016-10-27 18:37:51 +02:00
parent d9ce2e96ec
commit 67e502e936

View File

@ -0,0 +1,58 @@
# == Class: midonet::cluster::subscription
#
# Manages the Midonet subscription
#
# === Parameters
#
# [*file_contents*]
# Contents of the subscription file, base64 encoded with the `base64`
# command, which assumes a column length of 76 (see manpage)
#
#
# === Authors
#
# Midonet (http://midonet.org)
#
# === Copyright
#
# Copyright (c) 2015 Midokura SARL, All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
class midonet::cluster::subscription (
$file_contents,
) {
$midonet_subscriptions_folder = '/etc/midonet/subscriptions'
$base64_license_file_path = '/tmp/MidoNet.license.base64'
$license_file_name = 'MidoNet.license.subs'
file { 'subscriptions-folder':
ensure => directory,
path => $midonet_subscriptions_folder,
before => Exec['license-move'],
}
file { 'midonet-license':
ensure => present,
path => $base64_license_file_path,
content => $file_contents,
} ->
exec { 'license-move':
command => "base64 -d ${base64_license_file_path} > ${midonet_subscriptions_folder}/${license_file_name}",
path => ['/usr/bin','/bin'],
require => File['subscriptions-folder'],
}
}