Skip to content

Commit

Permalink
Merge branch 'main' into 62-writeupdate-documentation
Browse files Browse the repository at this point in the history
Signed-off-by: anjastrunk <119566837+anjastrunk@users.noreply.github.com>
  • Loading branch information
anjastrunk authored Aug 29, 2024
2 parents 216a4cb + 1c896a1 commit d24e634
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 12 deletions.
2 changes: 1 addition & 1 deletion config/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Credentials:
# URL did resolver web service
did_resolver: https://uniresolver.io/1.0/identifiers

CPS:
CSP:
did: did:web:example.com
legal-name: Example Corp
# allowed values are country codes according to ISO 3166-2 alpha2, alpha-3 or numeric format.
Expand Down
4 changes: 2 additions & 2 deletions generator/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def openstack(cloud, timeout, config, out_dir, auto_sign):

@click.command()
def kubernetes():
"""Generates Gaia-X Credentials for CPS and kubernetes."""
"""Generates Gaia-X Credentials for CSP and Kubernetes."""
pass


Expand All @@ -122,7 +122,7 @@ def kubernetes():
default="config/config.yaml",
help="Path to Configuration file for SCS GX Credential Generator.")
def csp(config, out_dir, auto_sign):
"""Generate Gaia-X Credential for CPS."""
"""Generate Gaia-X Credential for CSP."""
# load config file
with open(config, "r") as config_file:
conf = Config(yaml.safe_load(config_file))
Expand Down
4 changes: 2 additions & 2 deletions generator/common/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
CONFIG_IAAS_DATA_EXPORT_FORMAT_TYPE = "format-type"
CONFIG_IAAS_SERVICE_POLICY = "service-policy"

# CPS configuration keys
CONFIG_CSP = "CPS"
# CSP configuration keys
CONFIG_CSP = "CSP"
CONFIG_CSP_NAME = "legal-name"
CONFIG_CSP_LEG_AD = "legal-address-country-code"
CONFIG_CSP_HQ_ADR = "headquarter-address-country-code"
Expand Down
2 changes: 1 addition & 1 deletion generator/common/credentials.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from generator.common import const


def convert_to_vp(creds: List[dict]) -> str:
def convert_to_vp(creds: List[dict]) -> dict:
return {
'@context': const.VP_CONTEXT,
'type': "VerifiablePresentation",
Expand Down
10 changes: 7 additions & 3 deletions generator/discovery/openstack/vm_images_discovery.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
DiskBusType, FirmType, HypervisorType,
LatestN, MaintenanceSubscription,
Memory, MemorySize, OperatingSystem,
RNGTypes, Signature,
OSDistribution, RNGTypes, Signature,
SignatureAlgorithm, UpdateFrequency,
UpdateStrategy, Validity1, Validity2,
VMDiskType)
Expand Down Expand Up @@ -290,8 +290,12 @@ def _get_min_disk_req(os_image: OS_Image) -> Disk:
def _get_operation_system(self, os_image: OS_Image) -> OperatingSystem:
# Copyright owner and license not supported as Image properties, currently --> Default values from config are used
if os_image.os_distro is None:
return None

return OperatingSystem(
version=os_image.os_version,
osDistribution=OSDistribution.others,
resourcePolicy=const.DEFAULT_RESOURCE_POLICY,
copyrightOwnedBy="TBA",
license="https://www.example.com/tba")
if os_image.os_distro.lower() == "arch":
return OperatingSystem(
version=os_image.os_version,
Expand Down
18 changes: 15 additions & 3 deletions tests/test_vm_image_discovery.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@
from generator.common.gx_schema import (CPU, CheckSum, ChecksumAlgorithm, Disk,
FirmType, HypervisorType, LatestN,
MaintenanceSubscription, Memory,
MemorySize, OperatingSystem, RNGTypes,
Signature, UpdateStrategy, VMDiskType)
MemorySize, OperatingSystem,
OSDistribution, RNGTypes, Signature,
UpdateStrategy, VMDiskType)
from generator.common.gx_schema import VMImage as GX_Image
from generator.common.gx_schema import WatchDogActions
from generator.common.json_ld import JsonLdObject
Expand Down Expand Up @@ -871,7 +872,18 @@ def test_get_operating_system(self):
OS_Image(os_version="1", os_distro="windows")
),
)
self.assertIsNone(self.discovery._get_operation_system(OS_Image()))
self.assertEqual(
OperatingSystem(
version="1",
osDistribution=OSDistribution.others,
resourcePolicy=const.DEFAULT_RESOURCE_POLICY,
copyrightOwnedBy="TBA",
license=["https://www.example.com/tba"]
),
self.discovery._get_operation_system(
OS_Image(os_version="1")
),
)


if __name__ == "__main__":
Expand Down

0 comments on commit d24e634

Please sign in to comment.