Closed KnutssonDevelopment closed 1 year ago
To anyone facing this problem. I do not know why I have it, but as possible workaround until a solution can be made available, you can edit the file and alter line 61
from:
config["esxi_datastore_disk_names"] = [extent.diskName for datastore in host.datastore for extent in datastore.info.vmfs.extent]
to:
try:
config["esxi_datastore_disk_names"] = [extent.diskName for datastore in host.datastore for extent in datastore.info.vmfs.extent]
except AttributeError:
config["esxi_datastore_disk_names"] = ['']
Be sure to have the correct indentation.
That solution gave me another error regarding the "tags.append(tag.name)" line, which I changed to:
for tag in vm.tag: try: tags.append(tag.name) except AttributeError as e: print(e)
That very well could be the case. Are you looking to contribute to the project or simply consume the extension?
If you're not worried about contributing then no worries about this problem. If you are looking to contribute, we do want to go ahead and make some updates here to actually deprecate using the test value scraper.
Apologies for the late reply - I had actually went ahead and created an issue to track those efforts but I didn't quite get it submitted or my reply here sent :sweat_smile:
I mostly do my own projects, and I am not really used to working with others, so I am not that familiar with how to actually do that in an efficient way in git. Maybe it could be a great learning experience for me though.
The proposed workaround is not really a production ready fix. I would then suggest another approach where we actually get the correct value from the NFS datastore which is easily possible, and also troubleshoot why the tags are not processed as they should be.
I am just learning myself saltstack at the moment, so I am not very experienced with the structure of the modules.
What is the purpose of the test_value_scraper.py script?
Well, welcome :)
I documented it a little in #338 - basically it only exists to help populate test data.
The correct fix would be for our tests to build out the expected setup in our test fixtures.
Thank you for your reply.
Hi, please be kind, I am very new to saltstack. I do know some python though.
When running the command: "python tools/test_value_scraper.py -c local/vcenter.conf" I get the following error:
Traceback (most recent call last): File "/opt/salt-ext-modules-vmware/tools/test_value_scraper.py", line 138, in
do_it(config_file=config_file)
File "/opt/salt-ext-modules-vmware/tools/test_value_scraper.py", line 60, in do_it
config["esxi_datastore_disk_names"] = [
File "/opt/salt-ext-modules-vmware/tools/test_value_scraper.py", line 61, in
extent.diskName for datastore in host.datastore for extent in datastore.info.vmfs.extent
AttributeError: 'vim.host.NasDatastoreInfo' object has no attribute 'vmfs'
[ERROR ] An un-handled exception was caught by Salt's global exception handler:
AttributeError: 'vim.host.NasDatastoreInfo' object has no attribute 'vmfs'
Traceback (most recent call last):
File "/opt/salt-ext-modules-vmware/tools/test_value_scraper.py", line 138, in
do_it(config_file=config_file)
File "/opt/salt-ext-modules-vmware/tools/test_value_scraper.py", line 60, in do_it
config["esxi_datastore_disk_names"] = [
File "/opt/salt-ext-modules-vmware/tools/test_value_scraper.py", line 61, in
extent.diskName for datastore in host.datastore for extent in datastore.info.vmfs.extent
AttributeError: 'vim.host.NasDatastoreInfo' object has no attribute 'vmfs'
I expect it is because I am using NFS datastores, but what else could I be doing wrong, since it is not working?
pip freeze: alabaster==0.7.12 argcomplete==2.0.0 attrs==22.2.0 Babel==2.11.0 beautifulsoup4==4.11.1 certifi==2022.12.7 charset-normalizer==2.1.1 click==8.1.3 click-default-group==1.2.2 colorlog==6.7.0 contextvars==2.4 coverage==7.0.3 distlib==0.3.6 distro==1.8.0 docutils==0.19 exceptiongroup==1.1.0 filelock==3.9.0 furo==2022.12.7 idna==3.4 imagesize==1.4.1 immutables==0.19 incremental==22.10.0 iniconfig==1.1.1 Jinja2==3.1.0 jmespath==1.0.1 MarkupSafe==2.1.1 msgpack==1.0.4 nox==2022.11.21 packaging==22.0 platformdirs==2.6.2 pluggy==1.0.0 psutil==5.9.4 pycryptodomex==3.16.0 pyenchant==3.2.2 Pygments==2.14.0 pytest==7.2.0 pytest-cov==4.0.0 pytest-helpers-namespace==2021.12.29 pytest-salt-factories==0.912.2 pytest-skip-markers==1.4.0 pytest-tempdir==2019.10.12 pytz==2022.7 pyvmomi==7.0.3 PyYAML==6.0 pyzmq==20.0.0 requests==2.28.1 salt==3005.1 -e git+https://github.com/saltstack/salt-ext-modules-vmware.git@4ecb76355fd974c01af9f175791b301a7ed9a084#egg=saltext.vmware six==1.16.0 snowballstemmer==2.2.0 soupsieve==2.3.2.post1 Sphinx==6.1.0 sphinx-basic-ng==1.0.0b1 sphinx-prompt==1.5.0 sphinxcontrib-applehelp==1.0.2 sphinxcontrib-devhelp==1.0.2 sphinxcontrib-htmlhelp==2.0.0 sphinxcontrib-jsmath==1.0.1 sphinxcontrib-qthelp==1.0.3 sphinxcontrib-serializinghtml==1.1.5 sphinxcontrib-spelling==7.7.0 tomli==2.0.1 towncrier==21.9.0rc1 urllib3==1.26.13 virtualenv==20.17.1