From 9aecff6ab31c5725b53c01cf48585df384ec998b Mon Sep 17 00:00:00 2001 From: Steve Kowalik Date: Tue, 24 Mar 2015 14:03:12 +1100 Subject: [PATCH] Add a zanata::client manifest Add a new manifest, client, that installs the Zanata client by downloading the latest release tarball from maven-central, unpacking it, and symlinking it into /usr/local/bin. Change-Id: I979a1fd1a37b69b2a1d7c0a2c647d87fc4f0eb6d --- manifests/client.pp | 72 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 manifests/client.pp diff --git a/manifests/client.pp b/manifests/client.pp new file mode 100644 index 0000000..cdfb7f5 --- /dev/null +++ b/manifests/client.pp @@ -0,0 +1,72 @@ +# Copyright 2015 Hewlett-Packard Development Company, L.P. +# +# 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: zanata::client +# +class zanata::client( + $version = '3.4.2', + $user = 'jenkins', + $group = 'jenkins', +) { + + file { '/opt/zanata': + ensure => directory, + owner => $user, + group => $group, + mode => '0644', + require => User[$user], + } + + exec { 'get_zanata_client_dist_tarball': + command => "wget https://search.maven.org/remotecontent?filepath=org/zanata/zanata-cli/${version}/zanata-cli-${version}-dist.tar.gz -O /opt/zanata/zanata-cli-${version}-dist.tar.gz", + path => '/bin:/usr/bin', + creates => "/opt/zanata/zanata-cli-${version}-dist.tar.gz", + require => File['/opt/zanata'], + } + + file { "/opt/zanata/zanata-cli-${version}-dist.tar.gz": + ensure => present, + owner => $user, + group => $group, + mode => '0644', + require => Exec['get_zanata_client_dist_tarball'], + } + + exec { 'unpack_zanata_client_dist_tarball': + command => "tar zxf zanata-cli-${version}-dist.tar.gz", + path => '/bin:/usr/bin', + user => $user, + cwd => '/opt/zanata', + creates => "/opt/zanata/zanata-cli-${version}/bin/zanata-cli", + require => Exec['get_zanata_client_dist_tarball'], + } + + file { "/opt/zanata/zanata-cli-${version}/bin/zanata-cli": + ensure => present, + owner => $user, + group => $group, + mode => '0755', + require => Exec['unpack_zanata_client_dist_tarball'], + } + + file { '/usr/local/bin/zanata-cli': + ensure => link, + target => "/opt/zanata/zanata-cli-${version}/bin/zanata-cli", + require => File["/opt/zanata/zanata-cli-${version}/bin/zanata-cli"], + } + + package { 'openjdk-7-jre-headless': + ensure => present, + } +}