Skip to content

Retrieval of Reflective Information #99

@FelixMoelders

Description

@FelixMoelders

Description

It would be nice to have a feature, to find out the name, read write access, i.e. reflective information on the workload that the python sdk is called from.

As requested by FelixMoelders/ankaios-dashboard#36 it is necessary to find out whether the calling sdk has write access.

Currently I retrieve the information with an anti-pattern:

def get_write_access(self):        
    write_access = {"writeAccess": True}

    try:
        workload = Workload.builder().workload_name("access_test").agent_name("access_test_agent").runtime("podman").runtime_config("").restart_policy("NEVER").build()
        self.ankaios.apply_workload(workload)
        self.ankaios.delete_workload("access_test")
    except AnkaiosException as e:
        print("Ankaios exception: ", e)
        if "Access denied" in str(e):
            write_access = {"writeAccess": False}
    
    return write_access

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions