pyvcloud icon indicating copy to clipboard operation
pyvcloud copied to clipboard

metadata support for vcloud organization

Open bigvlc opened this issue 7 years ago • 7 comments

To help us process your pull request efficiently, please include:

  • Ability to inject metadata for Organization

  • I was referencing to VCD metadata set/get/remove and tested based on real vcloud environment but sadly I am not good enough to write test for it now. I believe it can boost process of this functionality be available in core library.


This change is Reviewable

bigvlc avatar Mar 01 '19 23:03 bigvlc

@chitashvili you can run tox -e flake8 in your local development environment to check the lint issues before you push the code to remote.

If you can rebase and stash the additional commit it would be nice so that changes are merged to master as single commit.

Rebase interactively

git rebase -i master

Change the commits to squash Update the commit message Push to origin branch forcefully

cdivitotawela avatar Mar 02 '19 05:03 cdivitotawela

Hello @cdivitotawela and thank you very much for information and guidance. Did I do all correct?

bigvlc avatar Mar 02 '19 07:03 bigvlc

Since I do not have automatic tests I wanted to add some functions with outputs what I was testing with vCloud Organization metadata

Add metadata to vCloud Organizations:

dict = {
  "key1": "value1",
  "key2": "value2",
  "key3": "value3"
}

def vcd_set_org_metadata(org_name, dict):
    client = vcd_connect()
    org_record = client.get_org_by_name(org_name)
    org = Org(client, href=org_record.get('href'))
    org.set_multiple_metadata(dict)
    client.logout()

Remove metadata to vCloud Organizations:

def vcd_remove_org_metadata(org_name, key):
    client = vcd_connect()
    org_record = client.get_org_by_name(org_name)
    org = Org(client, href=org_record.get('href'))
    org.remove_metadata(key)
    client.logout()

Fetchs list of metadata from vCloud Organizations:

def vcd_get_org_metadata(org_name):
    client = vcd_connect()
    org_record = client.get_org_by_name(org_name)
    org = Org(client, href=org_record.get('href'))
    meta = metadata_to_dict(org.get_all_metadata())
    client.logout()
    return meta

Output:

{"Demo": {"metas": {"key1": "value1", "key2": "value2"}}}

bigvlc avatar Mar 04 '19 08:03 bigvlc

@chitashvili looks good now. Only one commit so when it is merged it will have one commit on the master.

cdivitotawela avatar Mar 04 '19 22:03 cdivitotawela

Hello,

Can I get some guidance how we can this PR get merged, if it is something needed to be done for that?

Thank you

bigvlc avatar Apr 03 '19 08:04 bigvlc

Hello @pandeys and thank you for information. I will try to do it asap.

bigvlc avatar Apr 17 '19 08:04 bigvlc

Does anyone have spare cycles to get this PR completed? The ability to pull metadata at this level would be very helpful.

jlarmstrong avatar Mar 11 '21 14:03 jlarmstrong