boxgrinder-build 0.4.1 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +7 -0
- data/Manifest +0 -0
- data/Rakefile +11 -0
- data/bin/boxgrinder-build +33 -27
- data/boxgrinder-build.gemspec +38 -0
- data/lib/boxgrinder-build/appliance.rb +32 -41
- data/lib/boxgrinder-build/helpers/appliance-customize-helper.rb +3 -48
- data/lib/boxgrinder-build/helpers/guestfs-helper.rb +98 -12
- data/lib/boxgrinder-build/helpers/linux-helper.rb +69 -0
- data/lib/boxgrinder-build/helpers/package-helper.rb +20 -11
- data/lib/boxgrinder-build/helpers/plugin-helper.rb +32 -32
- data/lib/boxgrinder-build/managers/plugin-manager.rb +98 -0
- data/lib/boxgrinder-build/plugins/base-plugin.rb +70 -17
- data/spec/Rakefile +13 -0
- data/spec/appliance-spec.rb +195 -0
- data/spec/helpers/appliance-customize-helper-spec.rb +30 -0
- data/spec/helpers/guestfs-helper-spec.rb +129 -0
- data/spec/helpers/linux-helper-spec.rb +50 -0
- data/spec/helpers/package-helper-spec.rb +6 -0
- data/spec/helpers/plugin-helper-spec.rb +63 -0
- data/spec/managers/plugin-manager-spec.rb +27 -0
- data/spec/plugins/base-plugin-spec.rb +89 -0
- data/spec/rspec/src/appliances/jeos-f13.appl +27 -0
- metadata +60 -157
- data/docs/examples/appliances/appliances.appl +0 -5
- data/docs/examples/appliances/minimal.appl +0 -9
- data/docs/examples/appliances/mix.appl +0 -8
- data/docs/examples/appliances/packages.appl +0 -13
- data/docs/node-info/pom.xml +0 -31
- data/docs/node-info/src/main/webapp/META-INF/MANIFEST.MF +0 -3
- data/docs/node-info/src/main/webapp/WEB-INF/web.xml +0 -7
- data/docs/node-info/src/main/webapp/index.jsp +0 -70
- data/lib/boxgrinder-build/helpers/rake-helper.rb +0 -71
- data/lib/boxgrinder-build/managers/base-plugin-manager.rb +0 -62
- data/lib/boxgrinder-build/managers/delivery-plugin-manager.rb +0 -39
- data/lib/boxgrinder-build/managers/operating-system-plugin-manager.rb +0 -6
- data/lib/boxgrinder-build/managers/platform-plugin-manager.rb +0 -26
- data/lib/boxgrinder-build/plugins/delivery/base/base-delivery-plugin.rb +0 -43
- data/lib/boxgrinder-build/plugins/delivery/local/local-plugin.rb +0 -57
- data/lib/boxgrinder-build/plugins/delivery/s3/aws-helper.rb +0 -64
- data/lib/boxgrinder-build/plugins/delivery/s3/s3-plugin.rb +0 -190
- data/lib/boxgrinder-build/plugins/delivery/sftp/sftp-plugin.rb +0 -159
- data/lib/boxgrinder-build/plugins/os/base/kickstart.rb +0 -148
- data/lib/boxgrinder-build/plugins/os/base/rhel-based-os-plugin.rb +0 -51
- data/lib/boxgrinder-build/plugins/os/base/rpm-based-os-plugin.rb +0 -134
- data/lib/boxgrinder-build/plugins/os/base/src/appliance.ks.erb +0 -41
- data/lib/boxgrinder-build/plugins/os/base/src/base.repo +0 -4
- data/lib/boxgrinder-build/plugins/os/base/src/motd.init +0 -21
- data/lib/boxgrinder-build/plugins/os/base/validators/rpm-dependency-validator.rb +0 -162
- data/lib/boxgrinder-build/plugins/os/base-operating-system-plugin.rb +0 -37
- data/lib/boxgrinder-build/plugins/os/centos/centos-plugin.rb +0 -52
- data/lib/boxgrinder-build/plugins/os/fedora/fedora-plugin.rb +0 -74
- data/lib/boxgrinder-build/plugins/os/rhel/rhel-plugin.rb +0 -40
- data/lib/boxgrinder-build/plugins/platform/base-platform-plugin.rb +0 -37
- data/lib/boxgrinder-build/plugins/platform/ec2/ec2-plugin.rb +0 -332
- data/lib/boxgrinder-build/plugins/platform/ec2/src/f12/yum.conf +0 -24
- data/lib/boxgrinder-build/plugins/platform/ec2/src/f12-i386-boxgrinder.repo +0 -11
- data/lib/boxgrinder-build/plugins/platform/ec2/src/f12-x86_64-boxgrinder.repo +0 -11
- data/lib/boxgrinder-build/plugins/platform/ec2/src/fstab_32bit +0 -8
- data/lib/boxgrinder-build/plugins/platform/ec2/src/fstab_64bit +0 -8
- data/lib/boxgrinder-build/plugins/platform/ec2/src/ifcfg-eth0 +0 -7
- data/lib/boxgrinder-build/plugins/platform/ec2/src/rc_local +0 -29
- data/lib/boxgrinder-build/plugins/platform/vmware/src/README +0 -42
- data/lib/boxgrinder-build/plugins/platform/vmware/src/base.vmdk +0 -19
- data/lib/boxgrinder-build/plugins/platform/vmware/src/base.vmx +0 -45
- data/lib/boxgrinder-build/plugins/platform/vmware/vmware-plugin.rb +0 -181
- data/lib/boxgrinder-build/validators/appliance-config-parameter-validator.rb +0 -37
- data/lib/boxgrinder-build/validators/appliance-validator.rb +0 -84
- data/lib/boxgrinder-build/validators/config-validator.rb +0 -48
- data/lib/boxgrinder-build/validators/ssh-validator.rb +0 -35
- data/lib/boxgrinder-build/validators/validator.rb +0 -91
data/docs/node-info/pom.xml
DELETED
@@ -1,31 +0,0 @@
|
|
1
|
-
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
2
|
-
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
3
|
-
<modelVersion>4.0.0</modelVersion>
|
4
|
-
<groupId>org.jboss.cloud</groupId>
|
5
|
-
<artifactId>node-info</artifactId>
|
6
|
-
<packaging>war</packaging>
|
7
|
-
<version>1.0-SNAPSHOT</version>
|
8
|
-
<name>JBoss-Cloud node info</name>
|
9
|
-
<url>http://oddthesis.org/</url>
|
10
|
-
<dependencies>
|
11
|
-
<dependency>
|
12
|
-
<groupId>junit</groupId>
|
13
|
-
<artifactId>junit</artifactId>
|
14
|
-
<version>3.8.1</version>
|
15
|
-
<scope>test</scope>
|
16
|
-
</dependency>
|
17
|
-
</dependencies>
|
18
|
-
<developers>
|
19
|
-
<developer>
|
20
|
-
<name>Marek Goldmann</name>
|
21
|
-
<url>http://ordinarythoughts.org/</url>
|
22
|
-
</developer>
|
23
|
-
</developers>
|
24
|
-
<organization>
|
25
|
-
<name>JBoss</name>
|
26
|
-
<url>http://jboss.org/</url>
|
27
|
-
</organization>
|
28
|
-
<build>
|
29
|
-
<finalName>node-info</finalName>
|
30
|
-
</build>
|
31
|
-
</project>
|
@@ -1,70 +0,0 @@
|
|
1
|
-
<%@page contentType="text/html"
|
2
|
-
import="java.net.*,java.util.*,java.io.*"%>
|
3
|
-
|
4
|
-
<html>
|
5
|
-
<head>
|
6
|
-
<title>JBoss-Cloud node info</title>
|
7
|
-
</head>
|
8
|
-
<body>
|
9
|
-
|
10
|
-
<%
|
11
|
-
//borrowed from jmx-console
|
12
|
-
|
13
|
-
String bindAddress = "";
|
14
|
-
String serverName = "";
|
15
|
-
try {
|
16
|
-
bindAddress = System.getProperty("jboss.bind.address", "");
|
17
|
-
serverName = System.getProperty("jboss.server.name", "");
|
18
|
-
} catch (SecurityException se) {
|
19
|
-
}
|
20
|
-
|
21
|
-
String hostname = "";
|
22
|
-
try {
|
23
|
-
hostname = InetAddress.getLocalHost().getHostName();
|
24
|
-
} catch (IOException e) {
|
25
|
-
}
|
26
|
-
|
27
|
-
String hostInfo = hostname;
|
28
|
-
if (!bindAddress.equals("")) {
|
29
|
-
hostInfo = hostInfo + " (" + bindAddress + ")";
|
30
|
-
}
|
31
|
-
%>
|
32
|
-
|
33
|
-
|
34
|
-
<table>
|
35
|
-
<%
|
36
|
-
if (bindAddress.length() > 0) {
|
37
|
-
%>
|
38
|
-
<tr>
|
39
|
-
<td>JBoss Address:</td>
|
40
|
-
<td><%=bindAddress%></td>
|
41
|
-
</tr>
|
42
|
-
|
43
|
-
<%
|
44
|
-
}
|
45
|
-
if (serverName.length() > 0) {
|
46
|
-
%>
|
47
|
-
<tr>
|
48
|
-
<td>JBoss profile:</td>
|
49
|
-
<td><%=serverName%></td>
|
50
|
-
</tr>
|
51
|
-
<%
|
52
|
-
}
|
53
|
-
%>
|
54
|
-
<tr>
|
55
|
-
<td>Server name:</td>
|
56
|
-
<td><%=request.getServerName()%></td>
|
57
|
-
</tr>
|
58
|
-
<tr>
|
59
|
-
<td>Server port:</td>
|
60
|
-
<td><%=request.getServerPort()%></td>
|
61
|
-
</tr>
|
62
|
-
<tr>
|
63
|
-
<td>Remote address:</td>
|
64
|
-
<td><%=request.getRemoteAddr()%></td>
|
65
|
-
</tr>
|
66
|
-
|
67
|
-
</table>
|
68
|
-
|
69
|
-
</body>
|
70
|
-
</html>
|
@@ -1,71 +0,0 @@
|
|
1
|
-
# JBoss, Home of Professional Open Source
|
2
|
-
# Copyright 2009, Red Hat Middleware LLC, and individual contributors
|
3
|
-
# by the @authors tag. See the copyright.txt in the distribution for a
|
4
|
-
# full listing of individual contributors.
|
5
|
-
#
|
6
|
-
# This is free software; you can redistribute it and/or modify it
|
7
|
-
# under the terms of the GNU Lesser General Public License as
|
8
|
-
# published by the Free Software Foundation; either version 2.1 of
|
9
|
-
# the License, or (at your option) any later version.
|
10
|
-
#
|
11
|
-
# This software is distributed in the hope that it will be useful,
|
12
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
14
|
-
# Lesser General Public License for more details.
|
15
|
-
#
|
16
|
-
# You should have received a copy of the GNU Lesser General Public
|
17
|
-
# License along with this software; if not, write to the Free
|
18
|
-
# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
|
19
|
-
# 02110-1301 USA, or see the FSF site: http://www.fsf.org.
|
20
|
-
|
21
|
-
require 'rubygems'
|
22
|
-
require 'boxgrinder-build/boxgrinder'
|
23
|
-
require 'boxgrinder-core/helpers/log-helper'
|
24
|
-
|
25
|
-
gem 'amazon-ec2', '>= 0.9.6'
|
26
|
-
gem 'aws-s3', '>= 0.6.2'
|
27
|
-
gem 'net-sftp', '>= 2.0.4'
|
28
|
-
gem 'net-ssh', '>= 2.0.20'
|
29
|
-
|
30
|
-
module Rake
|
31
|
-
class Task
|
32
|
-
alias_method :execute_original_boxgrinder, :execute
|
33
|
-
|
34
|
-
def execute( args = nil )
|
35
|
-
begin
|
36
|
-
execute_original_boxgrinder( args )
|
37
|
-
rescue => e
|
38
|
-
log = BoxGrinder::LOG
|
39
|
-
log.fatal e.info
|
40
|
-
log.fatal "Aborting: #{e.message}. See previous errors for more information."
|
41
|
-
abort
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
module BoxGrinder
|
48
|
-
|
49
|
-
LOG = LogHelper.new
|
50
|
-
|
51
|
-
class RakeHelper
|
52
|
-
def initialize( project_config = {} )
|
53
|
-
log = LOG
|
54
|
-
begin
|
55
|
-
log.debug "Running new Rake session..."
|
56
|
-
@config = BoxGrinder.new( project_config ).config
|
57
|
-
rescue ValidationError => e
|
58
|
-
log.fatal "ValidationError: #{e.message}."
|
59
|
-
abort
|
60
|
-
rescue => e
|
61
|
-
log.fatal e
|
62
|
-
log.fatal "Aborting: #{e.message}. See previous errors for more information."
|
63
|
-
abort
|
64
|
-
end
|
65
|
-
end
|
66
|
-
|
67
|
-
attr_reader :config
|
68
|
-
end
|
69
|
-
end
|
70
|
-
|
71
|
-
|
@@ -1,62 +0,0 @@
|
|
1
|
-
# JBoss, Home of Professional Open Source
|
2
|
-
# Copyright 2009, Red Hat Middleware LLC, and individual contributors
|
3
|
-
# by the @authors tag. See the copyright.txt in the distribution for a
|
4
|
-
# full listing of individual contributors.
|
5
|
-
#
|
6
|
-
# This is free software; you can redistribute it and/or modify it
|
7
|
-
# under the terms of the GNU Lesser General Public License as
|
8
|
-
# published by the Free Software Foundation; either version 2.1 of
|
9
|
-
# the License, or (at your option) any later version.
|
10
|
-
#
|
11
|
-
# This software is distributed in the hope that it will be useful,
|
12
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
14
|
-
# Lesser General Public License for more details.
|
15
|
-
#
|
16
|
-
# You should have received a copy of the GNU Lesser General Public
|
17
|
-
# License along with this software; if not, write to the Free
|
18
|
-
# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
|
19
|
-
# 02110-1301 USA, or see the FSF site: http://www.fsf.org.
|
20
|
-
|
21
|
-
require 'singleton'
|
22
|
-
|
23
|
-
module BoxGrinder
|
24
|
-
class BasePluginManager
|
25
|
-
include Singleton
|
26
|
-
|
27
|
-
def initialize
|
28
|
-
@plugin_classes = []
|
29
|
-
@plugins = {}
|
30
|
-
end
|
31
|
-
|
32
|
-
def <<(plugin_class)
|
33
|
-
@plugin_classes << plugin_class
|
34
|
-
end
|
35
|
-
|
36
|
-
def initialize_plugins( options = {} )
|
37
|
-
log = options[:log] || Logger.new(STDOUT)
|
38
|
-
|
39
|
-
@plugin_classes.each do |plugin_class|
|
40
|
-
begin
|
41
|
-
plugin = plugin_class.new
|
42
|
-
rescue => e
|
43
|
-
raise "Error while initializing #{plugin_class} plugin.", e
|
44
|
-
end
|
45
|
-
|
46
|
-
next unless plugin.respond_to?(:info)
|
47
|
-
|
48
|
-
plugin.instance_variable_set( :@log, log )
|
49
|
-
|
50
|
-
if @plugins[plugin.info[:name]].nil?
|
51
|
-
@plugins[plugin.info[:name]] = plugin
|
52
|
-
else
|
53
|
-
raise "We already have registered plugin for #{plugin.info[:name]}."
|
54
|
-
end
|
55
|
-
end
|
56
|
-
self
|
57
|
-
end
|
58
|
-
|
59
|
-
attr_reader :plugins
|
60
|
-
|
61
|
-
end
|
62
|
-
end
|
@@ -1,39 +0,0 @@
|
|
1
|
-
# JBoss, Home of Professional Open Source
|
2
|
-
# Copyright 2009, Red Hat Middleware LLC, and individual contributors
|
3
|
-
# by the @authors tag. See the copyright.txt in the distribution for a
|
4
|
-
# full listing of individual contributors.
|
5
|
-
#
|
6
|
-
# This is free software; you can redistribute it and/or modify it
|
7
|
-
# under the terms of the GNU Lesser General Public License as
|
8
|
-
# published by the Free Software Foundation; either version 2.1 of
|
9
|
-
# the License, or (at your option) any later version.
|
10
|
-
#
|
11
|
-
# This software is distributed in the hope that it will be useful,
|
12
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
14
|
-
# Lesser General Public License for more details.
|
15
|
-
#
|
16
|
-
# You should have received a copy of the GNU Lesser General Public
|
17
|
-
# License along with this software; if not, write to the Free
|
18
|
-
# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
|
19
|
-
# 02110-1301 USA, or see the FSF site: http://www.fsf.org.
|
20
|
-
|
21
|
-
require 'boxgrinder-build/managers/base-plugin-manager'
|
22
|
-
|
23
|
-
module BoxGrinder
|
24
|
-
class DeliveryPluginManager < BasePluginManager
|
25
|
-
def types
|
26
|
-
t = {}
|
27
|
-
|
28
|
-
@plugins.each_value do |plugin|
|
29
|
-
plugin.info[:type].each do |type|
|
30
|
-
t[type] = plugin
|
31
|
-
end
|
32
|
-
|
33
|
-
end
|
34
|
-
|
35
|
-
t
|
36
|
-
end
|
37
|
-
|
38
|
-
end
|
39
|
-
end
|
@@ -1,26 +0,0 @@
|
|
1
|
-
# JBoss, Home of Professional Open Source
|
2
|
-
# Copyright 2009, Red Hat Middleware LLC, and individual contributors
|
3
|
-
# by the @authors tag. See the copyright.txt in the distribution for a
|
4
|
-
# full listing of individual contributors.
|
5
|
-
#
|
6
|
-
# This is free software; you can redistribute it and/or modify it
|
7
|
-
# under the terms of the GNU Lesser General Public License as
|
8
|
-
# published by the Free Software Foundation; either version 2.1 of
|
9
|
-
# the License, or (at your option) any later version.
|
10
|
-
#
|
11
|
-
# This software is distributed in the hope that it will be useful,
|
12
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
14
|
-
# Lesser General Public License for more details.
|
15
|
-
#
|
16
|
-
# You should have received a copy of the GNU Lesser General Public
|
17
|
-
# License along with this software; if not, write to the Free
|
18
|
-
# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
|
19
|
-
# 02110-1301 USA, or see the FSF site: http://www.fsf.org.
|
20
|
-
|
21
|
-
require 'boxgrinder-build/managers/base-plugin-manager'
|
22
|
-
|
23
|
-
module BoxGrinder
|
24
|
-
class PlatformPluginManager < BasePluginManager
|
25
|
-
end
|
26
|
-
end
|
@@ -1,43 +0,0 @@
|
|
1
|
-
# JBoss, Home of Professional Open Source
|
2
|
-
# Copyright 2009, Red Hat Middleware LLC, and individual contributors
|
3
|
-
# by the @authors tag. See the copyright.txt in the distribution for a
|
4
|
-
# full listing of individual contributors.
|
5
|
-
#
|
6
|
-
# This is free software; you can redistribute it and/or modify it
|
7
|
-
# under the terms of the GNU Lesser General Public License as
|
8
|
-
# published by the Free Software Foundation; either version 2.1 of
|
9
|
-
# the License, or (at your option) any later version.
|
10
|
-
#
|
11
|
-
# This software is distributed in the hope that it will be useful,
|
12
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
14
|
-
# Lesser General Public License for more details.
|
15
|
-
#
|
16
|
-
# You should have received a copy of the GNU Lesser General Public
|
17
|
-
# License along with this software; if not, write to the Free
|
18
|
-
# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
|
19
|
-
# 02110-1301 USA, or see the FSF site: http://www.fsf.org.
|
20
|
-
|
21
|
-
require 'boxgrinder-build/managers/delivery-plugin-manager'
|
22
|
-
require 'boxgrinder-build/plugins/base-plugin'
|
23
|
-
|
24
|
-
module BoxGrinder
|
25
|
-
class BaseDeliveryPlugin < BasePlugin
|
26
|
-
alias_method :execute_original, :execute
|
27
|
-
|
28
|
-
def execute( deliverables, type)
|
29
|
-
raise "Delivery cannot be started before the plugin isn't initialized" if @initialized.nil?
|
30
|
-
raise "Not valid delivery type selected for #{info[:name]} plugin: #{type}. Available types: #{info[:type].join(" ")}" unless info[:type].include?(type)
|
31
|
-
|
32
|
-
execute_original( deliverables, type )
|
33
|
-
end
|
34
|
-
|
35
|
-
def self.inherited(klass)
|
36
|
-
DeliveryPluginManager.instance << klass
|
37
|
-
end
|
38
|
-
|
39
|
-
def already_delivered?
|
40
|
-
false
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
@@ -1,57 +0,0 @@
|
|
1
|
-
require 'boxgrinder-build/plugins/delivery/base/base-delivery-plugin'
|
2
|
-
|
3
|
-
module BoxGrinder
|
4
|
-
class LocalPlugin < BaseDeliveryPlugin
|
5
|
-
def info
|
6
|
-
{
|
7
|
-
:name => :local,
|
8
|
-
:type => [:local],
|
9
|
-
:full_name => "Local file system"
|
10
|
-
}
|
11
|
-
end
|
12
|
-
|
13
|
-
def after_init
|
14
|
-
set_default_config_value('overwrite', true)
|
15
|
-
set_default_config_value('package', true)
|
16
|
-
end
|
17
|
-
|
18
|
-
def execute(deliverables, type = :local)
|
19
|
-
validate_plugin_config( [ 'path' ], 'http://community.jboss.org/docs/DOC-15216' )
|
20
|
-
|
21
|
-
files = []
|
22
|
-
|
23
|
-
if @plugin_config['package']
|
24
|
-
files << PackageHelper.new(@config, @appliance_config, {:log => @log, :exec_helper => @exec_helper}).package(deliverables)
|
25
|
-
else
|
26
|
-
files << deliverables[:disk]
|
27
|
-
|
28
|
-
[:metadata, :other].each do |deliverable_type|
|
29
|
-
deliverables[deliverable_type].each_value do |file|
|
30
|
-
files << file
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
if @plugin_config['overwrite'] or !already_delivered?(files)
|
36
|
-
FileUtils.mkdir_p @plugin_config['path']
|
37
|
-
|
38
|
-
@log.debug "Copying files to destination..."
|
39
|
-
|
40
|
-
files.each do |file|
|
41
|
-
@log.debug "Copying #{file}..."
|
42
|
-
FileUtils.cp(file, @plugin_config['path'])
|
43
|
-
end
|
44
|
-
@log.info "Appliance delivered to #{@plugin_config['path']}."
|
45
|
-
else
|
46
|
-
@log.info "Appliance already delivered to #{@plugin_config['path']}."
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
def already_delivered?(files)
|
51
|
-
files.each do |file|
|
52
|
-
return false unless File.exists?("#{@plugin_config['path']}/#{File.basename(file)}")
|
53
|
-
end
|
54
|
-
true
|
55
|
-
end
|
56
|
-
end
|
57
|
-
end
|
@@ -1,64 +0,0 @@
|
|
1
|
-
# JBoss, Home of Professional Open Source
|
2
|
-
# Copyright 2009, Red Hat Middleware LLC, and individual contributors
|
3
|
-
# by the @authors tag. See the copyright.txt in the distribution for a
|
4
|
-
# full listing of individual contributors.
|
5
|
-
#
|
6
|
-
# This is free software; you can redistribute it and/or modify it
|
7
|
-
# under the terms of the GNU Lesser General Public License as
|
8
|
-
# published by the Free Software Foundation; either version 2.1 of
|
9
|
-
# the License, or (at your option) any later version.
|
10
|
-
#
|
11
|
-
# This software is distributed in the hope that it will be useful,
|
12
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
14
|
-
# Lesser General Public License for more details.
|
15
|
-
#
|
16
|
-
# You should have received a copy of the GNU Lesser General Public
|
17
|
-
# License along with this software; if not, write to the Free
|
18
|
-
# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
|
19
|
-
# 02110-1301 USA, or see the FSF site: http://www.fsf.org.
|
20
|
-
|
21
|
-
require 'AWS'
|
22
|
-
require 'aws/s3'
|
23
|
-
|
24
|
-
module BoxGrinder
|
25
|
-
class AWSHelper
|
26
|
-
def initialize( config, appliance_config, plugin_config )
|
27
|
-
@config = config
|
28
|
-
@appliance_config = appliance_config
|
29
|
-
@plugin_config = plugin_config
|
30
|
-
|
31
|
-
# remove dashes from account number
|
32
|
-
@plugin_config['account_number'] = @plugin_config['account_number'].to_s.gsub(/-/, '')
|
33
|
-
|
34
|
-
@ec2 = AWS::EC2::Base.new(:access_key_id => @plugin_config['access_key'], :secret_access_key => @plugin_config['secret_access_key'])
|
35
|
-
@s3 = AWS::S3::Base.establish_connection!(:access_key_id => @plugin_config['access_key'], :secret_access_key => @plugin_config['secret_access_key'] )
|
36
|
-
end
|
37
|
-
|
38
|
-
attr_reader :plugin_config
|
39
|
-
attr_reader :ec2
|
40
|
-
attr_reader :s3
|
41
|
-
|
42
|
-
def bucket_key( appliance_name, path )
|
43
|
-
"#{@plugin_config['bucket']}#{path}/#{appliance_name}/#{@appliance_config.version}.#{@appliance_config.release}/#{@appliance_config.hardware.arch}"
|
44
|
-
end
|
45
|
-
|
46
|
-
def bucket_manifest_key( appliance_name, path )
|
47
|
-
"#{bucket_key( appliance_name, path )}/#{appliance_name}.ec2.manifest.xml"
|
48
|
-
end
|
49
|
-
|
50
|
-
def ami_info( appliance_name, path )
|
51
|
-
ami_info = nil
|
52
|
-
|
53
|
-
images = @ec2.describe_images( :owner_id => @plugin_config['account_number'] ).imagesSet
|
54
|
-
|
55
|
-
return nil if images.nil?
|
56
|
-
|
57
|
-
for image in images.item do
|
58
|
-
ami_info = image if (image.imageLocation.eql?( bucket_manifest_key( appliance_name, path ) ))
|
59
|
-
end
|
60
|
-
|
61
|
-
ami_info
|
62
|
-
end
|
63
|
-
end
|
64
|
-
end
|