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

[BUG] error thrown for incomplete profile but does not indicate which attribute is missing a value #17

Open
1 of 6 tasks
DaveLafleur opened this issue Sep 27, 2022 · 3 comments
Labels
bug Something isn't working

Comments

@DaveLafleur
Copy link

DaveLafleur commented Sep 27, 2022

Description
salt-cloud -m errors out based on an incomplete profile but does not indicate which attribute is missing a value.

Setup

/etc/salt/cloud.providers.d/azure.conf /etc/salt/cloud.providers.d/azure.conf
azure-config:
  driver: azurerm
  subscription_id: <subscription>
  certificate_path: /etc/salt/azure.pem
  tenant: <tenant>
  client_id: <client>
  secret: <secret>
  location: southcentralus

/etc/salt/cloud.profiles.d/azure.conf /etc/salt/cloud.profiles.d/azure.conf
azure-ubuntu:
  provider: tt-azure-config
  image: 'canonical|0001-com-ubuntu-server-focal|20_04-lts-gen2|latest'
  size: Standard_D2s_v3
  location: 'southcentralus'
  ssh_username: azureuser
  ssh_publickeyfile: /etc/salt/saltkey.pub
  virtual_network_name: EnterpriseMgmt-vnet
  subnet_name: default
  slot: production
  resource_group_name: EnterpriseMgmt

Please be as specific as possible and give set-up details.

  • on-prem machine
  • VM (Virtualbox, KVM, etc. please specify)
  • VM running on a cloud service, please be explicit and add details (azure ubuntu)
  • container (Kubernetes, Docker, containerd, etc. please specify)
  • or a combination, please be explicit
  • jails if it is FreeBSD

Steps to Reproduce the behavior
(Include debug logs if possible and relevant)

Expected behavior
Either print minimum profile template or print the attribute that is missing the value

Screenshots
If applicable, add screenshots to help explain your problem.

Versions Report

salt --versions-report (Provided by running salt --versions-report. Please also mention any differences in master/minion versions.)
Salt Version:
            Salt: 3004.2

Dependency Versions:
            cffi: Not Installed
        cherrypy: Not Installed
        dateutil: 2.7.3
       docker-py: Not Installed
           gitdb: 2.0.6
       gitpython: 3.0.7
          Jinja2: 2.10.1
         libgit2: Not Installed
        M2Crypto: Not Installed
            Mako: Not Installed
         msgpack: 0.6.2
    msgpack-pure: Not Installed
    mysql-python: Not Installed
       pycparser: Not Installed
        pycrypto: 2.6.1
    pycryptodome: 3.6.1
          pygit2: Not Installed
          Python: 3.8.10 (default, Jun 22 2022, 20:18:18)
    python-gnupg: 0.4.5
          PyYAML: 5.3.1
           PyZMQ: 18.1.1
           smmap: 2.0.5
         timelib: Not Installed
         Tornado: 4.5.3
             ZMQ: 4.3.2

Salt Extensions:
 saltext.azurerm: 1.0.0

System Versions:
            dist: ubuntu 20.04 focal
          locale: utf-8
         machine: x86_64
         release: 5.15.0-1020-azure
          system: Linux
         version: Ubuntu 20.04 focal```
</details>

**Additional context**
Add any other context about the problem here.
@DaveLafleur DaveLafleur added bug Something isn't working needs triage Requires initial triage by community members or maintainers labels Sep 27, 2022
@nicholasmhughes nicholasmhughes changed the title [BUG] [BUG] error thrown for incomplete profile but does not indicate which attribute is missing a value Sep 27, 2022
@nicholasmhughes
Copy link
Member

Please post the exact error received. Thank you!

@DaveLafleur
Copy link
Author

[ERROR ] There was a query error: No value for given attribute
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/salt/cloud/cli.py", line 319, in run
ret = mapper.run_map(dmap)
File "/usr/lib/python3/dist-packages/salt/cloud/init.py", line 2196, in run_map
output[name] = self.create(profile, local_master=local_master)
File "/usr/lib/python3/dist-packages/salt/cloud/init.py", line 1226, in create
output = self.cloudsfunc
File "/usr/lib/python3/dist-packages/salt/loader/lazy.py", line 149, in call
return self.loader.run(run_func, *args, **kwargs)
File "/usr/lib/python3/dist-packages/salt/loader/lazy.py", line 1201, in run
return self._last_context.run(self._run_as, func_or_method, *args, **kwargs)
File "/usr/lib/python3/dist-packages/salt/loader/lazy.py", line 1216, in run_as
return func_or_method(*args, **kwargs)
File "/usr/local/lib/python3.8/dist-packages/saltext/azurerm/clouds/azurerm.py", line 1271, in create
vm_request = request_instance(vm
=vm
)
File "/usr/local/lib/python3.8/dist-packages/saltext/azurerm/clouds/azurerm.py", line 895, in request_instance
iface_data, public_ips, private_ips = create_network_interface(call="action", kwargs=vm
)
File "/usr/local/lib/python3.8/dist-packages/saltext/azurerm/clouds/azurerm.py", line 711, in create_network_interface
subnet_obj = netconn.subnets.get(
File "/usr/local/lib/python3.8/dist-packages/azure/core/tracing/decorator.py", line 78, in wrapper_use_tracer
return func(*args, **kwargs)
File "/usr/local/lib/python3.8/dist-packages/azure/mgmt/network/v2021_08_01/operations/_operations.py", line 57344, in get
request = build_subnets_get_request(
File "/usr/local/lib/python3.8/dist-packages/azure/mgmt/network/v2021_08_01/operations/_operations.py", line 14408, in build_subnets_get_request
"resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'),
File "/usr/local/lib/python3.8/dist-packages/msrest/serialization.py", line 652, in url
output = self.serialize_data(data, data_type, **kwargs)
File "/usr/local/lib/python3.8/dist-packages/msrest/serialization.py", line 760, in serialize_data
raise ValueError("No value for given attribute")
ValueError: No value for given attribute

@nicholasmhughes
Copy link
Member

Yeah, it doesn't look like there's any parameter verification in that section. We'll leave this open so we can build in that error reporting.

In the meantime, the following parameters in your profile need to be changed:

virtual_network_name > network
subnet_name > subnet
resource_group_name > resource_group (or network_resource_group if in a different rg than the rest of your resources)

They don't track the SDK names for the parameters... so that might be another thing we want to standardize.

@nicholasmhughes nicholasmhughes removed the needs triage Requires initial triage by community members or maintainers label Sep 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants