You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@jclouds.apache.org by ygy <no...@github.com> on 2017/05/23 20:40:40 UTC
[jclouds/jclouds-labs] Adding support for provisioning of Windows VMs
with enabled WinRM (#393)
- Provisioning using pre-existing KeyVault
- Enabling WinRM with pre-existing certificate
You can view, comment on, or merge this pull request online at:
https://github.com/jclouds/jclouds-labs/pull/393
-- Commit Summary --
* Adding support for provisioning of Windows VMs with enabled WinRM
-- File Changes --
M azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/compute/AzureComputeServiceAdapter.java (16)
M azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/compute/options/AzureTemplateOptions.java (58)
M azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/OSProfile.java (88)
A azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/Secrets.java (55)
A azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/VaultCertificate.java (43)
M azurecompute-arm/src/test/java/org/jclouds/azurecompute/arm/features/VirtualMachineApiLiveTest.java (44)
M azurecompute-arm/src/test/java/org/jclouds/azurecompute/arm/features/VirtualMachineApiMockTest.java (78)
M azurecompute-arm/src/test/resources/createvirtualmachineresponse.json (69)
M azurecompute-arm/src/test/resources/virtualmachine.json (65)
M azurecompute-arm/src/test/resources/virtualmachines.json (57)
-- Patch Links --
https://github.com/jclouds/jclouds-labs/pull/393.patch
https://github.com/jclouds/jclouds-labs/pull/393.diff
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/393
Re: [jclouds/jclouds-labs] Adding support for provisioning of Windows
VMs with enabled WinRM (#393)
Posted by Ignasi Barrera <no...@github.com>.
Closed #393.
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/393#event-1097453958
Re: [jclouds/jclouds-labs] Adding support for provisioning of Windows
VMs with enabled WinRM (#393)
Posted by ygy <no...@github.com>.
@ygy pushed 1 commit.
a856762 Renaming of the sys properties so they include the provider's name
--
You are receiving this because you are subscribed to this thread.
View it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/393/files/c6680d81dfb259f7351cc8b9dcc139b74214801b..a856762a4516598ddeb64b417b904f76a2f5225a
Re: [jclouds/jclouds-labs] Adding support for provisioning of Windows
VMs with enabled WinRM (#393)
Posted by Aled Sage <no...@github.com>.
aledsage commented on this pull request.
Thanks @ygy - LGTM. Only some very minor comments.
> @@ -91,15 +90,58 @@ public static LinuxConfiguration create(final String disablePasswordAuthenticati
@AutoValue
public abstract static class WinRM {
+ public enum ListenerProtocol {
+
+ HTTP("http"),
+ HTTPS("https"),
+ UNRECOGNIZED("Unrecognized");
+
+ private String value;
+
+ ListenerProtocol(String value) {
+ this.value = value;
+ }
+
+ public static ListenerProtocol fromValue(String value) {
+ ListenerProtocol[] items = ListenerProtocol.values();
Could use the same pattern as is in https://github.com/jclouds/jclouds-labs/blob/master/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/ComputeNode.java#L28
> @@ -91,15 +90,58 @@ public static LinuxConfiguration create(final String disablePasswordAuthenticati
@AutoValue
public abstract static class WinRM {
+ public enum Protocol {
+
+ HTTP("http"),
+ HTTPS("https"),
+ UNRECOGNIZED("Unrecognized");
+
+ private String value;
+
+ Protocol(String value) {
+ this.value = value;
+ }
+
+ public static Protocol fromValue(String value) {
+ Protocol[] items = Protocol.values();
Could use the same pattern as https://github.com/jclouds/jclouds-labs/blob/master/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/domain/ComputeNode.java#L28, i.e.
return (Protocol) GetEnumValue.fromValueOrDefault(value, Protocol.UNRECOGNIZED);
> +
+/**
+ * Certificate stored in a Key Vault
+ */
+@AutoValue
+public abstract class VaultCertificate {
+
+ /**
+ * The URL of the certificate
+ */
+ public abstract String certificateUrl();
+
+ /**
+ * Certificate's store name
+ */
+ public abstract String certificateStore();
Needs `@Nullable` - both here, and on the arg to `create` - see https://docs.microsoft.com/en-us/rest/api/compute/virtualmachines/virtualmachines-create-or-update#bk_vaultcert, which says that it is not required.
I believe that if you don't include `@Nullable` then `AutoValue`'s auto-generated code will throw a `NullPointerException` if the value is null.
(Actually, probably don't need it on the arg to `create()` - we don't do that elsewhere).
> + "\"plan\":{\"name\":\"deadline-slave-7-2\",\"publisher\":\"thinkboxsoftware\",\"product\":\"deadline7-2\"}}");
}
+ // See https://docs.microsoft.com/en-us/rest/api/compute/virtualmachines/virtualmachines-create-or-update
A slightly more accurate comment would be:
// See https://docs.microsoft.com/en-us/rest/api/compute/virtualmachines/virtualmachines-create-or-update
// for where part of the example json response comes from. Unfortunately examples in the microsoft docs
// are not valid json (e.g. missing commas, illegal quotes). Therefore this example merges the original
// real-world example (presumably taken from the jclouds wire log), and snippets from the microsoft docs.
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/393#pullrequestreview-39969372
Re: [jclouds/jclouds-labs] Adding support for provisioning of Windows
VMs with enabled WinRM (#393)
Posted by Вальо <no...@github.com>.
bostko commented on this pull request.
> @@ -82,6 +87,20 @@ protected void tearDown() {
}
}
+ @BeforeClass
+ @Override
+ public void setup() {
+ super.setup();
+
+ // Providing system properties for specifying the required Azure KeyVault configurations for Live tests
+ // They have to be externally provided, because azurecompute-arm doesn't support creating KeyVaults yet
+ //
+ // TODO Replace the used configurations once full KeyVault implementation is added to azurecompute-arm
+ vaultResourceGroup = System.getProperty("test.vault.resource.group");
Rename to `test.azurecompute-arm.vault.resource.group`.
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/393#pullrequestreview-40219068
Re: [jclouds/jclouds-labs] Adding support for provisioning of Windows
VMs with enabled WinRM (#393)
Posted by Aled Sage <no...@github.com>.
Thanks @ygy (and @neykov @andreaturli @bostko)!
Could one of you please add this to the 2.0.x branch as well?
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/393#issuecomment-304012871
Re: [jclouds/jclouds-labs] Adding support for provisioning of Windows
VMs with enabled WinRM (#393)
Posted by ygy <no...@github.com>.
@ygy pushed 1 commit.
3dde085 Addressing more PR comments
--
You are receiving this because you are subscribed to this thread.
View it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/393/files/155b0ab291de1b102e432660102c90887c8c8b6f..3dde085ebbeeba114f4f2f6d6030e73319283150
Re: [jclouds/jclouds-labs] Adding support for provisioning of Windows
VMs with enabled WinRM (#393)
Posted by Andrea Turli <no...@github.com>.
andreaturli commented on this pull request.
thanks @ygy -- looks really useful
some comments from my quick review, haven't executed the live tests though
> + * Windows configuration parameters
+ *
+ * @see <a href="https://docs.microsoft.com/en-us/rest/api/compute/virtualmachines/virtualmachines-create-or-update#bk_windowsconfig5">docs</a>
+ */
+ public AzureTemplateOptions windowsConfiguration(WindowsConfiguration windowsConfiguration) {
+ this.windowsConfiguration = windowsConfiguration;
+ return this;
+ }
+
+ /**
+ * Import certificates in the Windows Certificate Store
+ *
+ * @see <a href="https://docs.microsoft.com/en-us/rest/api/compute/virtualmachines/virtualmachines-create-or-update#bk_srcvault">docs</a>
+ */
+ public AzureTemplateOptions secrets(Iterable<? extends Secrets> secrets) {
+ this.secrets = (secrets == null) ? null : ImmutableList.copyOf(checkNotNull(secrets, "secrets"));
if all `secrets` must be non null, you may want to use the same pattern used for `ipOptions` above
> @@ -91,15 +90,58 @@ public static LinuxConfiguration create(final String disablePasswordAuthenticati
@AutoValue
public abstract static class WinRM {
+ public enum ListenerProtocol {
is `Protocol` a better name?
> @@ -96,6 +107,11 @@ public void setup() {
nicName = nic.name();
vmName = String.format("%3.24s", System.getProperty("user.name") + RAND + this.getClass().getSimpleName()).toLowerCase().substring(0, 15);
+
+ vaultResourceGroup = System.getProperty("test.vault.resource.group");
I think this makes the test harder to execute: either you add it to `BaseAzureComputeApiLiveTest` or the test needs to create those prelimiary resources during the setup and destroy during tearDown. wdyt?
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/393#pullrequestreview-39866885
Re: [jclouds/jclouds-labs] Adding support for provisioning of Windows
VMs with enabled WinRM (#393)
Posted by ygy <no...@github.com>.
@ygy pushed 1 commit.
19d567e Addressing PR comments #3
--
You are receiving this because you are subscribed to this thread.
View it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/393/files/3dde085ebbeeba114f4f2f6d6030e73319283150..19d567ef816da1f1b08fd03d50ec7d5e3ee85005
Re: [jclouds/jclouds-labs] Adding support for provisioning of Windows
VMs with enabled WinRM (#393)
Posted by Aled Sage <no...@github.com>.
aledsage commented on this pull request.
> @@ -91,15 +90,52 @@ public static LinuxConfiguration create(final String disablePasswordAuthenticati
@AutoValue
public abstract static class WinRM {
+ public enum Protocol {
+
+ HTTP("http"),
+ HTTPS("https"),
+ UNRECOGNIZED("Unrecognized");
@bostko I think it's better to produce an UNRECOGNIZED value rather than an exception or null, if we get back some different value. For example, if microsoft add a third possible value in their API, which jclouds doesn't understand, then we'll say that is `UNRECOGNIZED`.
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/393#discussion_r118480905
Re: [jclouds/jclouds-labs] Adding support for provisioning of Windows
VMs with enabled WinRM (#393)
Posted by ygy <no...@github.com>.
@andreaturli thanks for the review. I've addressed the comments. The live test receives the parameters via system properties, because they have to exist before the test execution. Azurecompute-arm still can not provision keyvaults and secrets.
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/393#issuecomment-303671821
Re: [jclouds/jclouds-labs] Adding support for provisioning of Windows
VMs with enabled WinRM (#393)
Posted by Вальо <no...@github.com>.
bostko commented on this pull request.
> @@ -91,15 +90,52 @@ public static LinuxConfiguration create(final String disablePasswordAuthenticati
@AutoValue
public abstract static class WinRM {
+ public enum Protocol {
+
+ HTTP("http"),
+ HTTPS("https"),
+ UNRECOGNIZED("Unrecognized");
I do not think it is appropriate for this case since there are no other options.
Even if there are it will be invalid for any jclouds user.
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/393#discussion_r118460951
Re: [jclouds/jclouds-labs] Adding support for provisioning of Windows
VMs with enabled WinRM (#393)
Posted by Svet <no...@github.com>.
Thanks @ygy and all reviewers. Changes look good. Merging.
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/393#issuecomment-304010462
Re: [jclouds/jclouds-labs] Adding support for provisioning of Windows
VMs with enabled WinRM (#393)
Posted by Aled Sage <no...@github.com>.
aledsage commented on this pull request.
> @@ -91,15 +90,52 @@ public static LinuxConfiguration create(final String disablePasswordAuthenticati
@AutoValue
public abstract static class WinRM {
+ public enum Protocol {
+
+ HTTP("http"),
+ HTTPS("https"),
+ UNRECOGNIZED("Unrecognized");
@bostko I think this is just a jclouds convention, of including "UNRECOGNIZED" for if we come across an unknown value (rather than it setting the field to null or throwing an exception).
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/393#discussion_r118455629
Re: [jclouds/jclouds-labs] Adding support for provisioning of Windows
VMs with enabled WinRM (#393)
Posted by Svet <no...@github.com>.
Added to [2.0.x](https://git1-us-west.apache.org/repos/asf?p=jclouds-labs.git;a=commit;h=c4a91d2d909a4edf52adf1367b5353d81cde681b).
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/393#issuecomment-304024872
Re: [jclouds/jclouds-labs] Adding support for provisioning of Windows
VMs with enabled WinRM (#393)
Posted by ygy <no...@github.com>.
@ygy pushed 1 commit.
155b0ab Addressing PR comments
--
You are receiving this because you are subscribed to this thread.
View it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/393/files/bbcefe1be11b635c6ca41ca12e6bb5ddf4a6f838..155b0ab291de1b102e432660102c90887c8c8b6f
Re: [jclouds/jclouds-labs] Adding support for provisioning of Windows
VMs with enabled WinRM (#393)
Posted by Вальо <no...@github.com>.
bostko commented on this pull request.
> @@ -91,15 +90,52 @@ public static LinuxConfiguration create(final String disablePasswordAuthenticati
@AutoValue
public abstract static class WinRM {
+ public enum Protocol {
+
+ HTTP("http"),
+ HTTPS("https"),
+ UNRECOGNIZED("Unrecognized");
I cannot find any "Unrecognized" protocol in Azure documentation.
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/393#pullrequestreview-40218361
Re: [jclouds/jclouds-labs] Adding support for provisioning of Windows
VMs with enabled WinRM (#393)
Posted by Svet <no...@github.com>.
Merged to [master](https://git1-us-west.apache.org/repos/asf?p=jclouds-labs.git;a=commit;h=6e0cbc915cfb1e3f0cb9cdafd3b56b948e0e80a8).
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/393#issuecomment-304011560