diff --git a/.releaserc.json b/.releaserc.json index 38ad4d95..56852c6e 100644 --- a/.releaserc.json +++ b/.releaserc.json @@ -1,5 +1,6 @@ { "branches": [ "production", "+([0-9])?(.{+([0-9]),x}).x"], + "preset": "conventionalcommits", "plugins": [ "@semantic-release/commit-analyzer", "@semantic-release/release-notes-generator", diff --git a/gen/ad_group_mu_ucn b/gen/ad_group_mu_ucn index 7ebb2c9a..9aab7c9e 100755 --- a/gen/ad_group_mu_ucn +++ b/gen/ad_group_mu_ucn @@ -11,7 +11,7 @@ no if $] >= 5.017011, warnings => 'experimental::smartmatch'; local $::SERVICE_NAME = "ad_group_mu_ucn"; local $::PROTOCOL_VERSION = "3.0.0"; -my $SCRIPT_VERSION = "3.0.6"; +my $SCRIPT_VERSION = "3.0.7"; sub addMemberToGroup; sub processWorkplaces; @@ -127,7 +127,7 @@ close FILE; # Print skipped data # open FILE,">:encoding(UTF-8)","$skippedGroupsFileName" or die "Cannot open $skippedGroupsFileName: $! \n"; -for my $group (keys %$skippedGroups) { +for my $group (sort keys %$skippedGroups) { print FILE "gid=" . $skippedGroups->{$group}->{"id"} . "," . "name=" . $skippedGroups->{$group}->{"name"} . "\n"; } close FILE; diff --git a/gen/pbsmon_json b/gen/pbsmon_json index dc6887b0..ee6c62fd 100755 --- a/gen/pbsmon_json +++ b/gen/pbsmon_json @@ -43,6 +43,21 @@ $struc->{'reserved_machines'} = []; $struc->{'frontends'} = []; +# Get attribute values from obtained attributes (input). +# +# Usage: +# my $data = $attributesAgent->getRequiredAttributes(service => $service->getId, host => $host->getId); +# my %facilityAttributes = attributesToHash $data +# print $facilityAttributes{"urn:perun:facility:attribute-def:core:name"}, "\n"; +# +sub attributesToHash { + my %attributesHash; + foreach my $attr (@_) { + $attributesHash{$attr->getName}=$attr->getValue; + } + return %attributesHash; +} + my $physicalMachinesStruc = {}; my $agent = perunServicesInit->getAgent; @@ -134,9 +149,9 @@ for my $item (sort { $b->{"facilityListingPriority"} <=> $a->{"facilityListingPr } ); $physicalMachinesStruc->{$mergedOwner} = \%ownerStruc; -} + } -push @{$physicalMachinesStruc->{$mergedOwner}->{'resources'}}, $facilityStruc; + push @{$physicalMachinesStruc->{$mergedOwner}->{'resources'}}, $facilityStruc; my @hosts = $facilitiesAgent->getHosts(facility => $facility->getId); @@ -153,7 +168,7 @@ push @{$physicalMachinesStruc->{$mergedOwner}->{'resources'}}, $facilityStruc; $facilityStruc->{'cpu'} = $hostsStruc[0]->{'cpu'}; } else { $facilityStruc->{'machines'} = \@hostsStruc; -} + } } for my $key (sort keys %$physicalMachinesStruc) { diff --git a/gen/perunServicesInit.pm b/gen/perunServicesInit.pm index 4fdf65e4..6ea5812b 100644 --- a/gen/perunServicesInit.pm +++ b/gen/perunServicesInit.pm @@ -3,7 +3,7 @@ package perunServicesInit; use Exporter 'import'; @EXPORT_OK = qw(init); -@EXPORT= qw(getDirectory getDestinationDirectory getHierarchicalData getDataWithGroups getDataWithVos getHashedDataWithGroups getHashedHierarchicalData); +@EXPORT= qw(getDirectory getDestinationDirectory getHashedDataWithGroups getHashedHierarchicalData); use strict; use warnings; @@ -18,19 +18,11 @@ use IO::Compress::Gzip qw(gzip $GzipError) ; use Storable; # variables define possible getData methods what can be execute -our $DATA_TYPE_HIERARCHICAL="hierarchical"; our $DATA_TYPE_HASHED_HIERARCHICAL="hashedhierarchical"; -our $DATA_TYPE_FLAT="flat"; our $DATA_TYPE_HASHED_WITH_GROUPS="hashedwithgroups"; -our $DATA_TYPE_WITH_GROUPS="withgroups"; -our $DATA_TYPE_WITH_VOS="withvos"; our $DATA_TYPE = { $DATA_TYPE_HASHED_HIERARCHICAL => sub {getHashedHierarchicalData(@_)}, - $DATA_TYPE_HIERARCHICAL => sub {getHierarchicalData(@_)}, - $DATA_TYPE_FLAT => sub {getFlatData(@_)}, $DATA_TYPE_HASHED_WITH_GROUPS => sub {getHashedDataWithGroups(@_)}, - $DATA_TYPE_WITH_GROUPS => sub {getDataWithGroups(@_)}, - $DATA_TYPE_WITH_VOS => sub {getDataWithVos(@_)}, }; #die at the very end of script when any warning occur during executing @@ -62,11 +54,11 @@ sub init { # some services support variable getData method type, default is hierarchical # if service does not support this variable behavior, then it does not care about this setting - if(!defined($getDataType)) { $getDataType = "hierarchical"; } + if(!defined($getDataType)) { $getDataType = $DATA_TYPE_HASHED_HIERARCHICAL; } if(defined($DATA_TYPE->{$getDataType})) { $::GET_DATA_METHOD = $DATA_TYPE->{$getDataType}; } else { - die "Not supported getData type $getDataType! Use one of these: '$DATA_TYPE_HIERARCHICAL', '$DATA_TYPE_HASHED_HIERARCHICAL', '$DATA_TYPE_FLAT', '$DATA_TYPE_WITH_GROUPS', '$DATA_TYPE_HASHED_WITH_GROUPS' or '$DATA_TYPE_WITH_VOS'."; + die "Not supported getData type $getDataType! Use one of these: '$DATA_TYPE_HASHED_HIERARCHICAL' or '$DATA_TYPE_HASHED_WITH_GROUPS'."; } if(defined $local_data_file) { @@ -149,20 +141,6 @@ sub getHashedHierarchicalData { return $data; } -sub getHierarchicalData { - if(defined $local_data) { return $local_data; } - my $data = $servicesAgent->getHierarchicalData(service => $service->getId, facility => $facility->getId); - logData $data, 'hierarchicalData'; - return $data; -} - -sub getFlatData { - if(defined $local_data) { return $local_data; } - my $data = $servicesAgent->getFlatData(service => $service->getId, facility => $facility->getId); - logData $data, 'flatData'; - return $data; -} - sub getHashedDataWithGroups { if(defined $local_data) { return $local_data; } my $data = $servicesAgent->getHashedDataWithGroups(service => $service->getId, facility => $facility->getId, consentEval => $CONSENT_EVAL); @@ -170,20 +148,6 @@ sub getHashedDataWithGroups { return $data; } -sub getDataWithGroups { - if(defined $local_data) { return $local_data; } - my $data = $servicesAgent->getDataWithGroups(service => $service->getId, facility => $facility->getId); - logData $data, 'dataWithGroups'; - return $data; -} - -sub getDataWithVos { - if(defined $local_data) { return $local_data; } - my $data = $servicesAgent->getDataWithVos(service => $service->getId, facility => $facility->getId); - logData $data, 'dataWithVos'; - return $data; -} - #Returns directory for storing generated files sub getDirectory { return $tmp_directory; diff --git a/gen/perunServicesUtils.pm b/gen/perunServicesUtils.pm index 22f4483d..936a960e 100644 --- a/gen/perunServicesUtils.pm +++ b/gen/perunServicesUtils.pm @@ -2,7 +2,7 @@ package perunServicesUtils; use Exporter; @ISA = ('Exporter'); -@EXPORT = qw(attributesToHash dataToAttributesHashes getAttributeSorting quotaToKb uniqList convertNonAsciiToEscapedUtf8Form); +@EXPORT = qw(getAttributeSorting quotaToKb uniqList convertNonAsciiToEscapedUtf8Form); use strict; use warnings; @@ -12,37 +12,6 @@ no if $] >= 5.018, warnings => "experimental"; #supress warnings on experimetal #use Perun::Agent; -# Get attributes from getData function and convert them into hash -# -# Usage: -# my $data = perunServicesInit::getHierarchicalData; -# my %facilityAttributes = attributesToHash $data->getAttributes -# print $facilityAttributes{"urn:perun:facility:attribute-def:core:name"}, "\n"; -# -sub attributesToHash { - my %attributesHash; - foreach my $attr (@_) { - $attributesHash{$attr->getName}=$attr->getValue; - } - return %attributesHash; -} - -# Get "data" from getData function and convert them into array of attributes. Attributes is represented by REFERENCE to hash. -# -# Usage: -# my $data = perunServicesInit::getHierarchicalData; -# foreach my $resourceAttributes (dataToAttributesHashes $data->getChildElements) { -# print $resourceAttributes->{"urn:perun:resource:attribute-def:core:name"}, "\n"; -# } -# -sub dataToAttributesHashes { - my @arrayOfHashes = (); - foreach my $entity (@_) { - push @arrayOfHashes, { attributesToHash $entity->getAttributes } ; - } - return @arrayOfHashes; -} - # Return sorting function which can be used as parameter for sort # This function can sort hashREF. diff --git a/package-lock.json b/package-lock.json index 7db64c48..336255cf 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,6 +9,7 @@ "version": "0.0.0-development", "devDependencies": { "@semantic-release/github": "^8.0.2", + "conventional-changelog-conventionalcommits": "^5.0.0", "semantic-release": "^19.0.3" } }, @@ -718,6 +719,20 @@ "node": ">=10" } }, + "node_modules/conventional-changelog-conventionalcommits": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/conventional-changelog-conventionalcommits/-/conventional-changelog-conventionalcommits-5.0.0.tgz", + "integrity": "sha512-lCDbA+ZqVFQGUj7h9QBKoIpLhl8iihkO0nCTyRNzuXtcd7ubODpYB04IFy31JloiJgG0Uovu8ot8oxRzn7Nwtw==", + "dev": true, + "dependencies": { + "compare-func": "^2.0.0", + "lodash": "^4.17.15", + "q": "^1.5.1" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/conventional-changelog-writer": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/conventional-changelog-writer/-/conventional-changelog-writer-5.0.0.tgz", @@ -6454,6 +6469,17 @@ "q": "^1.5.1" } }, + "conventional-changelog-conventionalcommits": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/conventional-changelog-conventionalcommits/-/conventional-changelog-conventionalcommits-5.0.0.tgz", + "integrity": "sha512-lCDbA+ZqVFQGUj7h9QBKoIpLhl8iihkO0nCTyRNzuXtcd7ubODpYB04IFy31JloiJgG0Uovu8ot8oxRzn7Nwtw==", + "dev": true, + "requires": { + "compare-func": "^2.0.0", + "lodash": "^4.17.15", + "q": "^1.5.1" + } + }, "conventional-changelog-writer": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/conventional-changelog-writer/-/conventional-changelog-writer-5.0.0.tgz", diff --git a/package.json b/package.json index 7b219f28..08bb5ec8 100644 --- a/package.json +++ b/package.json @@ -3,6 +3,7 @@ "version": "0.0.0-development", "devDependencies": { "@semantic-release/github": "^8.0.2", + "conventional-changelog-conventionalcommits": "^5.0.0", "semantic-release": "^19.0.3" } } diff --git a/send/bbmri_collections b/send/bbmri_collections index 408e2201..dddb8a96 100755 --- a/send/bbmri_collections +++ b/send/bbmri_collections @@ -26,7 +26,7 @@ fi [ -r /etc/perun/services/$SERVICE_NAME/$SERVICE_NAME ] && . /etc/perun/services/$SERVICE_NAME/$SERVICE_NAME # Specify command to transfer the data -TRANSPORT_COMMAND="curl -Ss -i -H Content-Type:application/json -f -X POST" +TRANSPORT_COMMAND="curl -Ss -i --http1.1 -H Content-Type:application/json -f -X POST" USER_TRANSPORT_COMMAND="$TRANSPORT_COMMAND -d @- $USERNAME_AND_PASSWORD $DESTINATION$USER_ENDPOINT" GROUP_TRANSPORT_COMMAND="$TRANSPORT_COMMAND -d @- $USERNAME_AND_PASSWORD $DESTINATION$GROUP_ENDPOINT"