Skip to content

Commit

Permalink
Merge branch 'master' into production
Browse files Browse the repository at this point in the history
  • Loading branch information
Johaney-s committed Mar 9, 2023
2 parents e33b2bc + eb07b29 commit bd74cd7
Show file tree
Hide file tree
Showing 8 changed files with 53 additions and 77 deletions.
1 change: 1 addition & 0 deletions .releaserc.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"branches": [ "production", "+([0-9])?(.{+([0-9]),x}).x"],
"preset": "conventionalcommits",
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
Expand Down
4 changes: 2 additions & 2 deletions gen/ad_group_mu_ucn
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
21 changes: 18 additions & 3 deletions gen/pbsmon_json
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand All @@ -153,7 +168,7 @@ push @{$physicalMachinesStruc->{$mergedOwner}->{'resources'}}, $facilityStruc;
$facilityStruc->{'cpu'} = $hostsStruc[0]->{'cpu'};
} else {
$facilityStruc->{'machines'} = \@hostsStruc;
}
}
}

for my $key (sort keys %$physicalMachinesStruc) {
Expand Down
42 changes: 3 additions & 39 deletions gen/perunServicesInit.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -149,41 +141,13 @@ 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);
logData $data, 'hashedDataWithGroups';
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;
Expand Down
33 changes: 1 addition & 32 deletions gen/perunServicesUtils.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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.

Expand Down
26 changes: 26 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
2 changes: 1 addition & 1 deletion send/bbmri_collections
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down

0 comments on commit bd74cd7

Please sign in to comment.