HewlettPackard / oneview-python

Python library for HPE OneView
https://github.com/HewlettPackard/oneview-python/wiki
Apache License 2.0
28 stars 27 forks source link

server_profile_template.get_alll #126

Closed zeshan1977 closed 3 years ago

zeshan1977 commented 3 years ago

Get Server Profile Template by scope_uris

if oneview_client.api_version >= 600: server_profile_templates_by_scope_uris = profile_templates.get_all( scope_uris="\"'/rest/scopes/3bb0c754-fd38-45af-be8a-4d4419de06e9'\"") #<--HardCoded

I am trying to create list of existing scopes and then cycle thru them .I can't get that to work, becauase of all the escapes/backslahes/quotation marks???

Here is what I m trying to do: list=['/rest/scopes/d78fa36d-228a-45f9-a7e7-eeb4ace8984','/rest/scopes/43eea8a3-b050-4ee4-a95b-f3952f391fe5',' /rest/scopes/114f5444-6f84-4263-b2b8-5f0dbc39d8d9']

for item in list: spt_scope=profile_template.get_all('scope_uris='+item) #<<< This causes errors, WHAT IS THE CORRECT WAY, pprint(spt_scope)

If there is documenttion page on this python function (get_all), please forward that too me. looking for swagger generated doc

VenkateshRavula commented 3 years ago

@zeshan1977 , You don't need to provide single quotes for scope_uris key. Please try the below code and close the issue if that works.

for item in scope_list:
    spt_scopes=profile_template.get_all(scope_uris=item)
    pprint(spt_scope)
zeshan1977 commented 3 years ago

ok I will test

zeshan1977 commented 3 years ago

Works ! . Thanx