You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@jclouds.apache.org by Ilya Kulakov <no...@github.com> on 2014/08/29 22:20:52 UTC
[jclouds-labs] CloudSigma2 ComputeService and SecurityGroupExtension
(#70)
* Added the ComputeService implementation
* Added the SecurityGroup extension
* Added the San Jose region
You can merge this Pull Request by running:
git pull https://github.com/cloudsigma/jclouds-labs cloudsigma2-compute-service-rebased
Or you can view, comment on it, or merge it online at:
https://github.com/jclouds/jclouds-labs/pull/70
-- Commit Summary --
* CloudSigma2 ComputeService and SecurityGroupExtension
-- File Changes --
A cloudsigma2-hnl/pom.xml (127)
A cloudsigma2-hnl/src/main/java/org/jclouds/cloudsigma2/CloudSigma2HonoluluProviderMetadata.java (80)
A cloudsigma2-hnl/src/main/resources/META-INF/services/org.jclouds.providers.ProviderMetadata (1)
A cloudsigma2-hnl/src/test/java/org/jclouds/cloudsigma2/CloudSigma2HonoluluLiveTest.java (27)
A cloudsigma2-hnl/src/test/java/org/jclouds/cloudsigma2/compute/CloudSigma2HonoluluComputeServiceLiveTest.java (28)
A cloudsigma2-hnl/src/test/java/org/jclouds/cloudsigma2/compute/extensions/CloudSigma2HonoluluSecurityGroupExtensionLiveTest.java (28)
M cloudsigma2-lvs/pom.xml (3)
M cloudsigma2-lvs/src/test/java/org/jclouds/cloudsigma2/CloudSigma2LasVegasLiveTest.java (11)
A cloudsigma2-lvs/src/test/java/org/jclouds/cloudsigma2/compute/CloudSigma2LasVegasComputeServiceLiveTest.java (28)
A cloudsigma2-lvs/src/test/java/org/jclouds/cloudsigma2/compute/extensions/CloudSigma2LasVegasSecurityGroupExtensionLiveTest.java (28)
A cloudsigma2-sjc/pom.xml (127)
A cloudsigma2-sjc/src/main/java/org/jclouds/cloudsigma2/CloudSigma2SanJoseProviderMetadata.java (80)
A cloudsigma2-sjc/src/main/resources/META-INF/services/org.jclouds.providers.ProviderMetadata (1)
A cloudsigma2-sjc/src/test/java/org/jclouds/cloudsigma2/CloudSigma2SanJoseLiveTest.java (27)
A cloudsigma2-sjc/src/test/java/org/jclouds/cloudsigma2/compute/CloudSigma2SanJoseComputeServiceLiveTest.java (28)
A cloudsigma2-sjc/src/test/java/org/jclouds/cloudsigma2/compute/extensions/CloudSigma2SanJoseSecurityGroupExtensionLiveTest.java (28)
M cloudsigma2-wdc/pom.xml (3)
M cloudsigma2-wdc/src/test/java/org/jclouds/cloudsigma2/CloudSigma2WashingtonLiveTest.java (9)
A cloudsigma2-wdc/src/test/java/org/jclouds/cloudsigma2/compute/CloudSigma2WashingtonComputeServiceLiveTest.java (28)
A cloudsigma2-wdc/src/test/java/org/jclouds/cloudsigma2/compute/extensions/CloudSigma2WashingtonSecurityGroupExtensionLiveTest.java (28)
M cloudsigma2-zrh/pom.xml (3)
M cloudsigma2-zrh/src/test/java/org/jclouds/cloudsigma2/CloudSigma2ZurichLiveTest.java (11)
A cloudsigma2-zrh/src/test/java/org/jclouds/cloudsigma2/compute/CloudSigma2ZurichComputeServiceLiveTest.java (28)
A cloudsigma2-zrh/src/test/java/org/jclouds/cloudsigma2/compute/extensions/CloudSigma2ZurichSecurityGroupExtensionLiveTest.java (28)
M cloudsigma2/pom.xml (2)
M cloudsigma2/src/main/java/org/jclouds/cloudsigma2/CloudSigma2Api.java (119)
M cloudsigma2/src/main/java/org/jclouds/cloudsigma2/CloudSigma2ApiMetadata.java (24)
M cloudsigma2/src/main/java/org/jclouds/cloudsigma2/binders/BindCreateSubscriptionRequestList.java (3)
M cloudsigma2/src/main/java/org/jclouds/cloudsigma2/binders/BindDrivesToJson.java (3)
M cloudsigma2/src/main/java/org/jclouds/cloudsigma2/binders/BindFirewallPoliciesListToJsonRequest.java (3)
M cloudsigma2/src/main/java/org/jclouds/cloudsigma2/binders/BindServerInfoListToJsonRequest.java (3)
M cloudsigma2/src/main/java/org/jclouds/cloudsigma2/binders/BindTagListToJsonRequest.java (3)
M cloudsigma2/src/main/java/org/jclouds/cloudsigma2/binders/BindUuidStringsToJsonArray.java (3)
A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/compute/config/CloudSigma2ComputeServiceContextModule.java (222)
A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/compute/extensions/CloudSigma2SecurityGroupExtension.java (221)
A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/compute/functions/FirewallPolicyToSecurityGroup.java (81)
A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/compute/functions/FirewallRuleToIpPermission.java (77)
A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/compute/functions/LibraryDriveToImage.java (61)
A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/compute/functions/NICToAddress.java (55)
A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/compute/functions/ServerDriveToVolume.java (52)
A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/compute/functions/ServerInfoToNodeMetadata.java (135)
A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/compute/functions/TemplateOptionsToStatementWithoutPublicKey.java (59)
A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/compute/options/CloudSigma2TemplateOptions.java (154)
A cloudsigma2/src/main/java/org/jclouds/cloudsigma2/compute/strategy/CloudSigma2ComputeServiceAdapter.java (391)
M cloudsigma2/src/main/java/org/jclouds/cloudsigma2/config/CloudSigma2Properties.java (15)
M cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/FirewallPolicy.java (43)
M cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/LibraryDrive.java (35)
M cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/ServerInfo.java (10)
M cloudsigma2/src/main/java/org/jclouds/cloudsigma2/functions/internal/ParseTags.java (21)
M cloudsigma2/src/main/java/org/jclouds/cloudsigma2/handlers/CloudSigmaErrorHandler.java (12)
M cloudsigma2/src/test/java/org/jclouds/cloudsigma2/CloudSigma2ApiExpectTest.java (115)
M cloudsigma2/src/test/java/org/jclouds/cloudsigma2/CloudSigma2ApiLiveTest.java (71)
A cloudsigma2/src/test/java/org/jclouds/cloudsigma2/compute/CloudSigma2ComputeServiceLiveTest.java (56)
A cloudsigma2/src/test/java/org/jclouds/cloudsigma2/compute/config/DriveClonedPredicateTest.java (60)
A cloudsigma2/src/test/java/org/jclouds/cloudsigma2/compute/config/ServerStatusPredicatePredicateTest.java (54)
A cloudsigma2/src/test/java/org/jclouds/cloudsigma2/compute/extensions/CloudSigma2SecurityGroupExtensionLiveTest.java (29)
A cloudsigma2/src/test/java/org/jclouds/cloudsigma2/compute/functions/FirewallPolicyToSecurityGroupTest.java (151)
A cloudsigma2/src/test/java/org/jclouds/cloudsigma2/compute/functions/FirewallRuleToIpPermissionTest.java (113)
A cloudsigma2/src/test/java/org/jclouds/cloudsigma2/compute/functions/LibraryDriveToImageTest.java (83)
A cloudsigma2/src/test/java/org/jclouds/cloudsigma2/compute/functions/NICToAddressTest.java (90)
A cloudsigma2/src/test/java/org/jclouds/cloudsigma2/compute/functions/ServerDriveToVolumeTest.java (79)
A cloudsigma2/src/test/java/org/jclouds/cloudsigma2/compute/functions/ServerInfoToNodeMetadataTest.java (186)
A cloudsigma2/src/test/java/org/jclouds/cloudsigma2/compute/functions/TemplateOptionsToStatementWithoutPublicKeyTest.java (75)
A cloudsigma2/src/test/java/org/jclouds/cloudsigma2/compute/options/CloudSigma2TemplateOptionsTest.java (49)
M cloudsigma2/src/test/java/org/jclouds/cloudsigma2/functions/ServerInfoToJsonTest.java (34)
A cloudsigma2/src/test/resources/drive-cloned.json (57)
A cloudsigma2/src/test/resources/fwpolicies-get-single.json (61)
A cloudsigma2/src/test/resources/libdrives-cloned.json (34)
M cloudsigma2/src/test/resources/server-detail-first-page.json (4)
M cloudsigma2/src/test/resources/server-detail.json (4)
M cloudsigma2/src/test/resources/servers-single.json (4)
M pom.xml (2)
-- Patch Links --
https://github.com/jclouds/jclouds-labs/pull/70.patch
https://github.com/jclouds/jclouds-labs/pull/70.diff
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/70
Re: [jclouds-labs] CloudSigma2 ComputeService and
SecurityGroupExtension (#70)
Posted by BuildHive <no...@github.com>.
[jclouds » jclouds-labs #1536](https://buildhive.cloudbees.com/job/jclouds/job/jclouds-labs/1536/) FAILURE
Looks like there's a problem with this pull request
[(what's this?)](https://www.cloudbees.com/what-is-buildhive)
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/70#issuecomment-56286710
Re: [jclouds-labs] CloudSigma2 ComputeService and
SecurityGroupExtension (#70)
Posted by Ignasi Barrera <no...@github.com>.
I just want someone else to have a look at the changes. @demobox could you have a look a this?
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/70#issuecomment-55111328
Re: [jclouds-labs] CloudSigma2 ComputeService and
SecurityGroupExtension (#70)
Posted by BuildHive <no...@github.com>.
[jclouds » jclouds-labs #1732](https://buildhive.cloudbees.com/job/jclouds/job/jclouds-labs/1732/) SUCCESS
This pull request looks good
[(what's this?)](https://www.cloudbees.com/what-is-buildhive)
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/70#issuecomment-59976801
Re: [jclouds-labs] CloudSigma2 ComputeService and
SecurityGroupExtension (#70)
Posted by Andrew Phillips <no...@github.com>.
> +public class TemplateOptionsToStatementWithoutPublicKey extends TemplateOptionsToStatement {
> +
> + @Override
> + public Statement apply(TemplateOptions options) {
> + ImmutableList.Builder<Statement> builder = ImmutableList.builder();
> + if (options.getRunScript() != null) {
> + builder.add(options.getRunScript());
> + }
> + if (options.getPrivateKey() != null) {
> + builder.add(new InstallRSAPrivateKey(options.getPrivateKey()));
> + }
> +
> + ImmutableList<Statement> bootstrap = builder.build();
> + if (!bootstrap.isEmpty()) {
> + if (options.getTaskName() == null && !(options.getRunScript() instanceof InitScript)) {
> + options.nameTask("bootstrap");
Is it clear to callers that `options` can be modified by this call? Is that the intention here?
/cc @nacx
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/70/files#r17825992
Re: [jclouds-labs] CloudSigma2 ComputeService and
SecurityGroupExtension (#70)
Posted by BuildHive <no...@github.com>.
[jclouds » jclouds-labs #1581](https://buildhive.cloudbees.com/job/jclouds/job/jclouds-labs/1581/) SUCCESS
This pull request looks good
[(what's this?)](https://www.cloudbees.com/what-is-buildhive)
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/70#issuecomment-57725846
Re: [jclouds-labs] CloudSigma2 ComputeService and
SecurityGroupExtension (#70)
Posted by Ilya Kulakov <no...@github.com>.
@nacx Issue with `testAddIpPermission` should be addressed now.
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/70#issuecomment-56286616
Re: [jclouds-labs] CloudSigma2 ComputeService and
SecurityGroupExtension (#70)
Posted by Andrew Phillips <no...@github.com>.
> + permissionBuilder.toPort(Integer.parseInt(destinationPort));
> + }
> + }
> + permissionBuilder.ipProtocol(input.getIpProtocol() != null ? firewallIpProtocolToIpProtocol.get(input
> + .getIpProtocol()) : IpProtocol.UNRECOGNIZED);
> + if (input.getSourceIp() != null) {
> + permissionBuilder.cidrBlock(input.getSourceIp().contains("!") ? "0.0.0.0/0" : input.getSourceIp());
> + } else {
> + permissionBuilder.cidrBlock("0.0.0.0/0");
> + }
> + return permissionBuilder.build();
> + }
> +
> + private int[] parsePort(String portRange) {
> + int[] ports = new int[2];
> + String[] portStringsArray = portRange.split(":");
[minor] Just `portsAsString` or so?
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/70/files#r17825965
Re: [jclouds-labs] CloudSigma2 ComputeService and
SecurityGroupExtension (#70)
Posted by CloudBees pull request builder plugin <no...@github.com>.
[jclouds-labs-pull-requests #317](https://jclouds.ci.cloudbees.com/job/jclouds-labs-pull-requests/317/) SUCCESS
This pull request looks good
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/70#issuecomment-59383551
Re: [jclouds-labs] CloudSigma2 ComputeService and
SecurityGroupExtension (#70)
Posted by Andrew Phillips <no...@github.com>.
> +import org.jclouds.scriptbuilder.domain.StatementList;
> +import org.jclouds.scriptbuilder.statements.ssh.InstallRSAPrivateKey;
> +import org.jclouds.ssh.SshKeys;
> +import org.testng.annotations.Test;
> +
> +import java.util.Map;
> +
> +import static org.testng.Assert.assertEquals;
> +import static org.testng.Assert.assertNull;
> +import static org.testng.Assert.assertTrue;
> +
> +/**
> + * Unit tests for the {@link TemplateOptionsToStatementWithoutPublicKey} class.
> + */
> +@Test(groups = "unit", testName = "TemplateOptionsToStatementWithoutPublicKeyTest")
> +public class TemplateOptionsToStatementWithoutPublicKeyTest {
Do we check here whether `options` are modified across the call?
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/70/files#r17826088
Re: [jclouds-labs] CloudSigma2 ComputeService and
SecurityGroupExtension (#70)
Posted by Ignasi Barrera <no...@github.com>.
> +import org.jclouds.scriptbuilder.domain.StatementList;
> +import org.jclouds.scriptbuilder.statements.ssh.InstallRSAPrivateKey;
> +import org.jclouds.ssh.SshKeys;
> +import org.testng.annotations.Test;
> +
> +import java.util.Map;
> +
> +import static org.testng.Assert.assertEquals;
> +import static org.testng.Assert.assertNull;
> +import static org.testng.Assert.assertTrue;
> +
> +/**
> + * Unit tests for the {@link TemplateOptionsToStatementWithoutPublicKey} class.
> + */
> +@Test(groups = "unit", testName = "TemplateOptionsToStatementWithoutPublicKeyTest")
> +public class TemplateOptionsToStatementWithoutPublicKeyTest {
Thanks! I already commented there. The code is just the same code as the parent class in jclouds-compute, so we're not introducing anything new here, except that we've removed the public key authorization from the statement list.
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/70/files#r18265244
Re: [jclouds-labs] CloudSigma2 ComputeService and
SecurityGroupExtension (#70)
Posted by Andrew Phillips <no...@github.com>.
> @@ -50,12 +54,10 @@ protected CloudSigma2ApiMetadata(Builder builder) {
>
> public static Properties defaultProperties() {
> Properties properties = BaseHttpApiMetadata.defaultProperties();
> - properties.setProperty(CloudSigma2Properties.PROPERTY_VNC_PASSWORD, "IL9vs34d");
> - // passwords are set post-boot, so auth failures are possible
> - // from a race condition applying the password set script
> - properties.setProperty("jclouds.ssh.max-retries", "7");
> - properties.setProperty("jclouds.ssh.retry-auth", "true");
> - properties.setProperty(TEMPLATE, "osFamily=UBUNTU,imageNameMatches=.*[Aa]utomated SSH Access.*,os64Bit=true");
> + properties.setProperty(PROPERTY_VNC_PASSWORD, "IL9vs34d");
> This is the default VNC password assigned by the provider to the created servers.
Then that's fine, of course - thanks for explaining!
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/70/files#r18261025
Re: [jclouds-labs] CloudSigma2 ComputeService and
SecurityGroupExtension (#70)
Posted by Andrew Phillips <no...@github.com>.
> @@ -163,6 +185,13 @@ public URI getResourceUri() {
> }
>
> /**
> + * @return Many related resources. Can be either a list of URIs or list of individually nested resource data.
Confusing comment? This returns tags set on the instance, or not..?
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/70/files#r17826057
Re: [jclouds-labs] CloudSigma2 ComputeService and
SecurityGroupExtension (#70)
Posted by Ilya Kulakov <no...@github.com>.
> +import org.jclouds.scriptbuilder.domain.StatementList;
> +import org.jclouds.scriptbuilder.statements.ssh.InstallRSAPrivateKey;
> +import org.jclouds.ssh.SshKeys;
> +import org.testng.annotations.Test;
> +
> +import java.util.Map;
> +
> +import static org.testng.Assert.assertEquals;
> +import static org.testng.Assert.assertNull;
> +import static org.testng.Assert.assertTrue;
> +
> +/**
> + * Unit tests for the {@link TemplateOptionsToStatementWithoutPublicKey} class.
> + */
> +@Test(groups = "unit", testName = "TemplateOptionsToStatementWithoutPublicKeyTest")
> +public class TemplateOptionsToStatementWithoutPublicKeyTest {
@nacx Could you comment?
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/70/files#r18004083
Re: [jclouds-labs] CloudSigma2 ComputeService and
SecurityGroupExtension (#70)
Posted by Andrew Phillips <no...@github.com>.
> + this.driveCloned = checkNotNull(driveCloned, "driveCloned");
> + this.serverStopped = checkNotNull(serverStopped, "serverStopped");
> + this.destroyDrives = destroyDrives;
> + this.groupNamingConvention = checkNotNull(groupNamingConvention, "groupNamingConvention").create();
> + }
> +
> + @Override
> + public NodeAndInitialCredentials<ServerInfo> createNodeWithGroupEncodedIntoName(String group, String name,
> + Template template) {
> + CloudSigma2TemplateOptions options = template.getOptions().as(CloudSigma2TemplateOptions.class);
> + Image image = template.getImage();
> + Hardware hardware = template.getHardware();
> +
> + DriveInfo drive = api.getLibraryDrive(image.getProviderId());
> +
> + if (!drive.getMedia().equals(MediaType.CDROM)) {
Would it be useful to have a debug statement that CD ROM drives are being skipped?
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/70/files#r17826012
Re: [jclouds-labs] CloudSigma2 ComputeService and
SecurityGroupExtension (#70)
Posted by Ignasi Barrera <no...@github.com>.
> + this.driveCloned = checkNotNull(driveCloned, "driveCloned");
> + this.serverStopped = checkNotNull(serverStopped, "serverStopped");
> + this.destroyDrives = destroyDrives;
> + this.groupNamingConvention = checkNotNull(groupNamingConvention, "groupNamingConvention").create();
> + }
> +
> + @Override
> + public NodeAndInitialCredentials<ServerInfo> createNodeWithGroupEncodedIntoName(String group, String name,
> + Template template) {
> + CloudSigma2TemplateOptions options = template.getOptions().as(CloudSigma2TemplateOptions.class);
> + Image image = template.getImage();
> + Hardware hardware = template.getHardware();
> +
> + DriveInfo drive = api.getLibraryDrive(image.getProviderId());
> +
> + if (!drive.getMedia().equals(MediaType.CDROM)) {
Not sure if that log is needed. CD-ROM drives don't require a clone operation, but they are used later. I mean, these drives are "not skipped", but not cloned. Other drives that require the clone print the log for that.
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/70/files#r18385378
Re: [jclouds-labs] CloudSigma2 ComputeService and
SecurityGroupExtension (#70)
Posted by Andrew Phillips <no...@github.com>.
> + }
> +
> + @VisibleForTesting
> + public static final Map<DriveStatus, Image.Status> driveStatusToImageStatus = ImmutableMap
> + .<DriveStatus, Image.Status>builder().put(DriveStatus.MOUNTED, Image.Status.AVAILABLE)
> + .put(DriveStatus.UNMOUNTED, Image.Status.UNRECOGNIZED).put(DriveStatus.COPYING, Image.Status.PENDING)
> + .put(DriveStatus.UNAVAILABLE, Image.Status.ERROR).build();
> +
> + @Provides
> + @Singleton
> + protected Map<DriveStatus, Image.Status> provideImageStatusMap() {
> + return driveStatusToImageStatus;
> + }
> +
> + @VisibleForTesting
> + public static final Map<FirewallIpProtocol, IpProtocol> firewallIpProtocolToIpProtocol = ImmutableMap
See comment above
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/70/files#r17825893
Re: [jclouds-labs] CloudSigma2 ComputeService and
SecurityGroupExtension (#70)
Posted by Andrew Phillips <no...@github.com>.
> + @Override
> + public SecurityGroup getSecurityGroupById(String id) {
> + return firewallPolicyToSecurityGroup.apply(api.getFirewallPolicy(id));
> + }
> +
> + @Override
> + public SecurityGroup createSecurityGroup(String name, Location location) {
> + FirewallPolicy firewallPolicy = api.createFirewallPolicy(new FirewallPolicy.Builder().name(name).build());
> + return firewallPolicyToSecurityGroup.apply(firewallPolicy);
> + }
> +
> + @Override
> + public boolean removeSecurityGroup(String id) {
> + FirewallPolicy firewallPolicy = api.getFirewallPolicy(id);
> + if (firewallPolicy == null) {
> + throw new IllegalArgumentException("There is no SecurityGroup with " + id + " id");
"SecurityGroup"?
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/70/files#r17825911
Re: [jclouds-labs] CloudSigma2 ComputeService and
SecurityGroupExtension (#70)
Posted by Andrew Phillips <no...@github.com>.
> +
> + @Override
> + public boolean removeSecurityGroup(String id) {
> + FirewallPolicy firewallPolicy = api.getFirewallPolicy(id);
> + if (firewallPolicy == null) {
> + throw new IllegalArgumentException("There is no SecurityGroup with " + id + " id");
> + }
> +
> + if (any(firewallPolicy.getServers(), new Predicate<Server>() {
> + @Override
> + public boolean apply(Server server) {
> + ServerInfo serverInfo = api.getServerInfo(server.getUuid());
> + return !ServerStatus.STOPPED.equals(serverInfo.getStatus());
> + }
> + })) {
> + throw new IllegalStateException("Can't delete SecurityGroup while there are nodes running in them");
"SecurityGroup"?
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/70/files#r17825915
Re: [jclouds-labs] CloudSigma2 ComputeService and
SecurityGroupExtension (#70)
Posted by Ilya Kulakov <no...@github.com>.
> + destinationPort.length());
> + }
> + if (destinationPort.contains(":")) {
> + int[] ports = parsePort(destinationPort);
> + permissionBuilder.fromPort(ports[0]);
> + permissionBuilder.toPort(ports[1]);
> + } else {
> + int port = Integer.parseInt(destinationPort);
> + permissionBuilder.fromPort(port);
> + permissionBuilder.toPort(port);
> + }
> + }
> + permissionBuilder.ipProtocol(input.getIpProtocol() != null ? firewallIpProtocolToIpProtocol.get(input
> + .getIpProtocol()) : IpProtocol.UNRECOGNIZED);
> + if (input.getSourceIp() != null) {
> + permissionBuilder.cidrBlock(input.getSourceIp().contains("!") ? "0.0.0.0/0" : input.getSourceIp());
@nacx Yeah, we're aware of this issue. Maybe there is a library or internal API that would simplify transferring cloudsigma rules like "!192.168.1.16" into list of cidr that jclouds expects?
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/70/files#r18436103
Re: [jclouds-labs] CloudSigma2 ComputeService and
SecurityGroupExtension (#70)
Posted by BuildHive <no...@github.com>.
[jclouds » jclouds-labs #1698](https://buildhive.cloudbees.com/job/jclouds/job/jclouds-labs/1698/) SUCCESS
This pull request looks good
[(what's this?)](https://www.cloudbees.com/what-is-buildhive)
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/70#issuecomment-59385441
Re: [jclouds-labs] CloudSigma2 ComputeService and
SecurityGroupExtension (#70)
Posted by Ignasi Barrera <no...@github.com>.
> @POST
> @Path("/servers/{uuid}/action/?do=start")
> - @Fallback(Fallbacks.NullOnNotFoundOr404.class)
> + @Fallback(Fallbacks.VoidOnNotFoundOr404.class)
There has been [a recent discussion](https://github.com/jclouds/jclouds-labs-openstack/pull/135/files#r16700137) about the convenience of using the 404 fallbacks in *write* operations (typically PUT and POST). The consensus is that they should be removed, but let's address this in another pull request once this has been merged.
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/70/files#r16923661
Re: [jclouds-labs] CloudSigma2 ComputeService and
SecurityGroupExtension (#70)
Posted by Andrew Phillips <no...@github.com>.
> @@ -429,7 +477,7 @@ public void testEditVLAN() throws Exception {
> .meta(meta)
> .build();
>
> - if (api.listVLANs().size() > 0) {
> + if (api.listVLANs().concat().size() > 0) {
Can we check this using `isEmpty` instead?
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/70/files#r17826071
Re: [jclouds-labs] CloudSigma2 ComputeService and
SecurityGroupExtension (#70)
Posted by Andrew Phillips <no...@github.com>.
> +
> + @Override
> + public IpPermission apply(FirewallRule input) {
> + IpPermission.Builder permissionBuilder = new IpPermission.Builder();
> + String destinationPort = input.getDestinationPort();
> + if (destinationPort != null) {
> + if (destinationPort.contains("!")) {
> + destinationPort = destinationPort.substring(destinationPort.indexOf("!") + 1,
> + destinationPort.length());
> + }
> + if (destinationPort.contains(":")) {
> + int[] ports = parsePort(destinationPort);
> + permissionBuilder.fromPort(ports[0]);
> + permissionBuilder.toPort(ports[1]);
> + } else {
> + permissionBuilder.fromPort(Integer.parseInt(destinationPort));
[minor] Factor `Integer.parseInt(destinationPort)` out as a variable?
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/70/files#r17825942
Re: [jclouds-labs] CloudSigma2 ComputeService and
SecurityGroupExtension (#70)
Posted by CloudBees pull request builder plugin <no...@github.com>.
[jclouds-labs-pull-requests #329](https://jclouds.ci.cloudbees.com/job/jclouds-labs-pull-requests/329/) FAILURE
Looks like there's a problem with this pull request
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/70#issuecomment-59972254
Re: [jclouds-labs] CloudSigma2 ComputeService and
SecurityGroupExtension (#70)
Posted by Andrew Phillips <no...@github.com>.
> super(uuid, name, resourceUri);
> this.meta = meta;
> this.owner = owner;
> this.rules = rules == null ? new ArrayList<FirewallRule>() : rules;
> + this.tags = tags == null ? new ArrayList<Tag>() : tags;
We're on Java 7, so use the diamond operator here?
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/70/files#r17826054
Re: [jclouds-labs] CloudSigma2 ComputeService and
SecurityGroupExtension (#70)
Posted by Andrew Phillips <no...@github.com>.
> + }).to(FirewallRuleToIpPermission.class);
> +
> + bind(TemplateOptions.class).to(CloudSigma2TemplateOptions.class);
> + bind(TemplateOptionsToStatement.class).to(TemplateOptionsToStatementWithoutPublicKey.class);
> +
> + bind(new TypeLiteral<SecurityGroupExtension>() {
> + }).to(CloudSigma2SecurityGroupExtension.class);
> + }
> +
> + @Override
> + protected Optional<SecurityGroupExtension> provideSecurityGroupExtension(Injector i) {
> + return Optional.of(i.getInstance(SecurityGroupExtension.class));
> + }
> +
> + @VisibleForTesting
> + public static final Map<ServerStatus, NodeMetadata.Status> serverStatusToNodeStatus = ImmutableMap
If visible for testing, can this be `protected` instead of `public`?
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/70/files#r17825887
Re: [jclouds-labs] CloudSigma2 ComputeService and
SecurityGroupExtension (#70)
Posted by Andrew Phillips <no...@github.com>.
> + Template template) {
> + CloudSigma2TemplateOptions options = template.getOptions().as(CloudSigma2TemplateOptions.class);
> + Image image = template.getImage();
> + Hardware hardware = template.getHardware();
> +
> + DriveInfo drive = api.getLibraryDrive(image.getProviderId());
> +
> + if (!drive.getMedia().equals(MediaType.CDROM)) {
> + logger.debug(">> cloning library drive %s...", image.getProviderId());
> +
> + drive = api.cloneLibraryDrive(image.getProviderId(), null);
> + driveCloned.apply(drive);
> +
> + // Refresh the drive object and verify the clone operation didn't time out
> + drive = api.getDriveInfo(drive.getUuid());
> + checkState(drive.getStatus() == DriveStatus.UNMOUNTED, "Resource is in invalid status: %s", drive.getStatus());
If this blows up here, what will happen with any drives already created?
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/70/files#r17826017
Re: [jclouds-labs] CloudSigma2 ComputeService and
SecurityGroupExtension (#70)
Posted by Andrew Phillips <no...@github.com>.
> + String uuid = "9001b532-857a-405a-8e50-54e342871e77";
> +
> + CloudSigma2Api api = requestsSendResponses(
> + deleteBuilder()
> + .endpoint(endpoint + "fwpolicies/" + uuid + "/")
> + .build(),
> + responseBuilder()
> + .build(),
> + deleteBuilder()
> + .endpoint(endpoint + "fwpolicies/failure")
> + .build(),
> + HttpResponse.builder()
> + .statusCode(404)
> + .build());
> +
> + api.deleteFirewallPolicy(uuid);
Nothing to assert here?
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/70/files#r17826067
Re: [jclouds-labs] CloudSigma2 ComputeService and
SecurityGroupExtension (#70)
Posted by CloudBees pull request builder plugin <no...@github.com>.
[jclouds-labs-pull-requests #254](https://jclouds.ci.cloudbees.com/job/jclouds-labs-pull-requests/254/) FAILURE
Looks like there's a problem with this pull request
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/70#issuecomment-56286770
Re: [jclouds-labs] CloudSigma2 ComputeService and
SecurityGroupExtension (#70)
Posted by Andrew Phillips <no...@github.com>.
> + if (serverInfo != null) {
> + logger.debug(">> rolling back the server...");
> + api.deleteServer(serverInfo.getUuid());
> + }
> + if (destroyDrives) {
> + logger.debug(">> rolling back the cloned drive...");
> + destroyDrives(ImmutableList.of(drive.getUuid()));
> + }
> + deleteTags(tagIds);
> + throw propagate(ex);
> + }
> + }
> +
> + @Override
> + public Iterable<Hardware> listHardwareProfiles() {
> + // TODO: Return a hardcoded list of hardware profiles until
This is what is happening now? So no "TODO"? Or do we _still_ need to implement the hard-coded list?
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/70/files#r17826027
Re: [jclouds-labs] CloudSigma2 ComputeService and
SecurityGroupExtension (#70)
Posted by BuildHive <no...@github.com>.
[jclouds » jclouds-labs #1582](https://buildhive.cloudbees.com/job/jclouds/job/jclouds-labs/1582/) SUCCESS
This pull request looks good
[(what's this?)](https://www.cloudbees.com/what-is-buildhive)
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/70#issuecomment-57728729
Re: [jclouds-labs] CloudSigma2 ComputeService and
SecurityGroupExtension (#70)
Posted by Andrew Phillips <no...@github.com>.
> + firewallRuleBuilder.ipProtocol(ipProtocolToFirewallIpProtocol.get(protocol));
> + }
> + firewallRules.add(firewallRuleBuilder.build());
> + }
> +
> + firewallPolicy = api.editFirewallPolicy(firewallPolicy.getUuid(),
> + FirewallPolicy.Builder.fromFirewallPolicy(firewallPolicy).rules(firewallRules).build());
> +
> + return firewallPolicyToSecurityGroup.apply(firewallPolicy);
> + }
> +
> + @Override
> + public SecurityGroup removeIpPermission(final IpProtocol protocol, final int startPort, final int endPort,
> + Multimap<String, String> tenantIdGroupNamePairs, Iterable<String> ipRanges,
> + Iterable<String> groupIds, SecurityGroup group) {
> + final Set<String> ipSet = ipRanges != null ? ImmutableSet.copyOf(ipRanges) : Sets.<String>newHashSet();
Just a question...if this can be a copy of `ipRanges`, are they really _ranges_ or simply _IPs_. If they are IPs, rename the input variable?
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/70/files#r17825938
Re: [jclouds-labs] CloudSigma2 ComputeService and
SecurityGroupExtension (#70)
Posted by Andrew Phillips <no...@github.com>.
> + if (options.getRunScript() != null) {
> + builder.add(options.getRunScript());
> + }
> + if (options.getPrivateKey() != null) {
> + builder.add(new InstallRSAPrivateKey(options.getPrivateKey()));
> + }
> +
> + ImmutableList<Statement> bootstrap = builder.build();
> + if (!bootstrap.isEmpty()) {
> + if (options.getTaskName() == null && !(options.getRunScript() instanceof InitScript)) {
> + options.nameTask("bootstrap");
> + }
> + return bootstrap.size() == 1 ? bootstrap.get(0) : new StatementList(bootstrap);
> + }
> +
> + return null;
Just as a personal style preference, handle the "exceptional case" first? I.e.
```
if (bootstrap.isEmpty()) {
return null;
}
...
```
?
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/70/files#r17825999
Re: [jclouds-labs] CloudSigma2 ComputeService and
SecurityGroupExtension (#70)
Posted by Ignasi Barrera <no...@github.com>.
@demobox I've been discussing with the people at CloudSigma the best approach to get this pull request merged, and we've agreed to remove for now the SecurityGroupExtension, and merge this just with the ComputeService.
The extension can be added later, but it presents some design challenges, as the CloudSigma API supports ACCEPT and DROP rules as long as "negated" IP and port ranges. That makes it impossible to have one-to-one mappings between a jclouds IpPermission and a CloudSigma firewall rule, and that complicates the extension considerably. We'd better discuss the best approach in the mailing list, and implement it accordingly after that. Sounds good to you @demobox?
This said, @Kentzo, @shevchenator, there are still some comments that have to be addressed. Could you check the list of comments in this PR, as there are several still unanswered and that need changes, and fix them? I hope after that this will be ready to be merged. Agree @demobox?
I look forward to having this in!
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/70#issuecomment-59571924
Re: [jclouds-labs] CloudSigma2 ComputeService and
SecurityGroupExtension (#70)
Posted by Ignasi Barrera <no...@github.com>.
> @@ -50,12 +54,10 @@ protected CloudSigma2ApiMetadata(Builder builder) {
>
> public static Properties defaultProperties() {
> Properties properties = BaseHttpApiMetadata.defaultProperties();
> - properties.setProperty(CloudSigma2Properties.PROPERTY_VNC_PASSWORD, "IL9vs34d");
> - // passwords are set post-boot, so auth failures are possible
> - // from a race condition applying the password set script
> - properties.setProperty("jclouds.ssh.max-retries", "7");
> - properties.setProperty("jclouds.ssh.retry-auth", "true");
> - properties.setProperty(TEMPLATE, "osFamily=UBUNTU,imageNameMatches=.*[Aa]utomated SSH Access.*,os64Bit=true");
> + properties.setProperty(PROPERTY_VNC_PASSWORD, "IL9vs34d");
Do you mean moving the value of the property to a constant? This is the default VNC password assigned by the provider to the created servers. The existing provider for the version 1 of the API had it already configured as a property, and it is here to keep that in the same way.
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/70/files#r18021246
Re: [jclouds-labs] CloudSigma2 ComputeService and
SecurityGroupExtension (#70)
Posted by Ilya Kulakov <no...@github.com>.
> @POST
> @Path("/servers/{uuid}/action/?do=start")
> - @Fallback(Fallbacks.NullOnNotFoundOr404.class)
> + @Fallback(Fallbacks.VoidOnNotFoundOr404.class)
Could add an issue for this at https://github.com/GreatFruitOmsk/jclouds-labs/issues ?
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/70/files#r16923705
Re: [jclouds-labs] CloudSigma2 ComputeService and
SecurityGroupExtension (#70)
Posted by Ignasi Barrera <no...@github.com>.
@demobox I think all comments are addressed now.
The only remaining bit is the visibility of the maps in the module class, but the option is to move them to their own class/function, which won't make it "less" visible to users. They are already annotated as visible for testing, but would be nothing wrong in using them directly, if a user wanted to. Are you OK of leaving the maps as they are, or do you prefer to move them to their own class or similar?
Otherwise, good to merge?
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/70#issuecomment-59999177
Re: [jclouds-labs] CloudSigma2 ComputeService and
SecurityGroupExtension (#70)
Posted by CloudBees pull request builder plugin <no...@github.com>.
[jclouds-labs-pull-requests #282](https://jclouds.ci.cloudbees.com/job/jclouds-labs-pull-requests/282/) SUCCESS
This pull request looks good
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/70#issuecomment-57728566
Re: [jclouds-labs] CloudSigma2 ComputeService and
SecurityGroupExtension (#70)
Posted by Ilya Kulakov <no...@github.com>.
> + permissionBuilder.toPort(Integer.parseInt(destinationPort));
> + }
> + }
> + permissionBuilder.ipProtocol(input.getIpProtocol() != null ? firewallIpProtocolToIpProtocol.get(input
> + .getIpProtocol()) : IpProtocol.UNRECOGNIZED);
> + if (input.getSourceIp() != null) {
> + permissionBuilder.cidrBlock(input.getSourceIp().contains("!") ? "0.0.0.0/0" : input.getSourceIp());
> + } else {
> + permissionBuilder.cidrBlock("0.0.0.0/0");
> + }
> + return permissionBuilder.build();
> + }
> +
> + private int[] parsePort(String portRange) {
> + int[] ports = new int[2];
> + String[] portStringsArray = portRange.split(":");
@demobox You mean to rename variable?
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/70/files#r18372959
Re: [jclouds-labs] CloudSigma2 ComputeService and
SecurityGroupExtension (#70)
Posted by Ilya Kulakov <no...@github.com>.
> @@ -50,12 +54,10 @@ protected CloudSigma2ApiMetadata(Builder builder) {
>
> public static Properties defaultProperties() {
> Properties properties = BaseHttpApiMetadata.defaultProperties();
> - properties.setProperty(CloudSigma2Properties.PROPERTY_VNC_PASSWORD, "IL9vs34d");
> - // passwords are set post-boot, so auth failures are possible
> - // from a race condition applying the password set script
> - properties.setProperty("jclouds.ssh.max-retries", "7");
> - properties.setProperty("jclouds.ssh.retry-auth", "true");
> - properties.setProperty(TEMPLATE, "osFamily=UBUNTU,imageNameMatches=.*[Aa]utomated SSH Access.*,os64Bit=true");
> + properties.setProperty(PROPERTY_VNC_PASSWORD, "IL9vs34d");
@nacx Could you comment?
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/70/files#r18004035
Re: [jclouds-labs] CloudSigma2 ComputeService and
SecurityGroupExtension (#70)
Posted by Ignasi Barrera <no...@github.com>.
> super(uuid, name, resourceUri);
> this.meta = meta;
> this.owner = owner;
> this.rules = rules == null ? new ArrayList<FirewallRule>() : rules;
> + this.tags = tags == null ? new ArrayList<Tag>() : tags;
If I'm not wrong, this is because a single raw type in an expression turns off all generic type checking (discussion [here](https://twitter.com/IgnasiBarrera/status/514111975270649856)).
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/70/files#r19087134
Re: [jclouds-labs] CloudSigma2 ComputeService and
SecurityGroupExtension (#70)
Posted by Ignasi Barrera <no...@github.com>.
It looks that there are some [checkstyle violations](https://jclouds.ci.cloudbees.com/job/jclouds-labs-pull-requests/254/org.apache.jclouds.labs$cloudsigma2/violations/) that are making the build to fail. Could you fix them?
You'll find the details, if the Jenkins ones are not enough, in the `target/checkstyle-results.xml` file on each project after running a `mvn checkstyle:checkstyle`.
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/70#issuecomment-56291070
Re: [jclouds-labs] CloudSigma2 ComputeService and
SecurityGroupExtension (#70)
Posted by Andrew Phillips <no...@github.com>.
> + protected Map<DriveStatus, Image.Status> provideImageStatusMap() {
> + return driveStatusToImageStatus;
> + }
> +
> + @VisibleForTesting
> + public static final Map<FirewallIpProtocol, IpProtocol> firewallIpProtocolToIpProtocol = ImmutableMap
> + .<FirewallIpProtocol, IpProtocol>builder().put(FirewallIpProtocol.TCP, IpProtocol.TCP)
> + .put(FirewallIpProtocol.UDP, IpProtocol.UDP).build();
> +
> + @Provides
> + @Singleton
> + protected Map<FirewallIpProtocol, IpProtocol> provideIpProtocolMap() {
> + return firewallIpProtocolToIpProtocol;
> + }
> +
> + public static final Map<IpProtocol, FirewallIpProtocol> ipProtocolToFirewallIpProtocol = ImmutableMap
See comment above
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/70/files#r17825895
Re: [jclouds-labs] CloudSigma2 ComputeService and
SecurityGroupExtension (#70)
Posted by Ignasi Barrera <no...@github.com>.
> +public class TemplateOptionsToStatementWithoutPublicKey extends TemplateOptionsToStatement {
> +
> + @Override
> + public Statement apply(TemplateOptions options) {
> + ImmutableList.Builder<Statement> builder = ImmutableList.builder();
> + if (options.getRunScript() != null) {
> + builder.add(options.getRunScript());
> + }
> + if (options.getPrivateKey() != null) {
> + builder.add(new InstallRSAPrivateKey(options.getPrivateKey()));
> + }
> +
> + ImmutableList<Statement> bootstrap = builder.build();
> + if (!bootstrap.isEmpty()) {
> + if (options.getTaskName() == null && !(options.getRunScript() instanceof InitScript)) {
> + options.nameTask("bootstrap");
Yes, it is intentional. The taskname is the name of the script that will be created in the target node, so it is being set if the user has not explicitly set one. The code in this method, is just a copy of the code in the parent class but removing the authorize public key statement, as we're using the provider key pair features.
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/70/files#r18265167
Re: [jclouds-labs] CloudSigma2 ComputeService and
SecurityGroupExtension (#70)
Posted by Ilya Kulakov <no...@github.com>.
> + Template template) {
> + CloudSigma2TemplateOptions options = template.getOptions().as(CloudSigma2TemplateOptions.class);
> + Image image = template.getImage();
> + Hardware hardware = template.getHardware();
> +
> + DriveInfo drive = api.getLibraryDrive(image.getProviderId());
> +
> + if (!drive.getMedia().equals(MediaType.CDROM)) {
> + logger.debug(">> cloning library drive %s...", image.getProviderId());
> +
> + drive = api.cloneLibraryDrive(image.getProviderId(), null);
> + driveCloned.apply(drive);
> +
> + // Refresh the drive object and verify the clone operation didn't time out
> + drive = api.getDriveInfo(drive.getUuid());
> + checkState(drive.getStatus() == DriveStatus.UNMOUNTED, "Resource is in invalid status: %s", drive.getStatus());
@nacx Could you comment?
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/70/files#r18004073
Re: [jclouds-labs] CloudSigma2 ComputeService and
SecurityGroupExtension (#70)
Posted by Andrew Phillips <no...@github.com>.
> + .<ServerStatus, NodeMetadata.Status>builder().put(ServerStatus.RUNNING, NodeMetadata.Status.RUNNING)
> + .put(ServerStatus.STARTING, NodeMetadata.Status.PENDING)
> + .put(ServerStatus.STOPPING, NodeMetadata.Status.PENDING)
> + .put(ServerStatus.STOPPED, NodeMetadata.Status.SUSPENDED)
> + .put(ServerStatus.PAUSED, NodeMetadata.Status.SUSPENDED)
> + .put(ServerStatus.UNAVAILABLE, NodeMetadata.Status.SUSPENDED)
> + .put(ServerStatus.UNRECOGNIZED, NodeMetadata.Status.UNRECOGNIZED).build();
> +
> + @Provides
> + @Singleton
> + protected Map<ServerStatus, NodeMetadata.Status> provideStatusMap() {
> + return serverStatusToNodeStatus;
> + }
> +
> + @VisibleForTesting
> + public static final Map<DriveStatus, Image.Status> driveStatusToImageStatus = ImmutableMap
See comment above
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/70/files#r17825892
Re: [jclouds-labs] CloudSigma2 ComputeService and
SecurityGroupExtension (#70)
Posted by Andrew Phillips <no...@github.com>.
> @@ -460,7 +508,7 @@ public void testEditIP() throws Exception {
> .meta(meta)
> .build();
>
> - if (api.listIPs().size() > 0) {
> + if (api.listIPs().concat().size() > 0) {
See above comment
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/70/files#r17826072
Re: [jclouds-labs] CloudSigma2 ComputeService and
SecurityGroupExtension (#70)
Posted by CloudBees pull request builder plugin <no...@github.com>.
[jclouds-labs-pull-requests #283](https://jclouds.ci.cloudbees.com/job/jclouds-labs-pull-requests/283/) SUCCESS
This pull request looks good
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/70#issuecomment-57729186
Re: [jclouds-labs] CloudSigma2 ComputeService and
SecurityGroupExtension (#70)
Posted by BuildHive <no...@github.com>.
[jclouds » jclouds-labs #1731](https://buildhive.cloudbees.com/job/jclouds/job/jclouds-labs/1731/) FAILURE
Looks like there's a problem with this pull request
[(what's this?)](https://www.cloudbees.com/what-is-buildhive)
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/70#issuecomment-59973598
Re: [jclouds-labs] CloudSigma2 ComputeService and
SecurityGroupExtension (#70)
Posted by Ignasi Barrera <no...@github.com>.
> + Template template) {
> + CloudSigma2TemplateOptions options = template.getOptions().as(CloudSigma2TemplateOptions.class);
> + Image image = template.getImage();
> + Hardware hardware = template.getHardware();
> +
> + DriveInfo drive = api.getLibraryDrive(image.getProviderId());
> +
> + if (!drive.getMedia().equals(MediaType.CDROM)) {
> + logger.debug(">> cloning library drive %s...", image.getProviderId());
> +
> + drive = api.cloneLibraryDrive(image.getProviderId(), null);
> + driveCloned.apply(drive);
> +
> + // Refresh the drive object and verify the clone operation didn't time out
> + drive = api.getDriveInfo(drive.getUuid());
> + checkState(drive.getStatus() == DriveStatus.UNMOUNTED, "Resource is in invalid status: %s", drive.getStatus());
You're right @demobox. Instead of directly using `checkState` which will throw an exception, the state should be checked and the cloned drive deleted before failing, to avoid leaving "orphan" drives there.
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/70/files#r18021320
Re: [jclouds-labs] CloudSigma2 ComputeService and
SecurityGroupExtension (#70)
Posted by Andrew Phillips <no...@github.com>.
> + private final CloudSigma2Api api;
> +
> + @Inject
> + public ServerDriveToVolume(CloudSigma2Api api) {
> + this.api = checkNotNull(api, "api");
> + }
> +
> + @Override
> + public Volume apply(ServerDrive serverDrive) {
> + VolumeBuilder builder = new VolumeBuilder();
> + DriveInfo driveInfo = api.getDriveInfo(serverDrive.getDriveUuid());
> + builder.id(driveInfo.getUuid());
> + builder.size(driveInfo.getSize().floatValue());
> + builder.durable(true);
> + builder.type(Volume.Type.NAS);
> + builder.bootDevice(serverDrive.getBootOrder() > 0);
Just checking...boot order _greater_ than zero means this is a boot device?
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/70/files#r17825973
Re: [jclouds-labs] CloudSigma2 ComputeService and
SecurityGroupExtension (#70)
Posted by Ilya Kulakov <no...@github.com>.
> + this.driveCloned = checkNotNull(driveCloned, "driveCloned");
> + this.serverStopped = checkNotNull(serverStopped, "serverStopped");
> + this.destroyDrives = destroyDrives;
> + this.groupNamingConvention = checkNotNull(groupNamingConvention, "groupNamingConvention").create();
> + }
> +
> + @Override
> + public NodeAndInitialCredentials<ServerInfo> createNodeWithGroupEncodedIntoName(String group, String name,
> + Template template) {
> + CloudSigma2TemplateOptions options = template.getOptions().as(CloudSigma2TemplateOptions.class);
> + Image image = template.getImage();
> + Hardware hardware = template.getHardware();
> +
> + DriveInfo drive = api.getLibraryDrive(image.getProviderId());
> +
> + if (!drive.getMedia().equals(MediaType.CDROM)) {
I have no idea, you know users of jclouds better than I, so you tell me ;)
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/70/files#r18373821
Re: [jclouds-labs] CloudSigma2 ComputeService and
SecurityGroupExtension (#70)
Posted by Ilya Kulakov <no...@github.com>.
> + .<ServerStatus, NodeMetadata.Status>builder().put(ServerStatus.RUNNING, NodeMetadata.Status.RUNNING)
> + .put(ServerStatus.STARTING, NodeMetadata.Status.PENDING)
> + .put(ServerStatus.STOPPING, NodeMetadata.Status.PENDING)
> + .put(ServerStatus.STOPPED, NodeMetadata.Status.SUSPENDED)
> + .put(ServerStatus.PAUSED, NodeMetadata.Status.SUSPENDED)
> + .put(ServerStatus.UNAVAILABLE, NodeMetadata.Status.SUSPENDED)
> + .put(ServerStatus.UNRECOGNIZED, NodeMetadata.Status.UNRECOGNIZED).build();
> +
> + @Provides
> + @Singleton
> + protected Map<ServerStatus, NodeMetadata.Status> provideStatusMap() {
> + return serverStatusToNodeStatus;
> + }
> +
> + @VisibleForTesting
> + public static final Map<DriveStatus, Image.Status> driveStatusToImageStatus = ImmutableMap
It's used outside, that's why it's public.
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/70/files#r19043626
Re: [jclouds-labs] CloudSigma2 ComputeService and
SecurityGroupExtension (#70)
Posted by Andrew Phillips <no...@github.com>.
> +
> +import static com.google.common.base.Preconditions.checkNotNull;
> +
> +@Singleton
> +public class FirewallRuleToIpPermission implements Function<FirewallRule, IpPermission> {
> +
> + private final Map<FirewallIpProtocol, IpProtocol> firewallIpProtocolToIpProtocol;
> +
> + @Inject
> + public FirewallRuleToIpPermission(Map<FirewallIpProtocol, IpProtocol> firewallIpProtocolToIpProtocol) {
> + this.firewallIpProtocolToIpProtocol = checkNotNull(firewallIpProtocolToIpProtocol,
> + "firewallIpProtocolToIpProtocol");
> + }
> +
> + @Override
> + public IpPermission apply(FirewallRule input) {
Quite a lot of different cases supported by this parsing logic...are we testing these anywhere?
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/70/files#r17826090
Re: [jclouds-labs] CloudSigma2 ComputeService and
SecurityGroupExtension (#70)
Posted by CloudBees pull request builder plugin <no...@github.com>.
[jclouds-labs-pull-requests #281](https://jclouds.ci.cloudbees.com/job/jclouds-labs-pull-requests/281/) SUCCESS
This pull request looks good
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/70#issuecomment-57727284
Re: [jclouds-labs] CloudSigma2 ComputeService and
SecurityGroupExtension (#70)
Posted by Andrew Phillips <no...@github.com>.
> @@ -574,6 +578,17 @@ void startServerInSeparateAvailabilityGroup(@PathParam("uuid") String uuid,
> PaginatedCollection<FirewallPolicy> listFirewallPoliciesInfo(PaginationOptions options);
>
> /**
> + * Gets a detailed list of firewall policy
[minor] Does this get a _list_ or simply a firewall policy?
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/70/files#r17825856
Re: [jclouds-labs] CloudSigma2 ComputeService and
SecurityGroupExtension (#70)
Posted by Ignasi Barrera <no...@github.com>.
> + destinationPort.length());
> + }
> + if (destinationPort.contains(":")) {
> + int[] ports = parsePort(destinationPort);
> + permissionBuilder.fromPort(ports[0]);
> + permissionBuilder.toPort(ports[1]);
> + } else {
> + int port = Integer.parseInt(destinationPort);
> + permissionBuilder.fromPort(port);
> + permissionBuilder.toPort(port);
> + }
> + }
> + permissionBuilder.ipProtocol(input.getIpProtocol() != null ? firewallIpProtocolToIpProtocol.get(input
> + .getIpProtocol()) : IpProtocol.UNRECOGNIZED);
> + if (input.getSourceIp() != null) {
> + permissionBuilder.cidrBlock(input.getSourceIp().contains("!") ? "0.0.0.0/0" : input.getSourceIp());
Same as commented above. The `!` operator negates a range, and returning `0.0.0.0\0` would also include the IPs that should be out of the rule. This must be changed, together with the port parsing, to return a rule (or a set of rules) that properly matches what is defined in the given `FirewallRule`.
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/70/files#r18435403
Re: [jclouds-labs] CloudSigma2 ComputeService and
SecurityGroupExtension (#70)
Posted by CloudBees pull request builder plugin <no...@github.com>.
[jclouds-labs-pull-requests #279](https://jclouds.ci.cloudbees.com/job/jclouds-labs-pull-requests/279/) SUCCESS
This pull request looks good
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/70#issuecomment-57722477
Re: [jclouds-labs] CloudSigma2 ComputeService and
SecurityGroupExtension (#70)
Posted by CloudBees pull request builder plugin <no...@github.com>.
[jclouds-labs-pull-requests #280](https://jclouds.ci.cloudbees.com/job/jclouds-labs-pull-requests/280/) SUCCESS
This pull request looks good
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/70#issuecomment-57726723
Re: [jclouds-labs] CloudSigma2 ComputeService and
SecurityGroupExtension (#70)
Posted by Ignasi Barrera <no...@github.com>.
> @POST
> @Path("/servers/{uuid}/action/?do=start")
> - @Fallback(Fallbacks.NullOnNotFoundOr404.class)
> + @Fallback(Fallbacks.VoidOnNotFoundOr404.class)
Let's better use the jclouds JIRA to track this. I've just opened [JCLOUDS-690](https://issues.apache.org/jira/browse/JCLOUDS-690).
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/70/files#r16923928
Re: [jclouds-labs] CloudSigma2 ComputeService and
SecurityGroupExtension (#70)
Posted by BuildHive <no...@github.com>.
[jclouds » jclouds-labs #1697](https://buildhive.cloudbees.com/job/jclouds/job/jclouds-labs/1697/) FAILURE
Looks like there's a problem with this pull request
[(what's this?)](https://www.cloudbees.com/what-is-buildhive)
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/70#issuecomment-59308124
Re: [jclouds-labs] CloudSigma2 ComputeService and
SecurityGroupExtension (#70)
Posted by Andrew Phillips <no...@github.com>.
> +@Singleton
> +public class FirewallRuleToIpPermission implements Function<FirewallRule, IpPermission> {
> +
> + private final Map<FirewallIpProtocol, IpProtocol> firewallIpProtocolToIpProtocol;
> +
> + @Inject
> + public FirewallRuleToIpPermission(Map<FirewallIpProtocol, IpProtocol> firewallIpProtocolToIpProtocol) {
> + this.firewallIpProtocolToIpProtocol = checkNotNull(firewallIpProtocolToIpProtocol,
> + "firewallIpProtocolToIpProtocol");
> + }
> +
> + @Override
> + public IpPermission apply(FirewallRule input) {
> + IpPermission.Builder permissionBuilder = new IpPermission.Builder();
> + String destinationPort = input.getDestinationPort();
> + if (destinationPort != null) {
Add a comment with some examples of valid input/output, so the reader has a better idea of what this code is trying to do..?
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/70/files#r17825947
Re: [jclouds-labs] CloudSigma2 ComputeService and
SecurityGroupExtension (#70)
Posted by Ilya Kulakov <no...@github.com>.
> + private final CloudSigma2Api api;
> +
> + @Inject
> + public ServerDriveToVolume(CloudSigma2Api api) {
> + this.api = checkNotNull(api, "api");
> + }
> +
> + @Override
> + public Volume apply(ServerDrive serverDrive) {
> + VolumeBuilder builder = new VolumeBuilder();
> + DriveInfo driveInfo = api.getDriveInfo(serverDrive.getDriveUuid());
> + builder.id(driveInfo.getUuid());
> + builder.size(driveInfo.getSize().floatValue());
> + builder.durable(true);
> + builder.type(Volume.Type.NAS);
> + builder.bootDevice(serverDrive.getBootOrder() > 0);
@demobox @nacx: verifying this with backend devs to be sure.
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/70/files#r18373620
Re: [jclouds-labs] CloudSigma2 ComputeService and
SecurityGroupExtension (#70)
Posted by Ilya Kulakov <no...@github.com>.
> super(uuid, name, resourceUri);
> this.meta = meta;
> this.owner = owner;
> this.rules = rules == null ? new ArrayList<FirewallRule>() : rules;
> + this.tags = tags == null ? new ArrayList<Tag>() : tags;
@nacx, @demobox: hmm, it fails for me
this.rules = rules == null ? new ArrayList<>() : rules;
Error:
jclouds-labs/cloudsigma2/src/main/java/org/jclouds/cloudsigma2/domain/FirewallPolicy.java:[140,34] incompatible types
[ERROR] required: java.util.List<org.jclouds.cloudsigma2.domain.FirewallRule>
[ERROR] found: java.util.List<capture#1 of ? extends java.lang.Object>
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/70/files#r18371206
Re: [jclouds-labs] CloudSigma2 ComputeService and
SecurityGroupExtension (#70)
Posted by Viktor Petersson <no...@github.com>.
@nacx / @demobox Please take a look at this. We have customer waiting for this.
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/70#issuecomment-55882697
Re: [jclouds-labs] CloudSigma2 ComputeService and
SecurityGroupExtension (#70)
Posted by Ignasi Barrera <no...@github.com>.
> + String uuid = "9001b532-857a-405a-8e50-54e342871e77";
> +
> + CloudSigma2Api api = requestsSendResponses(
> + deleteBuilder()
> + .endpoint(endpoint + "fwpolicies/" + uuid + "/")
> + .build(),
> + responseBuilder()
> + .build(),
> + deleteBuilder()
> + .endpoint(endpoint + "fwpolicies/failure")
> + .build(),
> + HttpResponse.builder()
> + .statusCode(404)
> + .build());
> +
> + api.deleteFirewallPolicy(uuid);
Nope. In contrast to mockwebserver tests, expect tests don't record the requests. This method returns void, so there's nothing to assert, and due to how the expect tests work, if the method succeeds, that means there is a match between the generated request and the expected one, so the test is fine as-is.
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/70/files#r19087547
Re: [jclouds-labs] CloudSigma2 ComputeService and
SecurityGroupExtension (#70)
Posted by Ilya Kulakov <no...@github.com>.
> +
> + @Inject
> + public FirewallRuleToIpPermission(Map<FirewallIpProtocol, IpProtocol> firewallIpProtocolToIpProtocol) {
> + this.firewallIpProtocolToIpProtocol = checkNotNull(firewallIpProtocolToIpProtocol,
> + "firewallIpProtocolToIpProtocol");
> + }
> +
> + @Override
> + public IpPermission apply(FirewallRule input) {
> + IpPermission.Builder permissionBuilder = new IpPermission.Builder();
> + String destinationPort = input.getDestinationPort();
> + if (destinationPort != null) {
> + if (destinationPort.contains("!")) {
> + destinationPort = destinationPort.substring(destinationPort.indexOf("!") + 1,
> + destinationPort.length());
> + }
Working on this right now.
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/70/files#r18436095
Re: [jclouds-labs] CloudSigma2 ComputeService and
SecurityGroupExtension (#70)
Posted by Andrew Phillips <no...@github.com>.
> + * (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.
> + */
> +package org.jclouds.cloudsigma2.compute;
> +
> +import org.testng.annotations.Test;
> +
> +@Test(groups = "live", testName = "CloudSigma2LasVegasComputeServiceLiveTest")
Should be "CloudSigma2ZurichComputeServiceLiveTest"?
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/70/files#r17825849
Re: [jclouds-labs] CloudSigma2 ComputeService and
SecurityGroupExtension (#70)
Posted by BuildHive <no...@github.com>.
[jclouds » jclouds-labs #1584](https://buildhive.cloudbees.com/job/jclouds/job/jclouds-labs/1584/) SUCCESS
This pull request looks good
[(what's this?)](https://www.cloudbees.com/what-is-buildhive)
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/70#issuecomment-57731243
Re: [jclouds-labs] CloudSigma2 ComputeService and
SecurityGroupExtension (#70)
Posted by Ignasi Barrera <no...@github.com>.
Ok. I've addressed the remaining bits (which are basically the rollback of the created resources, to make sure we don't leak them if something fails) and sent a patch to the CloudSigma people. We've working together in this PR, so I hope they can apply the patch and get it here soon.
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/70#issuecomment-59780187
Re: [jclouds-labs] CloudSigma2 ComputeService and
SecurityGroupExtension (#70)
Posted by Andrew Phillips <no...@github.com>.
> @@ -50,12 +54,10 @@ protected CloudSigma2ApiMetadata(Builder builder) {
>
> public static Properties defaultProperties() {
> Properties properties = BaseHttpApiMetadata.defaultProperties();
> - properties.setProperty(CloudSigma2Properties.PROPERTY_VNC_PASSWORD, "IL9vs34d");
> - // passwords are set post-boot, so auth failures are possible
> - // from a race condition applying the password set script
> - properties.setProperty("jclouds.ssh.max-retries", "7");
> - properties.setProperty("jclouds.ssh.retry-auth", "true");
> - properties.setProperty(TEMPLATE, "osFamily=UBUNTU,imageNameMatches=.*[Aa]utomated SSH Access.*,os64Bit=true");
> + properties.setProperty(PROPERTY_VNC_PASSWORD, "IL9vs34d");
Does something like this belong in source control in a hard-coded fashion?
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/70/files#r17825867
Re: [jclouds-labs] CloudSigma2 ComputeService and
SecurityGroupExtension (#70)
Posted by BuildHive <no...@github.com>.
[jclouds » jclouds-labs #1465](https://buildhive.cloudbees.com/job/jclouds/job/jclouds-labs/1465/) SUCCESS
This pull request looks good
[(what's this?)](https://www.cloudbees.com/what-is-buildhive)
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/70#issuecomment-53926758
Re: [jclouds-labs] CloudSigma2 ComputeService and
SecurityGroupExtension (#70)
Posted by Ilya Kulakov <no...@github.com>.
> + firewallRuleBuilder.ipProtocol(ipProtocolToFirewallIpProtocol.get(protocol));
> + }
> + firewallRules.add(firewallRuleBuilder.build());
> + }
> +
> + firewallPolicy = api.editFirewallPolicy(firewallPolicy.getUuid(),
> + FirewallPolicy.Builder.fromFirewallPolicy(firewallPolicy).rules(firewallRules).build());
> +
> + return firewallPolicyToSecurityGroup.apply(firewallPolicy);
> + }
> +
> + @Override
> + public SecurityGroup removeIpPermission(final IpProtocol protocol, final int startPort, final int endPort,
> + Multimap<String, String> tenantIdGroupNamePairs, Iterable<String> ipRanges,
> + Iterable<String> groupIds, SecurityGroup group) {
> + final Set<String> ipSet = ipRanges != null ? ImmutableSet.copyOf(ipRanges) : Sets.<String>newHashSet();
@demobox They are ranges.
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/70/files#r18381906
Re: [jclouds-labs] CloudSigma2 ComputeService and
SecurityGroupExtension (#70)
Posted by Andrew Phillips <no...@github.com>.
> */
> public static final String PROPERTY_VNC_PASSWORD = "jclouds.cloudsigma.vnc-password";
> -
> +
> + /**
> + * Time in milliseconds to wait for a drive to be cloned
> + * Default: 60000
> + */
> + public static final String TIMEOUT_DRIVE_CLONED = "jclouds.cloudsigma.timeout.drive-cloned";
> +
> + /**
> + * Controls if the drives of a server must be destroyed when deleting the server
"should" rather than "must"? The call will _try_ to do that but it does not guarantee it, or..?
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/70/files#r17826049
Re: [jclouds-labs] CloudSigma2 ComputeService and
SecurityGroupExtension (#70)
Posted by BuildHive <no...@github.com>.
[jclouds » jclouds-labs #1583](https://buildhive.cloudbees.com/job/jclouds/job/jclouds-labs/1583/) SUCCESS
This pull request looks good
[(what's this?)](https://www.cloudbees.com/what-is-buildhive)
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/70#issuecomment-57730011
Re: [jclouds-labs] CloudSigma2 ComputeService and
SecurityGroupExtension (#70)
Posted by Ignasi Barrera <no...@github.com>.
Rebased and pushed to [master](https://git-wip-us.apache.org/repos/asf?p=jclouds-labs.git;a=commit;h=a7dd1933d8ca283e1118b538be8aa2e2ac5e8be7) and [1.8.x](https://git-wip-us.apache.org/repos/asf?p=jclouds-labs.git;a=commit;h=4c7c29897a2d4f8160a7f14bc0e4d575ccfec882) (after fixing the versions to 1.8.2-SNAPSHOT in the latter).
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/70#issuecomment-60634234
Re: [jclouds-labs] CloudSigma2 ComputeService and
SecurityGroupExtension (#70)
Posted by CloudBees pull request builder plugin <no...@github.com>.
[jclouds-labs-pull-requests #330](https://jclouds.ci.cloudbees.com/job/jclouds-labs-pull-requests/330/) SUCCESS
This pull request looks good
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/70#issuecomment-59974418
Re: [jclouds-labs] CloudSigma2 ComputeService and
SecurityGroupExtension (#70)
Posted by Ilya Kulakov <no...@github.com>.
> super(uuid, name, resourceUri);
> this.meta = meta;
> this.owner = owner;
> this.rules = rules == null ? new ArrayList<FirewallRule>() : rules;
> + this.tags = tags == null ? new ArrayList<Tag>() : tags;
I guess it's due to how Java determines types. I think it's better to be explicit there.
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/70/files#r18371541
Re: [jclouds-labs] CloudSigma2 ComputeService and
SecurityGroupExtension (#70)
Posted by Andrew Phillips <no...@github.com>.
> + private List<Tag> configureTags(CloudSigma2TemplateOptions options) {
> + ImmutableList.Builder<Tag> builder = ImmutableList.builder();
> + for (String tagName : options.getTags()) {
> + String nameWithPrefix = groupNamingConvention.sharedNameForGroup(tagName);
> + builder.add(new Tag.Builder().name(nameWithPrefix).build());
> + }
> +
> + List<Tag> tags = builder.build();
> + List<Tag> result = Lists.newArrayList();
> +
> + if (!tags.isEmpty()) {
> + logger.debug(">> creating tags...");
> + result.addAll(api.createTags(tags));
> + }
> +
> + return result;
Use an immutable list builder here? Or does `result` _need_ to be mutable?
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/70/files#r17826043
Re: [jclouds-labs] CloudSigma2 ComputeService and
SecurityGroupExtension (#70)
Posted by CloudBees pull request builder plugin <no...@github.com>.
[jclouds-labs-pull-requests #284](https://jclouds.ci.cloudbees.com/job/jclouds-labs-pull-requests/284/) FAILURE
Looks like there's a problem with this pull request
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/70#issuecomment-57895958
Re: [jclouds-labs] CloudSigma2 ComputeService and
SecurityGroupExtension (#70)
Posted by Ignasi Barrera <no...@github.com>.
This PR basically adds the missing compute stuff so the `cloudsigma2` provider can be used with the jclouds portable interface. This provider should be the replacement for the one in the main repo once the v1 is deprecated.
I've assisted a bit in the development, and I can say the compute structure/functionality is properly implemented that and all live tests are passing.
@demobox mind reviewing this if you have some time, as I already did a first pass before the PR was opened?
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/70#issuecomment-53936159
Re: [jclouds-labs] CloudSigma2 ComputeService and
SecurityGroupExtension (#70)
Posted by Andrew Phillips <no...@github.com>.
> + builder.userMetadata(serverInfo.getMeta());
> + builder.imageId(extractImageId(serverInfo));
> + builder.status(serverStatusToNodeStatus.get(serverInfo.getStatus()));
> + builder.publicAddresses(filter(transform(serverInfo.getNics(), nicToAddress), notNull()));
> +
> + // CloudSigma does not provide a way to get the credentials.
> + // Try to return them from the credential store
> + Credentials credentials = credentialStore.get("node#" + serverInfo.getUuid());
> + if (credentials instanceof LoginCredentials) {
> + builder.credentials(LoginCredentials.class.cast(credentials));
> + }
> +
> + return builder.build();
> + }
> +
> + private String extractImageId(ServerInfo serverInfo) {
[minor] Can be static?
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/70/files#r17825980
Re: [jclouds-labs] CloudSigma2 ComputeService and
SecurityGroupExtension (#70)
Posted by Andrew Phillips <no...@github.com>.
> +import org.jclouds.scriptbuilder.domain.StatementList;
> +import org.jclouds.scriptbuilder.statements.ssh.InstallRSAPrivateKey;
> +import org.jclouds.ssh.SshKeys;
> +import org.testng.annotations.Test;
> +
> +import java.util.Map;
> +
> +import static org.testng.Assert.assertEquals;
> +import static org.testng.Assert.assertNull;
> +import static org.testng.Assert.assertTrue;
> +
> +/**
> + * Unit tests for the {@link TemplateOptionsToStatementWithoutPublicKey} class.
> + */
> +@Test(groups = "unit", testName = "TemplateOptionsToStatementWithoutPublicKeyTest")
> +public class TemplateOptionsToStatementWithoutPublicKeyTest {
> I don't get your comment.
Sorry, my comment was indeed a bit short ;-) I had [commented above](https://github.com/jclouds/jclouds-labs/pull/70/files#r17825992) about some logic in `TemplateOptions` that modifies `options` (by calling `nameTask`) under certain conditions. I don't see a corresponding test for that behaviour.
I'm not saying we _need_ one, just wanted to point that out ;-)
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/70/files#r18261068
Re: [jclouds-labs] CloudSigma2 ComputeService and
SecurityGroupExtension (#70)
Posted by Ignasi Barrera <no...@github.com>.
> +
> + @Inject
> + public FirewallRuleToIpPermission(Map<FirewallIpProtocol, IpProtocol> firewallIpProtocolToIpProtocol) {
> + this.firewallIpProtocolToIpProtocol = checkNotNull(firewallIpProtocolToIpProtocol,
> + "firewallIpProtocolToIpProtocol");
> + }
> +
> + @Override
> + public IpPermission apply(FirewallRule input) {
> + IpPermission.Builder permissionBuilder = new IpPermission.Builder();
> + String destinationPort = input.getDestinationPort();
> + if (destinationPort != null) {
> + if (destinationPort.contains("!")) {
> + destinationPort = destinationPort.substring(destinationPort.indexOf("!") + 1,
> + destinationPort.length());
> + }
Having a deeper look at this, I think this class doesn't do the right thing. According to [the API docs](http://cloudsigma-docs.readthedocs.org/en/2.10/fwpolicies.html) the `!` character is used to "negate" a range. That is, a `!0-1024` range would mean any port that is **not** in that range. This class, however, just "ignores" the `!` character when parsing the ports and sets a range that is just the opposite than the one defined by the rule.
This must be changed so the returned port range properly reflects the behavior of the rule. That may require to change the function to return "more than one `IpPermission` given a single `FirewallRule`, but it is not a big deal to change this function to return an `Iterable`. It is important that this class returns the right thing.
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/70/files#r18435394
Re: [jclouds-labs] CloudSigma2 ComputeService and
SecurityGroupExtension (#70)
Posted by Ignasi Barrera <no...@github.com>.
This PR fixes: https://issues.apache.org/jira/browse/JCLOUDS-292
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/70#issuecomment-53936749
Re: [jclouds-labs] CloudSigma2 ComputeService and
SecurityGroupExtension (#70)
Posted by Andrew Phillips <no...@github.com>.
> + .cpu((int) hardware.getProcessors().get(0).getSpeed())
> + .memory(BigInteger.valueOf(hardware.getRam()).multiply(BigInteger.valueOf(1024 * 1024)))
> + .drives(ImmutableList.of(drive.toServerDrive(1, "0:1", options.getDeviceEmulationType())))
> + .nics(nics)
> + .meta(metadata)
> + .tags(tagIds)
> + .vncPassword(Optional.fromNullable(options.getVncPassword()).or(defaultVncPassword)).build());
> +
> + api.startServer(serverInfo.getUuid());
> +
> + return new NodeAndInitialCredentials<ServerInfo>(serverInfo, serverInfo.getUuid(), LoginCredentials.builder()
> + .build());
> + } catch (Exception ex) {
> + if (serverInfo != null) {
> + logger.debug(">> rolling back the server...");
> + api.deleteServer(serverInfo.getUuid());
If this blows up, you will not be able to destroy the cloned drives?
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/70/files#r17826024
Re: [jclouds-labs] CloudSigma2 ComputeService and
SecurityGroupExtension (#70)
Posted by Ignasi Barrera <no...@github.com>.
Code LGTM. I've rebased the branch to the latest master and fixed a couple minor checkstyle violations, but there are 2 failures in the live tests (and 5 tests skipped as a consequence). Could you have a look to them?
/cc @shevchenator
```bash
-------------------------------------------------------------------------------
Test set: TestSuite
-------------------------------------------------------------------------------
Tests run: 84, Failures: 2, Errors: 0, Skipped: 5, Time elapsed: 2,174.414 sec <<< FAILURE! - in TestSuite
testAddIpPermission(org.jclouds.cloudsigma2.compute.extensions.CloudSigma2LasVegasSecurityGroupExtensionLiveTest) Time elapsed: 9.069 sec <<< FAILURE!
java.lang.IllegalArgumentException: [{"error_point": "dst_port", "error_type": "validation", "error_message": "Invalid port range '41:41'. {port1} should be smaller than {port2}"}]
at org.jclouds.cloudsigma2.handlers.CloudSigmaErrorHandler.handleError(CloudSigmaErrorHandler.java:64)
at org.jclouds.http.handlers.DelegatingErrorHandler.handleError(DelegatingErrorHandler.java:65)
at org.jclouds.http.internal.BaseHttpCommandExecutorService.shouldContinue(BaseHttpCommandExecutorService.java:135)
at org.jclouds.http.internal.BaseHttpCommandExecutorService.invoke(BaseHttpCommandExecutorService.java:105)
at org.jclouds.rest.internal.InvokeHttpMethod.invoke(InvokeHttpMethod.java:91)
at org.jclouds.rest.internal.InvokeHttpMethod.apply(InvokeHttpMethod.java:74)
at org.jclouds.rest.internal.InvokeHttpMethod.apply(InvokeHttpMethod.java:45)
at org.jclouds.rest.internal.DelegatesToInvocationFunction.handle(DelegatesToInvocationFunction.java:156)
at org.jclouds.rest.internal.DelegatesToInvocationFunction.invoke(DelegatesToInvocationFunction.java:123)
at com.sun.proxy.$Proxy55.editFirewallPolicy(Unknown Source)
at org.jclouds.cloudsigma2.compute.extensions.CloudSigma2SecurityGroupExtension.addIpPermission(CloudSigma2SecurityGroupExtension.java:173)
at org.jclouds.cloudsigma2.compute.extensions.CloudSigma2SecurityGroupExtension.addIpPermission(CloudSigma2SecurityGroupExtension.java:133)
at org.jclouds.compute.extensions.internal.BaseSecurityGroupExtensionLiveTest.testAddIpPermission(BaseSecurityGroupExtensionLiveTest.java:144)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:84)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:714)
at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:901)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1231)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:127)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111)
at org.testng.TestRunner.privateRun(TestRunner.java:767)
at org.testng.TestRunner.run(TestRunner.java:617)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:348)
at org.testng.SuiteRunner.access$000(SuiteRunner.java:38)
at org.testng.SuiteRunner$SuiteWorker.run(SuiteRunner.java:382)
at org.testng.internal.thread.ThreadUtil$2.call(ThreadUtil.java:64)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.jclouds.http.HttpResponseException: command: PUT https://lvs.cloudsigma.com/api/2.0/fwpolicies/d8ee1f91-4d05-4904-ba98-d50e2a01b2f5/ HTTP/1.1 failed with response: HTTP/1.1 400 BAD REQUEST; content: [[{"error_point": "dst_port", "error_type": "validation", "error_message": "Invalid port range '41:41'. {port1} should be smaller than {port2}"}]]
at org.jclouds.cloudsigma2.handlers.CloudSigmaErrorHandler.handleError(CloudSigmaErrorHandler.java:51)
at org.jclouds.http.handlers.DelegatingErrorHandler.handleError(DelegatingErrorHandler.java:65)
at org.jclouds.http.internal.BaseHttpCommandExecutorService.shouldContinue(BaseHttpCommandExecutorService.java:135)
at org.jclouds.http.internal.BaseHttpCommandExecutorService.invoke(BaseHttpCommandExecutorService.java:105)
at org.jclouds.rest.internal.InvokeHttpMethod.invoke(InvokeHttpMethod.java:91)
at org.jclouds.rest.internal.InvokeHttpMethod.apply(InvokeHttpMethod.java:74)
at org.jclouds.rest.internal.InvokeHttpMethod.apply(InvokeHttpMethod.java:45)
at org.jclouds.rest.internal.DelegatesToInvocationFunction.handle(DelegatesToInvocationFunction.java:156)
at org.jclouds.rest.internal.DelegatesToInvocationFunction.invoke(DelegatesToInvocationFunction.java:123)
at com.sun.proxy.$Proxy55.editFirewallPolicy(Unknown Source)
at org.jclouds.cloudsigma2.compute.extensions.CloudSigma2SecurityGroupExtension.addIpPermission(CloudSigma2SecurityGroupExtension.java:173)
at org.jclouds.cloudsigma2.compute.extensions.CloudSigma2SecurityGroupExtension.addIpPermission(CloudSigma2SecurityGroupExtension.java:133)
at org.jclouds.compute.extensions.internal.BaseSecurityGroupExtensionLiveTest.testAddIpPermission(BaseSecurityGroupExtensionLiveTest.java:144)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:84)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:714)
at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:901)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1231)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:127)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111)
at org.testng.TestRunner.privateRun(TestRunner.java:767)
at org.testng.TestRunner.run(TestRunner.java:617)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:348)
at org.testng.SuiteRunner.access$000(SuiteRunner.java:38)
at org.testng.SuiteRunner$SuiteWorker.run(SuiteRunner.java:382)
at org.testng.internal.thread.ThreadUtil$2.call(ThreadUtil.java:64)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
testEditTag(org.jclouds.cloudsigma2.CloudSigma2LasVegasLiveTest) Time elapsed: 4.45 sec <<< FAILURE!
org.jclouds.http.HttpResponseException: command: PUT https://lvs.cloudsigma.com/api/2.0/tags/14fd53c0-c210-44d1-887b-e8ad89b10837/ HTTP/1.1 failed with response: HTTP/1.1 500 INTERNAL SERVER ERROR; content: [[{"error_point": null, "error_type": "backend", "error_message": "unknown error"}]]
at org.jclouds.cloudsigma2.handlers.CloudSigmaErrorHandler.handleError(CloudSigmaErrorHandler.java:51)
at org.jclouds.http.handlers.DelegatingErrorHandler.handleError(DelegatingErrorHandler.java:67)
at org.jclouds.http.internal.BaseHttpCommandExecutorService.shouldContinue(BaseHttpCommandExecutorService.java:135)
at org.jclouds.http.internal.BaseHttpCommandExecutorService.invoke(BaseHttpCommandExecutorService.java:105)
at org.jclouds.rest.internal.InvokeHttpMethod.invoke(InvokeHttpMethod.java:91)
at org.jclouds.rest.internal.InvokeHttpMethod.apply(InvokeHttpMethod.java:74)
at org.jclouds.rest.internal.InvokeHttpMethod.apply(InvokeHttpMethod.java:45)
at org.jclouds.rest.internal.DelegatesToInvocationFunction.handle(DelegatesToInvocationFunction.java:156)
at org.jclouds.rest.internal.DelegatesToInvocationFunction.invoke(DelegatesToInvocationFunction.java:123)
at com.sun.proxy.$Proxy55.editTag(Unknown Source)
at org.jclouds.cloudsigma2.CloudSigma2ApiLiveTest.testEditTag(CloudSigma2ApiLiveTest.java:572)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:84)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:714)
at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:901)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1231)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:127)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111)
at org.testng.TestRunner.privateRun(TestRunner.java:767)
at org.testng.TestRunner.run(TestRunner.java:617)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:348)
at org.testng.SuiteRunner.access$000(SuiteRunner.java:38)
at org.testng.SuiteRunner$SuiteWorker.run(SuiteRunner.java:382)
at org.testng.internal.thread.ThreadUtil$2.call(ThreadUtil.java:64)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
```
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/70#issuecomment-56012486
Re: [jclouds-labs] CloudSigma2 ComputeService and
SecurityGroupExtension (#70)
Posted by CloudBees pull request builder plugin <no...@github.com>.
[jclouds-labs-pull-requests #235](https://jclouds.ci.cloudbees.com/job/jclouds-labs-pull-requests/235/) SUCCESS
This pull request looks good
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/70#issuecomment-53927338
Re: [jclouds-labs] CloudSigma2 ComputeService and
SecurityGroupExtension (#70)
Posted by BuildHive <no...@github.com>.
[jclouds » jclouds-labs #1592](https://buildhive.cloudbees.com/job/jclouds/job/jclouds-labs/1592/) FAILURE
Looks like there's a problem with this pull request
[(what's this?)](https://www.cloudbees.com/what-is-buildhive)
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/70#issuecomment-57895939
Re: [jclouds-labs] CloudSigma2 ComputeService and
SecurityGroupExtension (#70)
Posted by CloudBees pull request builder plugin <no...@github.com>.
[jclouds-labs-pull-requests #316](https://jclouds.ci.cloudbees.com/job/jclouds-labs-pull-requests/316/) FAILURE
Looks like there's a problem with this pull request
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/70#issuecomment-59307882
Re: [jclouds-labs] CloudSigma2 ComputeService and
SecurityGroupExtension (#70)
Posted by Ignasi Barrera <no...@github.com>.
Closed #70.
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/70#event-184207626
Re: [jclouds-labs] CloudSigma2 ComputeService and
SecurityGroupExtension (#70)
Posted by BuildHive <no...@github.com>.
[jclouds » jclouds-labs #1580](https://buildhive.cloudbees.com/job/jclouds/job/jclouds-labs/1580/) SUCCESS
This pull request looks good
[(what's this?)](https://www.cloudbees.com/what-is-buildhive)
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/70#issuecomment-57721846
Re: [jclouds-labs] CloudSigma2 ComputeService and
SecurityGroupExtension (#70)
Posted by Viktor Petersson <no...@github.com>.
Is there anything holding this back, @nacx?
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/70#issuecomment-55107533
Re: [jclouds-labs] CloudSigma2 ComputeService and
SecurityGroupExtension (#70)
Posted by Ilya Kulakov <no...@github.com>.
> + }).to(FirewallRuleToIpPermission.class);
> +
> + bind(TemplateOptions.class).to(CloudSigma2TemplateOptions.class);
> + bind(TemplateOptionsToStatement.class).to(TemplateOptionsToStatementWithoutPublicKey.class);
> +
> + bind(new TypeLiteral<SecurityGroupExtension>() {
> + }).to(CloudSigma2SecurityGroupExtension.class);
> + }
> +
> + @Override
> + protected Optional<SecurityGroupExtension> provideSecurityGroupExtension(Injector i) {
> + return Optional.of(i.getInstance(SecurityGroupExtension.class));
> + }
> +
> + @VisibleForTesting
> + public static final Map<ServerStatus, NodeMetadata.Status> serverStatusToNodeStatus = ImmutableMap
@demobox If I make them protected they become invisible to tests. E.g. I get the following error in `ServerInfoToNodeMetadataTest.java`:
jclouds-labs/cloudsigma2/src/test/java/org/jclouds/cloudsigma2/compute/functions/ServerInfoToNodeMetadataTest.java:[60,1] cannot find symbol
[ERROR] symbol: static serverStatusToNodeStatus
[ERROR] location: class
...
jclouds-labs/cloudsigma2/src/test/java/org/jclouds/cloudsigma2/compute/functions/ServerInfoToNodeMetadataTest.java:[170,13] cannot find symbol
[ERROR] symbol: variable serverStatusToNodeStatus
[ERROR] location: class org.jclouds.cloudsigma2.compute.functions.ServerInfoToNodeMetadataTest
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/70/files#r18372761
Re: [jclouds-labs] CloudSigma2 ComputeService and
SecurityGroupExtension (#70)
Posted by Ignasi Barrera <no...@github.com>.
> +import org.jclouds.scriptbuilder.domain.StatementList;
> +import org.jclouds.scriptbuilder.statements.ssh.InstallRSAPrivateKey;
> +import org.jclouds.ssh.SshKeys;
> +import org.testng.annotations.Test;
> +
> +import java.util.Map;
> +
> +import static org.testng.Assert.assertEquals;
> +import static org.testng.Assert.assertNull;
> +import static org.testng.Assert.assertTrue;
> +
> +/**
> + * Unit tests for the {@link TemplateOptionsToStatementWithoutPublicKey} class.
> + */
> +@Test(groups = "unit", testName = "TemplateOptionsToStatementWithoutPublicKeyTest")
> +public class TemplateOptionsToStatementWithoutPublicKeyTest {
I don't get your comment. The tested class just extends the jclouds one to avoid adding an SSH script to upload the public key. Instead of that, CloudSigma provides its own mechanism in the API to make the key populated, so there is no need to generate a statement that manually uploads it.
This test class just tests that the generated options don't contain the upload key statement when the "authorizePublicKey" option is used.
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/70/files#r18021450