rubyipmi 0.10.0 → 0.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.document +5 -0
- data/.gitignore +50 -0
- data/.rspec +1 -0
- data/.rubocop.yml +66 -0
- data/.travis.yml +13 -0
- data/Gemfile +3 -3
- data/README.md +9 -3
- data/RELEASE_NOTES.md +33 -0
- data/Rakefile +15 -42
- data/lib/rubyipmi/commands/basecommand.rb +17 -23
- data/lib/rubyipmi/commands/mixins/power_mixin.rb +50 -0
- data/lib/rubyipmi/commands/mixins/sensors_mixin.rb +54 -0
- data/lib/rubyipmi/freeipmi/commands/basecommand.rb +26 -35
- data/lib/rubyipmi/freeipmi/commands/bmc.rb +4 -7
- data/lib/rubyipmi/freeipmi/commands/bmcconfig.rb +7 -17
- data/lib/rubyipmi/freeipmi/commands/bmcdevice.rb +2 -9
- data/lib/rubyipmi/freeipmi/commands/bmcinfo.rb +4 -10
- data/lib/rubyipmi/freeipmi/commands/chassis.rb +27 -45
- data/lib/rubyipmi/freeipmi/commands/chassisconfig.rb +23 -38
- data/lib/rubyipmi/freeipmi/commands/fru.rb +23 -42
- data/lib/rubyipmi/freeipmi/commands/lan.rb +4 -6
- data/lib/rubyipmi/freeipmi/commands/power.rb +8 -51
- data/lib/rubyipmi/freeipmi/commands/sensors.rb +10 -67
- data/lib/rubyipmi/freeipmi/connection.rb +14 -17
- data/lib/rubyipmi/freeipmi/errorcodes.rb +11 -17
- data/lib/rubyipmi/ipmitool/commands/basecommand.rb +12 -16
- data/lib/rubyipmi/ipmitool/commands/bmc.rb +13 -22
- data/lib/rubyipmi/ipmitool/commands/chassis.rb +26 -44
- data/lib/rubyipmi/ipmitool/commands/chassisconfig.rb +11 -21
- data/lib/rubyipmi/ipmitool/commands/fru.rb +35 -48
- data/lib/rubyipmi/ipmitool/commands/lan.rb +25 -28
- data/lib/rubyipmi/ipmitool/commands/power.rb +7 -58
- data/lib/rubyipmi/ipmitool/commands/sensors.rb +10 -68
- data/lib/rubyipmi/ipmitool/connection.rb +10 -19
- data/lib/rubyipmi/ipmitool/errorcodes.rb +11 -45
- data/lib/rubyipmi/observablehash.rb +1 -2
- data/lib/rubyipmi/version.rb +5 -0
- data/lib/rubyipmi.rb +23 -28
- data/rubyipmi.gemspec +17 -128
- metadata +18 -101
- data/spec/Vagrantfile +0 -45
- data/spec/fixtures/freeipmi/bmc_config.txt +0 -317
- data/spec/fixtures/freeipmi/bmc_config_lan_conf.txt +0 -19
- data/spec/fixtures/freeipmi/bmc_info.txt +0 -32
- data/spec/fixtures/freeipmi/errors.txt +0 -3
- data/spec/fixtures/freeipmi/fru.txt +0 -13
- data/spec/fixtures/freeipmi/sensors.txt +0 -29
- data/spec/fixtures/ipmitool/bmc_info.txt +0 -20
- data/spec/fixtures/ipmitool/errors.txt +0 -10
- data/spec/fixtures/ipmitool/fru.txt +0 -96
- data/spec/fixtures/ipmitool/lan.txt +0 -17
- data/spec/fixtures/ipmitool/sensors.txt +0 -105
- data/spec/integration/bmc_spec.rb +0 -48
- data/spec/integration/chassis_config_spec.rb +0 -38
- data/spec/integration/chassis_spec.rb +0 -26
- data/spec/integration/connection_spec.rb +0 -45
- data/spec/integration/fru_spec.rb +0 -38
- data/spec/integration/lan_spec.rb +0 -50
- data/spec/integration/power_spec.rb +0 -40
- data/spec/integration/rubyipmi_spec.rb +0 -114
- data/spec/integration/sensor_spec.rb +0 -43
- data/spec/manifests/default.pp +0 -50
- data/spec/puppetmodules/archive/LICENSE-2.0.txt +0 -202
- data/spec/puppetmodules/archive/Modulefile +0 -8
- data/spec/puppetmodules/archive/README.md +0 -40
- data/spec/puppetmodules/archive/manifests/download.pp +0 -157
- data/spec/puppetmodules/archive/manifests/extract.pp +0 -81
- data/spec/puppetmodules/archive/manifests/init.pp +0 -70
- data/spec/puppetmodules/archive/manifests/tar-gz.pp +0 -7
- data/spec/puppetmodules/archive/manifests/zip.pp +0 -7
- data/spec/puppetmodules/archive/metadata.json +0 -26
- data/spec/spec_helper.rb +0 -47
- data/spec/unit/freeipmi/bmc-info_spec.rb +0 -38
- data/spec/unit/freeipmi/bmc_spec.rb +0 -43
- data/spec/unit/freeipmi/connection_spec.rb +0 -121
- data/spec/unit/freeipmi/errorcodes_spec.rb +0 -28
- data/spec/unit/freeipmi/fru_spec.rb +0 -76
- data/spec/unit/freeipmi/lan_spec.rb +0 -0
- data/spec/unit/freeipmi/sensors_spec.rb +0 -85
- data/spec/unit/ipmitool/bmc_spec.rb +0 -77
- data/spec/unit/ipmitool/connection_spec.rb +0 -122
- data/spec/unit/ipmitool/errorcodes_spec.rb +0 -35
- data/spec/unit/ipmitool/fru_spec.rb +0 -77
- data/spec/unit/ipmitool/lan_spec.rb +0 -94
- data/spec/unit/ipmitool/sensors_spec.rb +0 -96
- data/spec/unit/rubyipmi_spec.rb +0 -50
- data/spec/vagrant +0 -27
- data/spec/vagrant.pub +0 -1
@@ -1,202 +0,0 @@
|
|
1
|
-
|
2
|
-
Apache License
|
3
|
-
Version 2.0, January 2004
|
4
|
-
http://www.apache.org/licenses/
|
5
|
-
|
6
|
-
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
7
|
-
|
8
|
-
1. Definitions.
|
9
|
-
|
10
|
-
"License" shall mean the terms and conditions for use, reproduction,
|
11
|
-
and distribution as defined by Sections 1 through 9 of this document.
|
12
|
-
|
13
|
-
"Licensor" shall mean the copyright owner or entity authorized by
|
14
|
-
the copyright owner that is granting the License.
|
15
|
-
|
16
|
-
"Legal Entity" shall mean the union of the acting entity and all
|
17
|
-
other entities that control, are controlled by, or are under common
|
18
|
-
control with that entity. For the purposes of this definition,
|
19
|
-
"control" means (i) the power, direct or indirect, to cause the
|
20
|
-
direction or management of such entity, whether by contract or
|
21
|
-
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
22
|
-
outstanding shares, or (iii) beneficial ownership of such entity.
|
23
|
-
|
24
|
-
"You" (or "Your") shall mean an individual or Legal Entity
|
25
|
-
exercising permissions granted by this License.
|
26
|
-
|
27
|
-
"Source" form shall mean the preferred form for making modifications,
|
28
|
-
including but not limited to software source code, documentation
|
29
|
-
source, and configuration files.
|
30
|
-
|
31
|
-
"Object" form shall mean any form resulting from mechanical
|
32
|
-
transformation or translation of a Source form, including but
|
33
|
-
not limited to compiled object code, generated documentation,
|
34
|
-
and conversions to other media types.
|
35
|
-
|
36
|
-
"Work" shall mean the work of authorship, whether in Source or
|
37
|
-
Object form, made available under the License, as indicated by a
|
38
|
-
copyright notice that is included in or attached to the work
|
39
|
-
(an example is provided in the Appendix below).
|
40
|
-
|
41
|
-
"Derivative Works" shall mean any work, whether in Source or Object
|
42
|
-
form, that is based on (or derived from) the Work and for which the
|
43
|
-
editorial revisions, annotations, elaborations, or other modifications
|
44
|
-
represent, as a whole, an original work of authorship. For the purposes
|
45
|
-
of this License, Derivative Works shall not include works that remain
|
46
|
-
separable from, or merely link (or bind by name) to the interfaces of,
|
47
|
-
the Work and Derivative Works thereof.
|
48
|
-
|
49
|
-
"Contribution" shall mean any work of authorship, including
|
50
|
-
the original version of the Work and any modifications or additions
|
51
|
-
to that Work or Derivative Works thereof, that is intentionally
|
52
|
-
submitted to Licensor for inclusion in the Work by the copyright owner
|
53
|
-
or by an individual or Legal Entity authorized to submit on behalf of
|
54
|
-
the copyright owner. For the purposes of this definition, "submitted"
|
55
|
-
means any form of electronic, verbal, or written communication sent
|
56
|
-
to the Licensor or its representatives, including but not limited to
|
57
|
-
communication on electronic mailing lists, source code control systems,
|
58
|
-
and issue tracking systems that are managed by, or on behalf of, the
|
59
|
-
Licensor for the purpose of discussing and improving the Work, but
|
60
|
-
excluding communication that is conspicuously marked or otherwise
|
61
|
-
designated in writing by the copyright owner as "Not a Contribution."
|
62
|
-
|
63
|
-
"Contributor" shall mean Licensor and any individual or Legal Entity
|
64
|
-
on behalf of whom a Contribution has been received by Licensor and
|
65
|
-
subsequently incorporated within the Work.
|
66
|
-
|
67
|
-
2. Grant of Copyright License. Subject to the terms and conditions of
|
68
|
-
this License, each Contributor hereby grants to You a perpetual,
|
69
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
70
|
-
copyright license to reproduce, prepare Derivative Works of,
|
71
|
-
publicly display, publicly perform, sublicense, and distribute the
|
72
|
-
Work and such Derivative Works in Source or Object form.
|
73
|
-
|
74
|
-
3. Grant of Patent License. Subject to the terms and conditions of
|
75
|
-
this License, each Contributor hereby grants to You a perpetual,
|
76
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
77
|
-
(except as stated in this section) patent license to make, have made,
|
78
|
-
use, offer to sell, sell, import, and otherwise transfer the Work,
|
79
|
-
where such license applies only to those patent claims licensable
|
80
|
-
by such Contributor that are necessarily infringed by their
|
81
|
-
Contribution(s) alone or by combination of their Contribution(s)
|
82
|
-
with the Work to which such Contribution(s) was submitted. If You
|
83
|
-
institute patent litigation against any entity (including a
|
84
|
-
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
85
|
-
or a Contribution incorporated within the Work constitutes direct
|
86
|
-
or contributory patent infringement, then any patent licenses
|
87
|
-
granted to You under this License for that Work shall terminate
|
88
|
-
as of the date such litigation is filed.
|
89
|
-
|
90
|
-
4. Redistribution. You may reproduce and distribute copies of the
|
91
|
-
Work or Derivative Works thereof in any medium, with or without
|
92
|
-
modifications, and in Source or Object form, provided that You
|
93
|
-
meet the following conditions:
|
94
|
-
|
95
|
-
(a) You must give any other recipients of the Work or
|
96
|
-
Derivative Works a copy of this License; and
|
97
|
-
|
98
|
-
(b) You must cause any modified files to carry prominent notices
|
99
|
-
stating that You changed the files; and
|
100
|
-
|
101
|
-
(c) You must retain, in the Source form of any Derivative Works
|
102
|
-
that You distribute, all copyright, patent, trademark, and
|
103
|
-
attribution notices from the Source form of the Work,
|
104
|
-
excluding those notices that do not pertain to any part of
|
105
|
-
the Derivative Works; and
|
106
|
-
|
107
|
-
(d) If the Work includes a "NOTICE" text file as part of its
|
108
|
-
distribution, then any Derivative Works that You distribute must
|
109
|
-
include a readable copy of the attribution notices contained
|
110
|
-
within such NOTICE file, excluding those notices that do not
|
111
|
-
pertain to any part of the Derivative Works, in at least one
|
112
|
-
of the following places: within a NOTICE text file distributed
|
113
|
-
as part of the Derivative Works; within the Source form or
|
114
|
-
documentation, if provided along with the Derivative Works; or,
|
115
|
-
within a display generated by the Derivative Works, if and
|
116
|
-
wherever such third-party notices normally appear. The contents
|
117
|
-
of the NOTICE file are for informational purposes only and
|
118
|
-
do not modify the License. You may add Your own attribution
|
119
|
-
notices within Derivative Works that You distribute, alongside
|
120
|
-
or as an addendum to the NOTICE text from the Work, provided
|
121
|
-
that such additional attribution notices cannot be construed
|
122
|
-
as modifying the License.
|
123
|
-
|
124
|
-
You may add Your own copyright statement to Your modifications and
|
125
|
-
may provide additional or different license terms and conditions
|
126
|
-
for use, reproduction, or distribution of Your modifications, or
|
127
|
-
for any such Derivative Works as a whole, provided Your use,
|
128
|
-
reproduction, and distribution of the Work otherwise complies with
|
129
|
-
the conditions stated in this License.
|
130
|
-
|
131
|
-
5. Submission of Contributions. Unless You explicitly state otherwise,
|
132
|
-
any Contribution intentionally submitted for inclusion in the Work
|
133
|
-
by You to the Licensor shall be under the terms and conditions of
|
134
|
-
this License, without any additional terms or conditions.
|
135
|
-
Notwithstanding the above, nothing herein shall supersede or modify
|
136
|
-
the terms of any separate license agreement you may have executed
|
137
|
-
with Licensor regarding such Contributions.
|
138
|
-
|
139
|
-
6. Trademarks. This License does not grant permission to use the trade
|
140
|
-
names, trademarks, service marks, or product names of the Licensor,
|
141
|
-
except as required for reasonable and customary use in describing the
|
142
|
-
origin of the Work and reproducing the content of the NOTICE file.
|
143
|
-
|
144
|
-
7. Disclaimer of Warranty. Unless required by applicable law or
|
145
|
-
agreed to in writing, Licensor provides the Work (and each
|
146
|
-
Contributor provides its Contributions) on an "AS IS" BASIS,
|
147
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
148
|
-
implied, including, without limitation, any warranties or conditions
|
149
|
-
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
150
|
-
PARTICULAR PURPOSE. You are solely responsible for determining the
|
151
|
-
appropriateness of using or redistributing the Work and assume any
|
152
|
-
risks associated with Your exercise of permissions under this License.
|
153
|
-
|
154
|
-
8. Limitation of Liability. In no event and under no legal theory,
|
155
|
-
whether in tort (including negligence), contract, or otherwise,
|
156
|
-
unless required by applicable law (such as deliberate and grossly
|
157
|
-
negligent acts) or agreed to in writing, shall any Contributor be
|
158
|
-
liable to You for damages, including any direct, indirect, special,
|
159
|
-
incidental, or consequential damages of any character arising as a
|
160
|
-
result of this License or out of the use or inability to use the
|
161
|
-
Work (including but not limited to damages for loss of goodwill,
|
162
|
-
work stoppage, computer failure or malfunction, or any and all
|
163
|
-
other commercial damages or losses), even if such Contributor
|
164
|
-
has been advised of the possibility of such damages.
|
165
|
-
|
166
|
-
9. Accepting Warranty or Additional Liability. While redistributing
|
167
|
-
the Work or Derivative Works thereof, You may choose to offer,
|
168
|
-
and charge a fee for, acceptance of support, warranty, indemnity,
|
169
|
-
or other liability obligations and/or rights consistent with this
|
170
|
-
License. However, in accepting such obligations, You may act only
|
171
|
-
on Your own behalf and on Your sole responsibility, not on behalf
|
172
|
-
of any other Contributor, and only if You agree to indemnify,
|
173
|
-
defend, and hold each Contributor harmless for any liability
|
174
|
-
incurred by, or claims asserted against, such Contributor by reason
|
175
|
-
of your accepting any such warranty or additional liability.
|
176
|
-
|
177
|
-
END OF TERMS AND CONDITIONS
|
178
|
-
|
179
|
-
APPENDIX: How to apply the Apache License to your work.
|
180
|
-
|
181
|
-
To apply the Apache License to your work, attach the following
|
182
|
-
boilerplate notice, with the fields enclosed by brackets "[]"
|
183
|
-
replaced with your own identifying information. (Don't include
|
184
|
-
the brackets!) The text should be enclosed in the appropriate
|
185
|
-
comment syntax for the file format. We also recommend that a
|
186
|
-
file or class name and description of purpose be included on the
|
187
|
-
same "printed page" as the copyright notice for easier
|
188
|
-
identification within third-party archives.
|
189
|
-
|
190
|
-
Copyright [yyyy] [name of copyright owner]
|
191
|
-
|
192
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
193
|
-
you may not use this file except in compliance with the License.
|
194
|
-
You may obtain a copy of the License at
|
195
|
-
|
196
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
197
|
-
|
198
|
-
Unless required by applicable law or agreed to in writing, software
|
199
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
200
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
201
|
-
See the License for the specific language governing permissions and
|
202
|
-
limitations under the License.
|
@@ -1,8 +0,0 @@
|
|
1
|
-
name 'jproyo-archive'
|
2
|
-
version '0.0.4'
|
3
|
-
source 'https://github.com/mxhero/puppet-modules/tree/master/modules/archive'
|
4
|
-
author 'Juan Pablo Royo'
|
5
|
-
license 'Apache 2.0'
|
6
|
-
summary 'Archive download and extractor to manage tar, zip, tarballs, etc.'
|
7
|
-
description "Archive download and extractor to manage tar, zip, tarballs, etc."
|
8
|
-
project_page 'https://github.com/mxhero/puppet-modules/tree/master/modules/archive'
|
@@ -1,40 +0,0 @@
|
|
1
|
-
Archive Puppet Module
|
2
|
-
====================
|
3
|
-
|
4
|
-
Overview
|
5
|
-
--------
|
6
|
-
|
7
|
-
Puppet Module to download and extract tar and zip archives based on [camptocamp/puppet-archive](https://github.com/camptocamp/puppet-archive).
|
8
|
-
|
9
|
-
Supported archive types are:
|
10
|
-
|
11
|
-
- `tar.gz`, `tgz`
|
12
|
-
- `tar.bz2`, `tbz2`
|
13
|
-
- `tar.xz`, `txz`
|
14
|
-
- `zip`
|
15
|
-
|
16
|
-
Usage
|
17
|
-
-----
|
18
|
-
|
19
|
-
Example:
|
20
|
-
|
21
|
-
archive { 'apache-tomcat-6.0.26':
|
22
|
-
ensure => present,
|
23
|
-
url => 'http://archive.apache.org/dist/tomcat/tomcat-6/v6.0.26/bin/apache-tomcat-6.0.26.tar.gz',
|
24
|
-
target => '/opt',
|
25
|
-
}
|
26
|
-
|
27
|
-
License
|
28
|
-
-------
|
29
|
-
|
30
|
-
Copyright (c) 2012 Camptocamp SA
|
31
|
-
|
32
|
-
This script is licensed under the Apache License, Version 2.0.
|
33
|
-
|
34
|
-
See http://www.apache.org/licenses/LICENSE-2.0.html for the full license text.
|
35
|
-
|
36
|
-
|
37
|
-
Support
|
38
|
-
-------
|
39
|
-
|
40
|
-
Please log tickets and issues at our [project site](https://github.com/camptocamp/puppet-archive/issues).
|
@@ -1,157 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
|
3
|
-
== Definition: archive::download
|
4
|
-
|
5
|
-
Archive downloader with integrity verification.
|
6
|
-
|
7
|
-
Parameters:
|
8
|
-
|
9
|
-
- *$url:
|
10
|
-
- *$digest_url:
|
11
|
-
- *$digest_string: Default value ""
|
12
|
-
- *$digest_type: Default value "md5".
|
13
|
-
- *$timeout: Default value 120.
|
14
|
-
- *$src_target: Default value "/usr/src".
|
15
|
-
- *$allow_insecure: Default value false.
|
16
|
-
|
17
|
-
Example usage:
|
18
|
-
|
19
|
-
archive::download {"apache-tomcat-6.0.26.tar.gz":
|
20
|
-
ensure => present,
|
21
|
-
url => "http://archive.apache.org/dist/tomcat/tomcat-6/v6.0.26/bin/apache-tomcat-6.0.26.tar.gz",
|
22
|
-
}
|
23
|
-
|
24
|
-
archive::download {"apache-tomcat-6.0.26.tar.gz":
|
25
|
-
ensure => present,
|
26
|
-
digest_string => "f9eafa9bfd620324d1270ae8f09a8c89",
|
27
|
-
url => "http://archive.apache.org/dist/tomcat/tomcat-6/v6.0.26/bin/apache-tomcat-6.0.26.tar.gz",
|
28
|
-
}
|
29
|
-
|
30
|
-
*/
|
31
|
-
define archive::download (
|
32
|
-
$url,
|
33
|
-
$ensure=present,
|
34
|
-
$checksum=true,
|
35
|
-
$digest_url='',
|
36
|
-
$digest_string='',
|
37
|
-
$digest_type='md5',
|
38
|
-
$timeout=120,
|
39
|
-
$src_target='/usr/src',
|
40
|
-
$allow_insecure=false,
|
41
|
-
) {
|
42
|
-
|
43
|
-
$insecure_arg = $allow_insecure ? {
|
44
|
-
true => '-k',
|
45
|
-
default => '',
|
46
|
-
}
|
47
|
-
|
48
|
-
if !defined(Package['curl']) {
|
49
|
-
package{'curl':
|
50
|
-
ensure => present,
|
51
|
-
}
|
52
|
-
}
|
53
|
-
|
54
|
-
case $checksum {
|
55
|
-
true : {
|
56
|
-
case $digest_type {
|
57
|
-
'md5','sha1','sha224','sha256','sha384','sha512' : {
|
58
|
-
$checksum_cmd = "${digest_type}sum -c ${name}.${digest_type}"
|
59
|
-
}
|
60
|
-
default: { fail 'Unimplemented digest type' }
|
61
|
-
}
|
62
|
-
|
63
|
-
if $digest_url != '' and $digest_string != '' {
|
64
|
-
fail 'digest_url and digest_string should not be used together !'
|
65
|
-
}
|
66
|
-
|
67
|
-
if $digest_string == '' {
|
68
|
-
|
69
|
-
case $ensure {
|
70
|
-
present: {
|
71
|
-
|
72
|
-
if $digest_url == '' {
|
73
|
-
$digest_src = "${url}.${digest_type}"
|
74
|
-
} else {
|
75
|
-
$digest_src = $digest_url
|
76
|
-
}
|
77
|
-
|
78
|
-
exec {"download digest of archive $name":
|
79
|
-
command => "curl ${insecure_arg} -o ${src_target}/${name}.${digest_type} ${digest_src}",
|
80
|
-
creates => "${src_target}/${name}.${digest_type}",
|
81
|
-
timeout => $timeout,
|
82
|
-
notify => Exec["download archive $name and check sum"],
|
83
|
-
path => "/usr/local/bin:/usr/bin:/bin",
|
84
|
-
require => Package['curl'],
|
85
|
-
}
|
86
|
-
|
87
|
-
}
|
88
|
-
absent: {
|
89
|
-
file{"${src_target}/${name}.${digest_type}":
|
90
|
-
ensure => absent,
|
91
|
-
purge => true,
|
92
|
-
force => true,
|
93
|
-
}
|
94
|
-
}
|
95
|
-
}
|
96
|
-
}
|
97
|
-
|
98
|
-
if $digest_string != '' {
|
99
|
-
case $ensure {
|
100
|
-
present: {
|
101
|
-
file {"${src_target}/${name}.${digest_type}":
|
102
|
-
ensure => $ensure,
|
103
|
-
content => "${digest_string} *${name}",
|
104
|
-
notify => Exec["download archive $name and check sum"],
|
105
|
-
}
|
106
|
-
}
|
107
|
-
absent: {
|
108
|
-
file {"${src_target}/${name}.${digest_type}":
|
109
|
-
ensure => absent,
|
110
|
-
purge => true,
|
111
|
-
force => true,
|
112
|
-
}
|
113
|
-
}
|
114
|
-
}
|
115
|
-
}
|
116
|
-
}
|
117
|
-
false : { notice 'No checksum for this archive' }
|
118
|
-
default: { fail ( "Unknown checksum value: '${checksum}'" ) }
|
119
|
-
}
|
120
|
-
|
121
|
-
case $ensure {
|
122
|
-
present: {
|
123
|
-
exec {"download archive $name and check sum":
|
124
|
-
command => "curl ${insecure_arg} -o ${src_target}/${name} ${url}",
|
125
|
-
path => "/usr/local/bin:/usr/bin:/bin",
|
126
|
-
creates => "${src_target}/${name}",
|
127
|
-
logoutput => true,
|
128
|
-
timeout => $timeout,
|
129
|
-
require => Package['curl'],
|
130
|
-
notify => $checksum ? {
|
131
|
-
true => Exec["rm-on-error-${name}"],
|
132
|
-
default => undef,
|
133
|
-
},
|
134
|
-
refreshonly => $checksum ? {
|
135
|
-
true => true,
|
136
|
-
default => undef,
|
137
|
-
},
|
138
|
-
}
|
139
|
-
|
140
|
-
exec {"rm-on-error-${name}":
|
141
|
-
command => "rm -f ${src_target}/${name} ${src_target}/${name}.${digest_type} && exit 1",
|
142
|
-
unless => $checksum_cmd,
|
143
|
-
cwd => $src_target,
|
144
|
-
path => "/usr/local/bin:/usr/bin:/bin",
|
145
|
-
refreshonly => true,
|
146
|
-
}
|
147
|
-
}
|
148
|
-
absent: {
|
149
|
-
file {"${src_target}/${name}":
|
150
|
-
ensure => absent,
|
151
|
-
purge => true,
|
152
|
-
force => true,
|
153
|
-
}
|
154
|
-
}
|
155
|
-
default: { fail ( "Unknown ensure value: '${ensure}'" ) }
|
156
|
-
}
|
157
|
-
}
|
@@ -1,81 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
|
3
|
-
== Definition: archive::extract
|
4
|
-
|
5
|
-
Archive extractor.
|
6
|
-
|
7
|
-
Parameters:
|
8
|
-
|
9
|
-
- *$target: Destination directory
|
10
|
-
- *$src_target: Default value "/usr/src".
|
11
|
-
- *$root_dir: Default value "".
|
12
|
-
- *$extension: Default value ".tar.gz".
|
13
|
-
- *$timeout: Default value 120.
|
14
|
-
|
15
|
-
Example usage:
|
16
|
-
|
17
|
-
archive::extract {"apache-tomcat-6.0.26":
|
18
|
-
ensure => present,
|
19
|
-
target => "/opt",
|
20
|
-
}
|
21
|
-
|
22
|
-
This means we want to extract the local archive
|
23
|
-
(maybe downloaded with archive::download)
|
24
|
-
'/usr/src/apache-tomcat-6.0.26.tar.gz' in '/src/apache-tomcat-6.0.26'
|
25
|
-
|
26
|
-
Warning:
|
27
|
-
|
28
|
-
The parameter *$root_dir* must be used if the root directory of the archive
|
29
|
-
is different from the name of the archive *$name*. To extract the name of
|
30
|
-
the root directory use the commands "tar tf archive.tar.gz" or
|
31
|
-
"unzip -l archive.zip"
|
32
|
-
|
33
|
-
*/
|
34
|
-
define archive::extract (
|
35
|
-
$target,
|
36
|
-
$ensure=present,
|
37
|
-
$src_target='/usr/src',
|
38
|
-
$root_dir='',
|
39
|
-
$extension='tar.gz',
|
40
|
-
$onlyif='true',
|
41
|
-
$timeout=120) {
|
42
|
-
|
43
|
-
if $root_dir != '' {
|
44
|
-
$extract_dir = "${target}/${root_dir}"
|
45
|
-
} else {
|
46
|
-
$extract_dir = "${target}/${name}"
|
47
|
-
}
|
48
|
-
|
49
|
-
case $ensure {
|
50
|
-
present: {
|
51
|
-
|
52
|
-
$extract_zip = "unzip -o ${src_target}/${name}.${extension} -d ${target}"
|
53
|
-
$extract_targz = "tar --no-same-owner --no-same-permissions -xzf ${src_target}/${name}.${extension} -C ${target}"
|
54
|
-
$extract_tarbz2 = "tar --no-same-owner --no-same-permissions -xjf ${src_target}/${name}.${extension} -C ${target}"
|
55
|
-
|
56
|
-
exec {"$name unpack":
|
57
|
-
command => $extension ? {
|
58
|
-
'zip' => "mkdir -p ${target} && ${extract_zip}",
|
59
|
-
'tar.gz' => "mkdir -p ${target} && ${extract_targz}",
|
60
|
-
'tgz' => "mkdir -p ${target} && ${extract_targz}",
|
61
|
-
'tar.bz2' => "mkdir -p ${target} && ${extract_tarbz2}",
|
62
|
-
'tgz2' => "mkdir -p ${target} && ${extract_tarbz2}",
|
63
|
-
default => fail ( "Unknown extension value '${extension}'" ),
|
64
|
-
},
|
65
|
-
path => "/usr/local/bin:/usr/bin:/bin",
|
66
|
-
creates => $extract_dir,
|
67
|
-
onlyif => $onlyif,
|
68
|
-
timeout => $timeout
|
69
|
-
}
|
70
|
-
}
|
71
|
-
absent: {
|
72
|
-
file {$extract_dir:
|
73
|
-
ensure => absent,
|
74
|
-
recurse => true,
|
75
|
-
purge => true,
|
76
|
-
force => true,
|
77
|
-
}
|
78
|
-
}
|
79
|
-
default: { err ( "Unknown ensure value: '${ensure}'" ) }
|
80
|
-
}
|
81
|
-
}
|
@@ -1,70 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
|
3
|
-
== Definition: archive
|
4
|
-
|
5
|
-
Download and extract an archive.
|
6
|
-
|
7
|
-
Parameters:
|
8
|
-
|
9
|
-
- *$url:
|
10
|
-
- *$target: Destination directory
|
11
|
-
- *$checksum: Default value "true"
|
12
|
-
- *$digest_url: Default value ""
|
13
|
-
- *$digest_string: Default value ""
|
14
|
-
- *$digest_type: Default value "md5"
|
15
|
-
- *$src_target: Default value "/usr/src"
|
16
|
-
- *$root_dir: Default value ""
|
17
|
-
- *$extension: Default value ".tar.gz"
|
18
|
-
- *$timeout: Default value 120
|
19
|
-
- *$allow_insecure: Default value false
|
20
|
-
- *$onlyif: Expression console to test if we have to execute this class
|
21
|
-
|
22
|
-
Example usage:
|
23
|
-
|
24
|
-
archive {"apache-tomcat-6.0.26":
|
25
|
-
ensure => present,
|
26
|
-
url => "http://archive.apache.org/dist/tomcat/tomcat-6/v6.0.26/bin/apache-tomcat-6.0.26.tar.gz",
|
27
|
-
target => "/opt",
|
28
|
-
}
|
29
|
-
|
30
|
-
*/
|
31
|
-
define archive (
|
32
|
-
$url,
|
33
|
-
$target,
|
34
|
-
$ensure=present,
|
35
|
-
$checksum=true,
|
36
|
-
$digest_url='',
|
37
|
-
$digest_string='',
|
38
|
-
$digest_type='md5',
|
39
|
-
$timeout=120,
|
40
|
-
$root_dir='',
|
41
|
-
$extension='tar.gz',
|
42
|
-
$src_target='/usr/src',
|
43
|
-
$allow_insecure=true,
|
44
|
-
$onlyif = "true",
|
45
|
-
) {
|
46
|
-
|
47
|
-
archive::download {"${name}.${extension}":
|
48
|
-
ensure => $ensure,
|
49
|
-
url => $url,
|
50
|
-
checksum => $checksum,
|
51
|
-
digest_url => $digest_url,
|
52
|
-
digest_string => $digest_string,
|
53
|
-
digest_type => $digest_type,
|
54
|
-
timeout => $timeout,
|
55
|
-
src_target => $src_target,
|
56
|
-
allow_insecure => $allow_insecure,
|
57
|
-
}
|
58
|
-
|
59
|
-
archive::extract {$name:
|
60
|
-
ensure => $ensure,
|
61
|
-
target => $target,
|
62
|
-
src_target => $src_target,
|
63
|
-
root_dir => $root_dir,
|
64
|
-
extension => $extension,
|
65
|
-
timeout => $timeout,
|
66
|
-
onlyif => $onlyif,
|
67
|
-
require => Archive::Download["${name}.${extension}"]
|
68
|
-
}
|
69
|
-
|
70
|
-
}
|
@@ -1,7 +0,0 @@
|
|
1
|
-
define archive::zip($source, $target) {
|
2
|
-
exec {"$name unpack":
|
3
|
-
command => "TMPFILE=\$(mktemp); curl -o \${TMPFILE}.zip ${source} && unzip \${TMPFILE}.zip -d ${target} && rm \$TMPFILE && rm \${TMPFILE}.zip && touch ${name}",
|
4
|
-
creates => $name,
|
5
|
-
require => Package['unzip'],
|
6
|
-
}
|
7
|
-
}
|
@@ -1,26 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"name": "jproyo-archive",
|
3
|
-
"version": "0.0.4",
|
4
|
-
"source": "https://github.com/mxhero/puppet-modules/tree/master/modules/archive",
|
5
|
-
"author": "Juan Pablo Royo",
|
6
|
-
"license": "Apache 2.0",
|
7
|
-
"summary": "Archive download and extractor to manage tar, zip, tarballs, etc.",
|
8
|
-
"description": "Archive download and extractor to manage tar, zip, tarballs, etc.",
|
9
|
-
"project_page": "https://github.com/mxhero/puppet-modules/tree/master/modules/archive",
|
10
|
-
"dependencies": [
|
11
|
-
|
12
|
-
],
|
13
|
-
"types": [
|
14
|
-
|
15
|
-
],
|
16
|
-
"checksums": {
|
17
|
-
"LICENSE-2.0.txt": "3b83ef96387f14655fc854ddc3c6bd57",
|
18
|
-
"Modulefile": "a76a4c40cc1d9f180cc939b25ffef2d7",
|
19
|
-
"README.md": "4d073a0b89325bec1043077da735d2b6",
|
20
|
-
"manifests/download.pp": "4534c4e36c4c66709d6c7c2b81c0bb4d",
|
21
|
-
"manifests/extract.pp": "b71cf3b77a20be26f2955e16c4ddf322",
|
22
|
-
"manifests/init.pp": "7736371f5930f37ba1eadde4b3015c83",
|
23
|
-
"manifests/tar-gz.pp": "b5be6abbf6117ced47a607c44cb32bba",
|
24
|
-
"manifests/zip.pp": "6acec396618df9c492a576c1fb372b6c"
|
25
|
-
}
|
26
|
-
}
|
data/spec/spec_helper.rb
DELETED
@@ -1,47 +0,0 @@
|
|
1
|
-
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '../', 'lib'))
|
2
|
-
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
3
|
-
require 'rspec'
|
4
|
-
require 'rubyipmi'
|
5
|
-
require 'coveralls'
|
6
|
-
Coveralls.wear!
|
7
|
-
# Requires supporting files with custom matchers and macros, etc,
|
8
|
-
# in ./support/ and its subdirectories.
|
9
|
-
|
10
|
-
#Dir["#{File.dirname(__FILE__)}/unit/**/*.rb"].each {|f| require f}
|
11
|
-
|
12
|
-
def command_is_eql?(source, expected)
|
13
|
-
src = source.split(' ')
|
14
|
-
exp = expected.split(' ')
|
15
|
-
return exp - src
|
16
|
-
end
|
17
|
-
|
18
|
-
def verify_freeipmi_command(cmdobj, exp_args_count, expcmd)
|
19
|
-
actual = cmdobj.lastcall
|
20
|
-
actual.scan(/(^#{Regexp.escape(expcmd)})/) do |cmd_match|
|
21
|
-
expect(cmd_match.first).to eq(expcmd)
|
22
|
-
end
|
23
|
-
args_match = actual.scan(/(\-{2}[\w-]*=?[-\w\/]*)/)
|
24
|
-
# not sure how to exactly test for arguments since they could vary, so we will need to use count for now
|
25
|
-
#args_match.should =~ exp_args
|
26
|
-
expect(args_match.count).to eq(exp_args_count)
|
27
|
-
end
|
28
|
-
|
29
|
-
|
30
|
-
def verify_ipmitool_command(cmdobj, exp_args_count, expcmd, required_args)
|
31
|
-
actual = cmdobj.lastcall
|
32
|
-
actual.scan(/(^#{Regexp.escape(expcmd)})/) do |cmd_match|
|
33
|
-
expect(cmd_match.first).to eq(expcmd)
|
34
|
-
end
|
35
|
-
args_match = actual.scan(/(-\w\s[\w\d\S]*)/)
|
36
|
-
expect(actual.include?(required_args)).to eq true
|
37
|
-
# not sure how to exactly test for arguments since they could vary, so we will need to use count for now
|
38
|
-
#args_match.should =~ exp_args
|
39
|
-
expect(args_match.count).to eq(exp_args_count)
|
40
|
-
end
|
41
|
-
|
42
|
-
|
43
|
-
RSpec.configure do |config|
|
44
|
-
config.expect_with :rspec do |c|
|
45
|
-
c.syntax = [:expect]
|
46
|
-
end
|
47
|
-
end
|