Open fake-name opened 3 years ago
Instrumenting loader_context()
:
Loader name: __utils__
loader.pack {'__utils__': <salt.loader.LazyLoader object at 0x7f0e03077790>, '__active_provider_name__': {}, '__grains__': {}, '__pillar__': {}, '__context__': {}}
salt.utils.event.MainThread - DEBUG - MasterEvent PUB socket URI: /var/run/salt/master/master_event_pub.ipc
salt.utils.event.MainThread - DEBUG - MasterEvent PULL socket URI: /var/run/salt/master/master_event_pull.ipc
salt.utils.event.MainThread - DEBUG - Sending event: tag = salt/cloud/test-1/creating; data = {'name': 'test-1', 'provider': 'vultr:vultr', 'profile': None, 'driver': 'vultr:vultr', 'event': 'starting create', '_stamp': '2021-07-19T07:21:10.760720'}
salt.transport.ipc.MainThread - DEBUG - Closing IPCMessageClient instance
Loader name: __utils__
loader.pack {'__utils__': <salt.loader.LazyLoader object at 0x7f0e03077790>, '__active_provider_name__': {}, '__grains__': {}, '__pillar__': {}, '__context__': {}}
salt.utils.lazy.MainThread - DEBUG - LazyLoaded http.query
salt.loaded.int.utils.http.MainThread - DEBUG - Requesting URL https://api.vultr.com/v1/regions/list?api_key=XXXXXXXXXX using GET method
salt.loaded.int.utils.http.MainThread - DEBUG - Using backend: tornado
salt.loaded.int.utils.http.MainThread - DEBUG - Response Status Code: 200
Loader name: __utils__
loader.pack {'__utils__': <salt.loader.LazyLoader object at 0x7f0e03077790>, '__active_provider_name__': {}, '__grains__': {}, '__pillar__': {}, '__context__': {}}
salt.loaded.int.utils.http.MainThread - DEBUG - Requesting URL https://api.vultr.com/v1/os/list?api_key=XXXXXXXXXX using GET method
salt.loaded.int.utils.http.MainThread - DEBUG - Using backend: tornado
salt.loaded.int.utils.http.MainThread - DEBUG - Response Status Code: 200
Loader name: __utils__
loader.pack {'__utils__': <salt.loader.LazyLoader object at 0x7f0e03077790>, '__active_provider_name__': {}, '__grains__': {}, '__pillar__': {}, '__context__': {}}
salt.loaded.int.utils.http.MainThread - DEBUG - Requesting URL https://api.vultr.com/v1/plans/list?api_key=XXXXXXXXXX using GET method
salt.loaded.int.utils.http.MainThread - DEBUG - Using backend: tornado
salt.loaded.int.utils.http.MainThread - DEBUG - Response Status Code: 200
salt.loaded.int.clouds.vultrpy.MainThread - INFO - Creating Cloud VM test-1
Loader name: __utils__
loader.pack {'__utils__': <salt.loader.LazyLoader object at 0x7f0e03077790>, '__active_provider_name__': {}, '__grains__': {}, '__pillar__': {}, '__context__': {}}
Loader name: __utils__
loader.pack {'__utils__': <salt.loader.LazyLoader object at 0x7f0e03077790>, '__active_provider_name__': {}, '__grains__': {}, '__pillar__': {}, '__context__': {}}
salt.utils.event.MainThread - DEBUG - MasterEvent PUB socket URI: /var/run/salt/master/master_event_pub.ipc
salt.utils.event.MainThread - DEBUG - MasterEvent PULL socket URI: /var/run/salt/master/master_event_pull.ipc
salt.utils.event.MainThread - DEBUG - Sending event: tag = salt/cloud/test-1/requesting; data = {'kwargs': {'DCID': '2', 'hostname': 'test-1', 'OSID': 270, 'VPSPLANID': '201', 'enable_private_network': 'no', 'label': 'test-1'}, 'event': 'requesting instance', '_stamp': '2021-07-19T07:21:11.772218'}
salt.transport.ipc.MainThread - DEBUG - Closing IPCMessageClient instance
Loader name: __utils__
loader.pack {'__utils__': <salt.loader.LazyLoader object at 0x7f0e03077790>, '__active_provider_name__': {}, '__grains__': {}, '__pillar__': {}, '__context__': {}}
salt.loaded.int.utils.http.MainThread - DEBUG - Requesting URL https://api.vultr.com/v1/server/create?api_key=XXXXXXXXXX using POST method
salt.loaded.int.utils.http.MainThread - DEBUG - Using backend: tornado
salt.loaded.int.utils.http.MainThread - DEBUG - Response Status Code: 200
Loader name: __utils__
loader.pack {'__utils__': <salt.loader.LazyLoader object at 0x7f0e03077790>, '__active_provider_name__': {}, '__grains__': {}, '__pillar__': {}, '__context__': {}}
salt.loaded.int.utils.cloud.MainThread - DEBUG - Attempting function <function create.<locals>.wait_for_hostname at 0x7f0e02f4b940>
Loader name: __utils__
loader.pack {'__context__': {}, '__proxy__': <function proxy at 0x7f0e04405670>, '__grains__': {}, '__pillar__': {}}
salt.loaded.int.utils.cloud.MainThread - DEBUG - Caught exception in wait_for_fun: '__utils__'
salt.loaded.int.utils.cloud.MainThread - DEBUG - Traceback (most recent call last):
salt.loaded.int.utils.cloud.MainThread - DEBUG - File "/usr/lib/python3/dist-packages/salt/utils/cloud.py", line 682, in wait_for_fun
salt.loaded.int.utils.cloud.MainThread - DEBUG - response = fun(**kwargs)
salt.loaded.int.utils.cloud.MainThread - DEBUG - File "/usr/lib/python3/dist-packages/salt/cloud/clouds/vultrpy.py", line 497, in wait_for_hostname
salt.loaded.int.utils.cloud.MainThread - DEBUG - data = show_instance(vm_["name"], call="action")
salt.loaded.int.utils.cloud.MainThread - DEBUG - File "/usr/lib/python3/dist-packages/salt/cloud/clouds/vultrpy.py", line 315, in show_instance
salt.loaded.int.utils.cloud.MainThread - DEBUG - nodes = list_nodes_full()
salt.loaded.int.utils.cloud.MainThread - DEBUG - File "/usr/lib/python3/dist-packages/salt/cloud/clouds/vultrpy.py", line 246, in list_nodes_full
salt.loaded.int.utils.cloud.MainThread - DEBUG - nodes = _query("server/list")
salt.loaded.int.utils.cloud.MainThread - DEBUG - File "/usr/lib/python3/dist-packages/salt/cloud/clouds/vultrpy.py", line 618, in _query
salt.loaded.int.utils.cloud.MainThread - DEBUG - result = __utils__["http.query"](
salt.loaded.int.utils.cloud.MainThread - DEBUG - File "/usr/lib/python3/dist-packages/salt/loader_context.py", line 81, in __getitem__
salt.loaded.int.utils.cloud.MainThread - DEBUG - return self.value()[item]
salt.loaded.int.utils.cloud.MainThread - DEBUG - File "/usr/lib/python3/dist-packages/salt/loader_context.py", line 75, in value
salt.loaded.int.utils.cloud.MainThread - DEBUG - return loader.pack[self.name]
salt.loaded.int.utils.cloud.MainThread - DEBUG - KeyError: '__utils__'
salt.loaded.int.utils.cloud.MainThread - DEBUG -
salt.loaded.int.utils.cloud.MainThread - DEBUG - Retrying function <function create.<locals>.wait_for_hostname at 0x7f0e02f4b940> on (try 1)
Loader name: __utils__
loader.pack {'__context__': {}, '__proxy__': <function proxy at 0x7f0e04405670>, '__grains__': {}, '__pillar__': {}}
salt.loaded.int.utils.cloud.MainThread - DEBUG - Caught exception in wait_for_fun: '__utils__'
salt.loaded.int.utils.cloud.MainThread - DEBUG - Traceback (most recent call last):
salt.loaded.int.utils.cloud.MainThread - DEBUG - File "/usr/lib/python3/dist-packages/salt/utils/cloud.py", line 682, in wait_for_fun
salt.loaded.int.utils.cloud.MainThread - DEBUG - response = fun(**kwargs)
salt.loaded.int.utils.cloud.MainThread - DEBUG - File "/usr/lib/python3/dist-packages/salt/cloud/clouds/vultrpy.py", line 497, in wait_for_hostname
salt.loaded.int.utils.cloud.MainThread - DEBUG - data = show_instance(vm_["name"], call="action")
salt.loaded.int.utils.cloud.MainThread - DEBUG - File "/usr/lib/python3/dist-packages/salt/cloud/clouds/vultrpy.py", line 315, in show_instance
salt.loaded.int.utils.cloud.MainThread - DEBUG - nodes = list_nodes_full()
salt.loaded.int.utils.cloud.MainThread - DEBUG - File "/usr/lib/python3/dist-packages/salt/cloud/clouds/vultrpy.py", line 246, in list_nodes_full
salt.loaded.int.utils.cloud.MainThread - DEBUG - nodes = _query("server/list")
salt.loaded.int.utils.cloud.MainThread - DEBUG - File "/usr/lib/python3/dist-packages/salt/cloud/clouds/vultrpy.py", line 618, in _query
salt.loaded.int.utils.cloud.MainThread - DEBUG - result = __utils__["http.query"](
salt.loaded.int.utils.cloud.MainThread - DEBUG - File "/usr/lib/python3/dist-packages/salt/loader_context.py", line 81, in __getitem__
salt.loaded.int.utils.cloud.MainThread - DEBUG - return self.value()[item]
salt.loaded.int.utils.cloud.MainThread - DEBUG - File "/usr/lib/python3/dist-packages/salt/loader_context.py", line 75, in value
salt.loaded.int.utils.cloud.MainThread - DEBUG - return loader.pack[self.name]
salt.loaded.int.utils.cloud.MainThread - DEBUG - KeyError: '__utils__'
salt.loaded.int.utils.cloud.MainThread - DEBUG -
salt.loaded.int.utils.cloud.MainThread - DEBUG - Retrying function <function create.<locals>.wait_for_hostname at 0x7f0e02f4b940> on (try 2)
Loader name: __utils__
loader.pack {'__context__': {}, '__proxy__': <function proxy at 0x7f0e04405670>, '__grains__': {}, '__pillar__': {}}
salt.loaded.int.utils.cloud.MainThread - DEBUG - Caught exception in wait_for_fun: '__utils__'
salt.loaded.int.utils.cloud.MainThread - DEBUG - Traceback (most recent call last):
salt.loaded.int.utils.cloud.MainThread - DEBUG - File "/usr/lib/python3/dist-packages/salt/utils/cloud.py", line 682, in wait_for_fun
salt.loaded.int.utils.cloud.MainThread - DEBUG - response = fun(**kwargs)
salt.loaded.int.utils.cloud.MainThread - DEBUG - File "/usr/lib/python3/dist-packages/salt/cloud/clouds/vultrpy.py", line 497, in wait_for_hostname
salt.loaded.int.utils.cloud.MainThread - DEBUG - data = show_instance(vm_["name"], call="action")
salt.loaded.int.utils.cloud.MainThread - DEBUG - File "/usr/lib/python3/dist-packages/salt/cloud/clouds/vultrpy.py", line 315, in show_instance
salt.loaded.int.utils.cloud.MainThread - DEBUG - nodes = list_nodes_full()
salt.loaded.int.utils.cloud.MainThread - DEBUG - File "/usr/lib/python3/dist-packages/salt/cloud/clouds/vultrpy.py", line 246, in list_nodes_full
salt.loaded.int.utils.cloud.MainThread - DEBUG - nodes = _query("server/list")
salt.loaded.int.utils.cloud.MainThread - DEBUG - File "/usr/lib/python3/dist-packages/salt/cloud/clouds/vultrpy.py", line 618, in _query
salt.loaded.int.utils.cloud.MainThread - DEBUG - result = __utils__["http.query"](
salt.loaded.int.utils.cloud.MainThread - DEBUG - File "/usr/lib/python3/dist-packages/salt/loader_context.py", line 81, in __getitem__
salt.loaded.int.utils.cloud.MainThread - DEBUG - return self.value()[item]
salt.loaded.int.utils.cloud.MainThread - DEBUG - File "/usr/lib/python3/dist-packages/salt/loader_context.py", line 75, in value
salt.loaded.int.utils.cloud.MainThread - DEBUG - return loader.pack[self.name]
salt.loaded.int.utils.cloud.MainThread - DEBUG - KeyError: '__utils__'
So somehow, __utils__
is missing from the relevant test function loader context.
Similarly, going through and making the imports that are pointed at by __utils__
explicit, it then explodes on a __opts__
access:
salt.loaded.int.utils.cloud.MainThread - DEBUG - Caught exception in wait_for_fun: name '__opts__' is not defined
salt.loaded.int.utils.cloud.MainThread - DEBUG - Traceback (most recent call last):
salt.loaded.int.utils.cloud.MainThread - DEBUG - File "/usr/lib/python3/dist-packages/salt/utils/cloud.py", line 682, in wait_for_fun
salt.loaded.int.utils.cloud.MainThread - DEBUG - response = fun(**kwargs)
salt.loaded.int.utils.cloud.MainThread - DEBUG - File "/usr/lib/python3/dist-packages/salt/cloud/clouds/vultrpy.py", line 503, in wait_for_hostname
salt.loaded.int.utils.cloud.MainThread - DEBUG - data = show_instance(vm_["name"], call="action")
salt.loaded.int.utils.cloud.MainThread - DEBUG - File "/usr/lib/python3/dist-packages/salt/cloud/clouds/vultrpy.py", line 325, in show_instance
salt.loaded.int.utils.cloud.MainThread - DEBUG - salt.utils.cloud.cache_node(nodes[name], _get_active_provider_name(), __opts__)
salt.loaded.int.utils.cloud.MainThread - DEBUG - File "/usr/lib/python3/dist-packages/salt/utils/cloud.py", line 3073, in cache_node
salt.loaded.int.utils.cloud.MainThread - DEBUG - __opts__.update(opts)
salt.loaded.int.utils.cloud.MainThread - DEBUG - NameError: name '__opts__' is not defined
salt.loaded.int.utils.cloud.MainThread - DEBUG -
salt.loaded.int.utils.cloud.MainThread - DEBUG - Retrying function <function create.<locals>.wait_for_hostname at 0x7fccc7fbbc10> on (try 5)
So all I can conclude is that something in some of the magic import stuff got changed, and no one tests the Vultr integrations at all.
Possibly related to https://github.com/saltstack/salt/issues/58934 ? I don't think this is related.
I encounter the similar issue. One interesting observation is that the server instance is created on the Vultr side and I can log on to that server instance using root password created by Vultr.
$ salt --versions-report Salt Version: Salt: 3003.2
Can confirm this is hitting us as well. And agree with the diagnosis that it doesn't seem to be an API issue.
wait_for_hostname ends up calling list_nodes_full last, which is also called by calling "salt-cloud -F", and that seems to work fine, and from what I can see it's the last API call made.
Description A clear and concise description of what the bug is.
Setup https://github.com/fake-name/AutoTriever/blob/master/marshaller/salt_runner.py
Steps to Reproduce the behavior Attempt to deploy a Vultr VM. Deploy fails.
Expected behavior I expect to actually create the VM.
Screenshots
Note that the above is with a patched
wait_for_fun()
implementation to actually output a useful traceback:I'm particulary confused by this exception, since
vultrpy._query()
is called successfully earlier in the deploy process. I suspect that something in the capture ofwait_for_hostname()
inwait_for_server_state()
is breaking the reference to util somehow.Versions Report
This is basically the current version from
https://repo.saltproject.io/py3/ubuntu/20.04/amd64/latest