Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error on removeMO(), when try to remove Tenant #132

Open
tumarha opened this issue Oct 16, 2017 · 1 comment
Open

Error on removeMO(), when try to remove Tenant #132

tumarha opened this issue Oct 16, 2017 · 1 comment

Comments

@tumarha
Copy link

tumarha commented Oct 16, 2017

I try to test add and remove Tenant by using Cobra, but it return

Traceback (most recent call last):
File "c:/Users/wisit.p.DCS/Documents/Python_temp/test002.py", line 48, in
cfgRequest.removeMo(fvTenantMo)
File "c:\python27\lib\site-packages\acicobra-3.0_1k-py2.7.egg\cobra\mit\request.py", line 823, in removeMo
del self.__configMos[mo.dn]
KeyError: <cobra.mit.naming.Dn object at 0x03B864D0>

here are my code

fvTenantMo = Tenant(uniMo, '4444')
cfgRequest = ConfigRequest()
cfgRequest.addMo(fvTenantMo)
moDir.commit(cfgRequest)
==>Add complete, I can see new tenant on APIC GUI

fvTenantMo = moDir.lookupByDn((r'uni/tn-4444'))
cfgRequest = ConfigRequest()
cfgRequest.removeMo(fvTenantMo)
moDir.commit(cfgRequest)
==> I found error as above message

Please help to give me some advice.

Best regards
Tumarha

@jvc9109
Copy link

jvc9109 commented Dec 7, 2017

try this:

fvTenantMo = moDir.lookupByDn((r'uni/tn-4444'))
fvTenantMo.delete()
cfgRequest = ConfigRequest()
cfgRequest.addMo(fvTenantMo)
moDir.commit(cfgRequest)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants