From 70269b5e1123ea17a5eee66a7938cc0b71eca7eb Mon Sep 17 00:00:00 2001 From: Luis Toledo Date: Tue, 31 Dec 2019 15:59:53 -0300 Subject: [PATCH] expose the connection protocol endpoing as a plugin attribute --- .../azure/plugin/AzureFileStoragePlugin.groovy | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/main/groovy/com/rundeck/plugins/azure/plugin/AzureFileStoragePlugin.groovy b/src/main/groovy/com/rundeck/plugins/azure/plugin/AzureFileStoragePlugin.groovy index 1175211..21f0250 100644 --- a/src/main/groovy/com/rundeck/plugins/azure/plugin/AzureFileStoragePlugin.groovy +++ b/src/main/groovy/com/rundeck/plugins/azure/plugin/AzureFileStoragePlugin.groovy @@ -10,6 +10,7 @@ import com.dtolabs.rundeck.core.plugins.Plugin import com.dtolabs.rundeck.plugins.ServiceNameConstants import com.dtolabs.rundeck.plugins.descriptions.PluginDescription import com.dtolabs.rundeck.plugins.descriptions.PluginProperty +import com.dtolabs.rundeck.plugins.descriptions.SelectValues import com.dtolabs.rundeck.plugins.logging.ExecutionFileStoragePlugin import com.microsoft.azure.management.resources.fluentcore.arm.models.HasManager import com.microsoft.azure.storage.CloudStorageAccount @@ -52,6 +53,11 @@ class AzureFileStoragePlugin implements ExecutionFileStoragePlugin, ExecutionMul @PluginProperty(title = "Access Key", description = "Azure Storage Access Key") private String accessKey; + @PluginProperty(title = "Endpoint Protocol", description = "Default Endpoint Protocol: http or https ", defaultValue = "http") + private String defaultEndpointProtocol + + @PluginProperty(title = "Extra connection string settings", description = "Extra connection settings, see https://docs.microsoft.com/en-us/azure/storage/common/storage-configure-connection-string#store-a-connection-string") + private String extraConnectionSettings @PluginProperty( title = "Path", @@ -104,7 +110,11 @@ class AzureFileStoragePlugin implements ExecutionFileStoragePlugin, ExecutionMul throw new IllegalArgumentException("expanded value of path must not end with /"); } - String storageConnectionString = "DefaultEndpointsProtocol=http;AccountName=" + this.storageAccount+ ";AccountKey=" + this.accessKey; + String storageConnectionString = "DefaultEndpointsProtocol="+defaultEndpointProtocol+";AccountName=" + this.storageAccount+ ";AccountKey=" + this.accessKey; + + if(extraConnectionSettings){ + storageConnectionString = storageConnectionString + ";" + extraConnectionSettings + } CloudStorageAccount account = CloudStorageAccount.parse(storageConnectionString); serviceClient = account.createCloudBlobClient(); @@ -240,10 +250,7 @@ class AzureFileStoragePlugin implements ExecutionFileStoragePlugin, ExecutionMul } String getFileName(String fileType){ - println ("en filename") - println context String executionId=context.get(META_EXECID) - println ("executionId: ${executionId}") String project=context.get(META_PROJECT) String fileName="${project}/${executionId}.${fileType}"