This repository was archived by the owner on Feb 16, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 6a21e98
Showing
534 changed files
with
87,952 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
.gradle | ||
build | ||
target | ||
staging | ||
.idea | ||
/bin/ | ||
.classpath | ||
.project | ||
.settings | ||
*.iml | ||
openstack-test.properties | ||
ecplugin.properties |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# | ||
# Makefile responsible for building the EC-EC2 plugin | ||
# | ||
# Copyright (c) 2005-2012 Electric Cloud, Inc. | ||
# All rights reserved | ||
|
||
SRCTOP = .. | ||
include $(SRCTOP)/build/vars.mak | ||
|
||
build: package | ||
unittest: | ||
systemtest:test-setup test-run | ||
|
||
NTESTFILES ?= systemtest | ||
|
||
NTESTINCLUDES += -I../../perlapi/lib | ||
|
||
TEST_SERVER_PORT ?= 0 | ||
|
||
test-setup: | ||
$(EC_PERL) ../EC-EC2/systemtest/setup.pl $(TEST_SERVER) $(PLUGINS_ARTIFACTS) --auxport $(TEST_SERVER_PORT) | ||
|
||
test-run: systemtest-run | ||
|
||
test: build install promote | ||
|
||
include $(SRCTOP)/build/rules.mak |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// -*- Groovy -*- | ||
// build.gradle | ||
// | ||
// Gradle build script for EC-EC2 plugin. | ||
// | ||
// Copyright (c) 2015 Electric Cloud, Inc. | ||
// All rights reserved | ||
|
||
buildscript { | ||
repositories { | ||
maven { | ||
url 'http://dl.bintray.com/ecpluginsdev/maven' | ||
} | ||
|
||
jcenter() | ||
} | ||
dependencies { | ||
classpath group: 'com.electriccloud.plugins', name: 'flow-gradle-plugin', version: '+' | ||
} | ||
} | ||
|
||
repositories { | ||
maven { | ||
url "https://oss.sonatype.org/content/repositories/snapshots" | ||
} | ||
} | ||
|
||
group = "com.electriccloud" | ||
description = "Plugins : EC-EC2" | ||
version = "2.3.1" | ||
|
||
apply plugin: 'flow-gradle-plugin' | ||
|
||
dependencies { | ||
compile group: project.group, name: "commander-sdk", version: "5.0.2-SNAPSHOT" | ||
compile group: project.group, name: "ec_internal", version: "5.1.1-SNAPSHOT" | ||
} | ||
|
||
task wrapper(type: Wrapper) { | ||
gradleVersion = '2.3' | ||
} | ||
|
||
gwt { | ||
modules 'ecplugins.ec2.ConfigurationManagement' | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<project name="EC-EC2" default="package" basedir="."> | ||
<description> | ||
Build the EC-EC2 plugin | ||
</description> | ||
|
||
<property name="buildconfigdir" value="c:/tools/CommanderSDK/build" /> | ||
|
||
<!-- plugin specific properties --> | ||
<property name="pluginKey" value="EC-EC2" /> | ||
<property name="pluginVersion" value="1.0.0.0" /> | ||
<property name="gwtModules" value="ecplugins.ec2.ConfigurationManagement" /> | ||
<property name="package.export.src" value="ec2.srcs"/> | ||
|
||
<path id="extras"> | ||
<pathelement location="../../../out/common/main/ec_internal/ec_internal.jar"/> | ||
</path> | ||
<property name="gwt.path.extras" value="extras" /> | ||
|
||
<import file="${buildconfigdir}/buildTargets.xml"/> | ||
|
||
<!-- Package sources for exported utility classes. --> | ||
<fileset id="ec2.srcs" dir="${dir.src}"> | ||
<include name="**/PluginConstants.java"/> | ||
<include name="**/EC2ConfigList.java"/> | ||
<include name="**/EC2ConfigListLoader.*"/> | ||
</fileset> | ||
</project> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,195 @@ | ||
#!/bin/sh | ||
|
||
exec "$COMMANDER_HOME/bin/ec-perl" -x "$0" "${@}" | ||
|
||
#!perl | ||
# ec2.cgi - | ||
# | ||
# Get/set EC-EC2 configuration info for UI | ||
# | ||
# The following special keyword indicates that the "cleanup" script should | ||
# scan this file for formatting errors, even though it doesn't have one of | ||
# the expected extensions. | ||
# CLEANUP: CHECK | ||
# | ||
# Copyright (c) 2007-2009 Electric Cloud, Inc. | ||
# All rights reserved | ||
|
||
#use strict; | ||
#no strict "subs"; | ||
#use warnings; | ||
use Getopt::Long; | ||
use File::Spec; | ||
use File::Temp; | ||
use ElectricCommander; | ||
use ElectricCommander::PropMod; | ||
use ElectricCommander::PropDB; | ||
use CGI qw(:standard); | ||
|
||
# used for output redirection | ||
$::tmpOut = ""; | ||
$::tmpErr = ""; | ||
$::oldout; | ||
$::olderr; | ||
|
||
#------------------------------------------------------------------------- | ||
# main | ||
# | ||
# Main program for the application. | ||
#------------------------------------------------------------------------- | ||
|
||
sub main() { | ||
|
||
## globals | ||
$::cg = CGI->new(); | ||
$::opts = $::cg->Vars; | ||
$::ec = new ElectricCommander(); | ||
$::ec->abortOnError(0); | ||
|
||
# make sure no libraries print to STDOUT | ||
saveOutErr(); | ||
|
||
# Check for required arguments. | ||
if (!defined $::opts->{cmd} || "$::opts->{cmd}" eq "") { | ||
retError("error: cmd is required parameter"); | ||
} | ||
|
||
# --------------------------------------------------------------- | ||
# Dispatch operation | ||
# --------------------------------------------------------------- | ||
for ($::opts->{cmd}) | ||
{ | ||
# modes | ||
/getCfgList/i and do { getCfgList(); last; }; | ||
} | ||
retError("unknown command $::opts->{cmd}"); | ||
|
||
exit 0; | ||
} | ||
|
||
|
||
############################################# | ||
# getCfgList | ||
# | ||
# Return the list of configurations | ||
############################################# | ||
sub getCfgList { | ||
|
||
my $gcfg = new ElectricCommander::PropDB($::ec,"/projects/@PLUGIN_NAME@/ec2_cfgs"); | ||
|
||
my %cfgs = $gcfg->getRows(); | ||
# print results as XML block | ||
my $xml = ""; | ||
$xml .= "<cfgs>\n"; | ||
foreach my $cfg (keys %cfgs) { | ||
my $service_url = $gcfg->getCol("$cfg/service_url"); | ||
my $desc = eval { $gcfg->getCol("$cfg/description") }; | ||
$xml .= " <cfg>\n"; | ||
$xml .= " <name>$cfg</name>\n"; | ||
$xml .= " <service_url>" . xmlQuote($service_url) . "</service_url>\n"; | ||
$xml .= " <desc>" . xmlQuote($desc) . "</desc>\n"; | ||
$xml .= " </cfg>\n"; | ||
} | ||
$xml .= "</cfgs>\n"; | ||
printXML($xml); | ||
exit 0; | ||
} | ||
|
||
############################################## | ||
# retError | ||
# | ||
# return an error message | ||
############################################## | ||
sub retError { | ||
my $msg = shift; | ||
|
||
printXML("<error>$msg</error>\n"); | ||
exit 1; | ||
} | ||
|
||
############################################## | ||
# printXML | ||
# | ||
# print the XML block, add stdout, stderr | ||
############################################## | ||
sub printXML { | ||
my $xml = shift; | ||
|
||
my ($out,$err) = retrieveOutErr(); | ||
print $::cg->header("text/html"); | ||
print "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"; | ||
print "<response>\n"; | ||
print "$xml\n"; | ||
print "<stdout>" . xmlQuote($out) . "</stdout>\n"; | ||
print "<stderr>" . xmlQuote($err) . "</stderr>\n"; | ||
print "</response>"; | ||
} | ||
|
||
|
||
############################################## | ||
# saveOutErr | ||
# | ||
# redirect stdout/stderr to files so that any | ||
# spurious output from commands does not | ||
# end up on the return to the cgi caller | ||
############################################## | ||
sub saveOutErr { | ||
# temporarily save STDOUT/STDERR to files | ||
open $::oldout, ">&STDOUT" or die "Can't dup STDOUT: $!"; | ||
open $::olderr, ">&STDERR" or die "Can't dup STDERR: $!"; | ||
close STDOUT; | ||
open STDOUT, '>', \$::tmpOut or die "Can't open STDOUT: $!"; | ||
close STDERR; | ||
open STDERR, '>', \$::tmpErr or die "Can't open STDOUT: $!"; | ||
|
||
} | ||
|
||
############################################## | ||
# retrieveOutErr | ||
# | ||
# reset stdout/sterr back to normal and | ||
# return the contents of the temp files | ||
############################################## | ||
sub retrieveOutErr { | ||
# reconnect to normal STDOUT/STDERR | ||
open STDOUT, ">&", $::oldout or die "can't reinstate $!"; | ||
open STDERR, ">&", $::olderr or die "can't reinstate $!"; | ||
return ($::tmpOut, $::tmpErr); | ||
} | ||
|
||
#------------------------------------------------------------------------- | ||
# xmlQuote | ||
# | ||
# Quote special characters such as & to generate well-formed XML | ||
# character data. | ||
# | ||
# Results: | ||
# The return value is identical to $string except that &, <, and >, | ||
# have been translated to &, <, and >, respectively. | ||
# | ||
# Side Effects: | ||
# None. | ||
# | ||
# Arguments: | ||
# string - String whose contents should be quoted. | ||
#------------------------------------------------------------------------- | ||
|
||
sub xmlQuote($) { | ||
my ($string) = @_; | ||
|
||
$string =~ s/&/&/g; | ||
$string =~ s/</</g; | ||
$string =~ s/>/>/g; | ||
$string =~ s{([\0-\x{08}\x{0b}\x{0c}\x{0e}-\x{1f}])}{ | ||
sprintf("%%%02x", ord($1))}ge; | ||
return $string; | ||
} | ||
|
||
|
||
main(); | ||
|
||
|
||
|
||
|
||
|
||
|
Oops, something went wrong.