From 0f5b506ec0e4649adbeb5b1c314a2edf6ac0c84b Mon Sep 17 00:00:00 2001 From: John Kristensen Date: Fri, 22 Jul 2016 13:15:32 +1000 Subject: [PATCH 1/2] Pass 'sock_dir' for all 'salt.utils.cloud.fire_event()' calls (#34806) If no 'sock_dir' value is passed into the 'fire_event()' function it would default to a value that ignores the 'base_dir' value set in the master config file. We need to explicitly pass the 'sock_dir' value when calling 'fire_event()' so that the correct directory is used. --- salt/cloud/clouds/aliyun.py | 15 ++-- salt/cloud/clouds/azurearm.py | 6 +- salt/cloud/clouds/digital_ocean.py | 15 ++-- salt/cloud/clouds/dimensiondata.py | 12 ++- salt/cloud/clouds/ec2.py | 34 +++++--- salt/cloud/clouds/gce.py | 126 +++++++++++++++++++---------- salt/cloud/clouds/gogrid.py | 15 ++-- salt/cloud/clouds/joyent.py | 16 ++-- salt/cloud/clouds/linode.py | 15 ++-- salt/cloud/clouds/lxc.py | 20 +++-- salt/cloud/clouds/msazure.py | 12 ++- salt/cloud/clouds/nova.py | 23 ++++-- salt/cloud/clouds/opennebula.py | 15 ++-- salt/cloud/clouds/openstack.py | 19 +++-- salt/cloud/clouds/parallels.py | 15 ++-- salt/cloud/clouds/profitbricks.py | 12 ++- salt/cloud/clouds/proxmox.py | 15 ++-- salt/cloud/clouds/qingcloud.py | 15 ++-- salt/cloud/clouds/rackspace.py | 17 ++-- salt/cloud/clouds/scaleway.py | 15 ++-- salt/cloud/clouds/softlayer.py | 15 ++-- salt/cloud/clouds/softlayer_hw.py | 15 ++-- salt/cloud/clouds/virtualbox.py | 15 ++-- salt/cloud/clouds/vmware.py | 15 ++-- salt/cloud/clouds/vsphere.py | 18 +++-- salt/cloud/clouds/vultrpy.py | 15 ++-- salt/cloud/libcloudfuncs.py | 9 ++- salt/utils/cloud.py | 30 +++++-- 28 files changed, 383 insertions(+), 181 deletions(-) diff --git a/salt/cloud/clouds/aliyun.py b/salt/cloud/clouds/aliyun.py index 41548ce6a2..770a05d1a2 100644 --- a/salt/cloud/clouds/aliyun.py +++ b/salt/cloud/clouds/aliyun.py @@ -598,11 +598,12 @@ def create(vm_): 'event', 'starting create', 'salt/cloud/{0}/creating'.format(vm_['name']), - { + args={ 'name': vm_['name'], 'profile': vm_['profile'], 'provider': vm_['driver'], }, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) @@ -619,7 +620,8 @@ def create(vm_): 'event', 'requesting instance', 'salt/cloud/{0}/requesting'.format(vm_['name']), - {'kwargs': kwargs}, + args={'kwargs': kwargs}, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) @@ -683,11 +685,12 @@ def create(vm_): 'event', 'created instance', 'salt/cloud/{0}/created'.format(vm_['name']), - { + args={ 'name': vm_['name'], 'profile': vm_['profile'], 'provider': vm_['driver'], }, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) @@ -967,7 +970,8 @@ def destroy(name, call=None): 'event', 'destroying instance', 'salt/cloud/{0}/destroying'.format(name), - {'name': name}, + args={'name': name}, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) @@ -982,7 +986,8 @@ def destroy(name, call=None): 'event', 'destroyed instance', 'salt/cloud/{0}/destroyed'.format(name), - {'name': name}, + args={'name': name}, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) diff --git a/salt/cloud/clouds/azurearm.py b/salt/cloud/clouds/azurearm.py index 1fc3c8de93..a8d7d3372b 100644 --- a/salt/cloud/clouds/azurearm.py +++ b/salt/cloud/clouds/azurearm.py @@ -1052,11 +1052,12 @@ def create(vm_): 'event', 'starting create', 'salt/cloud/{0}/creating'.format(vm_['name']), - { + args={ 'name': vm_['name'], 'profile': vm_['profile'], 'provider': vm_['driver'], }, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) log.info('Creating Cloud VM {0}'.format(vm_['name'])) @@ -1129,11 +1130,12 @@ def create(vm_): 'event', 'created instance', 'salt/cloud/{0}/created'.format(vm_['name']), - { + args={ 'name': vm_['name'], 'profile': vm_['profile'], 'provider': vm_['driver'], }, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) diff --git a/salt/cloud/clouds/digital_ocean.py b/salt/cloud/clouds/digital_ocean.py index 08bc52e2e9..51855bb08b 100644 --- a/salt/cloud/clouds/digital_ocean.py +++ b/salt/cloud/clouds/digital_ocean.py @@ -289,11 +289,12 @@ def create(vm_): 'event', 'starting create', 'salt/cloud/{0}/creating'.format(vm_['name']), - { + args={ 'name': vm_['name'], 'profile': vm_['profile'], 'provider': vm_['driver'], }, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) @@ -404,7 +405,8 @@ def create(vm_): 'event', 'requesting instance', 'salt/cloud/{0}/requesting'.format(vm_['name']), - {'kwargs': kwargs}, + args={'kwargs': kwargs}, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) @@ -491,11 +493,12 @@ def create(vm_): 'event', 'created instance', 'salt/cloud/{0}/created'.format(vm_['name']), - { + args={ 'name': vm_['name'], 'profile': vm_['profile'], 'provider': vm_['driver'], }, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) @@ -767,7 +770,8 @@ def destroy(name, call=None): 'event', 'destroying instance', 'salt/cloud/{0}/destroying'.format(name), - {'name': name}, + args={'name': name}, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) @@ -805,7 +809,8 @@ def destroy(name, call=None): 'event', 'destroyed instance', 'salt/cloud/{0}/destroyed'.format(name), - {'name': name}, + args={'name': name}, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) diff --git a/salt/cloud/clouds/dimensiondata.py b/salt/cloud/clouds/dimensiondata.py index 6f606f72c4..3871de1260 100644 --- a/salt/cloud/clouds/dimensiondata.py +++ b/salt/cloud/clouds/dimensiondata.py @@ -154,11 +154,12 @@ def create(vm_): 'event', 'starting create', 'salt/cloud/{0}/creating'.format(vm_['name']), - { + args={ 'name': vm_['name'], 'profile': vm_['profile'], 'provider': vm_['driver'], }, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) @@ -315,11 +316,12 @@ def create(vm_): 'event', 'created instance', 'salt/cloud/{0}/created'.format(vm_['name']), - { + args={ 'name': vm_['name'], 'profile': vm_['profile'], 'provider': vm_['driver'], }, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) @@ -397,7 +399,8 @@ def create_lb(kwargs=None, call=None): 'event', 'create load_balancer', 'salt/cloud/loadbalancer/creating', - kwargs, + args=kwargs, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) @@ -409,7 +412,8 @@ def create_lb(kwargs=None, call=None): 'event', 'created load_balancer', 'salt/cloud/loadbalancer/created', - kwargs, + args=kwargs, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) return _expand_balancer(lb) diff --git a/salt/cloud/clouds/ec2.py b/salt/cloud/clouds/ec2.py index 60b6915882..e12ac9ce21 100644 --- a/salt/cloud/clouds/ec2.py +++ b/salt/cloud/clouds/ec2.py @@ -1908,7 +1908,8 @@ def request_instance(vm_=None, call=None): 'event', 'requesting instance', 'salt/cloud/{0}/requesting'.format(vm_['name']), - {'kwargs': params, 'location': location}, + args={'kwargs': params, 'location': location}, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) @@ -1987,6 +1988,7 @@ def request_instance(vm_=None, call=None): 'event', 'waiting for spot instance', 'salt/cloud/{0}/waiting_for_spot'.format(vm_['name']), + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) @@ -2050,7 +2052,8 @@ def query_instance(vm_=None, call=None): 'event', 'querying instance', 'salt/cloud/{0}/querying'.format(vm_['name']), - {'instance_id': instance_id}, + args={'instance_id': instance_id}, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) @@ -2156,7 +2159,8 @@ def query_instance(vm_=None, call=None): 'event', 'instance queried', 'salt/cloud/{0}/query_reactor'.format(vm_['name']), - {'data': data}, + args={'data': data}, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) @@ -2194,7 +2198,8 @@ def wait_for_instance( 'event', 'waiting for ssh', 'salt/cloud/{0}/waiting_for_ssh'.format(vm_['name']), - {'ip_address': ip_address}, + args={'ip_address': ip_address}, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) @@ -2373,7 +2378,8 @@ def wait_for_instance( 'event', 'ssh is available', 'salt/cloud/{0}/ssh_ready_reactor'.format(vm_['name']), - {'ip_address': ip_address}, + args={'ip_address': ip_address}, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) @@ -2445,11 +2451,12 @@ def create(vm_=None, call=None): 'event', 'starting create', 'salt/cloud/{0}/creating'.format(vm_['name']), - { + args={ 'name': vm_['name'], 'profile': vm_['profile'], 'provider': vm_['driver'], }, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) salt.utils.cloud.cachedir_index_add( @@ -2546,7 +2553,8 @@ def create(vm_=None, call=None): 'event', 'setting tags', 'salt/cloud/{0}/tagging'.format(vm_['name']), - {'tags': tags}, + args={'tags': tags}, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) @@ -2615,7 +2623,8 @@ def create(vm_=None, call=None): 'event', 'attaching volumes', 'salt/cloud/{0}/attaching_volumes'.format(vm_['name']), - {'volumes': volumes}, + args={'volumes': volumes}, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) @@ -2675,7 +2684,8 @@ def create(vm_=None, call=None): 'event', 'created instance', 'salt/cloud/{0}/created'.format(vm_['name']), - event_data, + args=event_data, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) @@ -3097,7 +3107,8 @@ def destroy(name, call=None): 'event', 'destroying instance', 'salt/cloud/{0}/destroying'.format(name), - {'name': name, 'instance_id': instance_id}, + args={'name': name, 'instance_id': instance_id}, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) @@ -3159,7 +3170,8 @@ def destroy(name, call=None): 'event', 'destroyed instance', 'salt/cloud/{0}/destroyed'.format(name), - {'name': name, 'instance_id': instance_id}, + args={'name': name, 'instance_id': instance_id}, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) diff --git a/salt/cloud/clouds/gce.py b/salt/cloud/clouds/gce.py index 9c9e731f64..7670ede606 100644 --- a/salt/cloud/clouds/gce.py +++ b/salt/cloud/clouds/gce.py @@ -555,10 +555,11 @@ def create_network(kwargs=None, call=None): 'event', 'create network', 'salt/cloud/net/creating', - { + args={ 'name': name, 'cidr': cidr, }, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) @@ -568,10 +569,11 @@ def create_network(kwargs=None, call=None): 'event', 'created network', 'salt/cloud/net/created', - { + args={ 'name': name, 'cidr': cidr, }, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) return _expand_item(network) @@ -605,9 +607,10 @@ def delete_network(kwargs=None, call=None): 'event', 'delete network', 'salt/cloud/net/deleting', - { + args={ 'name': name, }, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) @@ -628,9 +631,10 @@ def delete_network(kwargs=None, call=None): 'event', 'deleted network', 'salt/cloud/net/deleted', - { + args={ 'name': name, }, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) return result @@ -705,11 +709,12 @@ def create_fwrule(kwargs=None, call=None): 'event', 'create firewall', 'salt/cloud/firewall/creating', - { + args={ 'name': name, 'network': network_name, 'allow': kwargs['allow'], }, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) @@ -725,11 +730,12 @@ def create_fwrule(kwargs=None, call=None): 'event', 'created firewall', 'salt/cloud/firewall/created', - { + args={ 'name': name, 'network': network_name, 'allow': kwargs['allow'], }, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) return _expand_item(fwrule) @@ -763,9 +769,10 @@ def delete_fwrule(kwargs=None, call=None): 'event', 'delete firewall', 'salt/cloud/firewall/deleting', - { + args={ 'name': name, }, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) @@ -786,9 +793,10 @@ def delete_fwrule(kwargs=None, call=None): 'event', 'deleted firewall', 'salt/cloud/firewall/deleted', - { + args={ 'name': name, }, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) return result @@ -854,7 +862,7 @@ def create_hc(kwargs=None, call=None): 'event', 'create health_check', 'salt/cloud/healthcheck/creating', - { + args={ 'name': name, 'host': host, 'path': path, @@ -864,6 +872,7 @@ def create_hc(kwargs=None, call=None): 'unhealthy_threshold': unhealthy_threshold, 'healthy_threshold': healthy_threshold, }, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) @@ -877,7 +886,7 @@ def create_hc(kwargs=None, call=None): 'event', 'created health_check', 'salt/cloud/healthcheck/created', - { + args={ 'name': name, 'host': host, 'path': path, @@ -887,6 +896,7 @@ def create_hc(kwargs=None, call=None): 'unhealthy_threshold': unhealthy_threshold, 'healthy_threshold': healthy_threshold, }, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) return _expand_item(hc) @@ -920,9 +930,10 @@ def delete_hc(kwargs=None, call=None): 'event', 'delete health_check', 'salt/cloud/healthcheck/deleting', - { + args={ 'name': name, }, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) @@ -943,9 +954,10 @@ def delete_hc(kwargs=None, call=None): 'event', 'deleted health_check', 'salt/cloud/healthcheck/deleted', - { + args={ 'name': name, }, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) return result @@ -1011,7 +1023,8 @@ def create_address(kwargs=None, call=None): 'event', 'create address', 'salt/cloud/address/creating', - kwargs, + args=kwargs, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) @@ -1021,7 +1034,8 @@ def create_address(kwargs=None, call=None): 'event', 'created address', 'salt/cloud/address/created', - kwargs, + args=kwargs, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) @@ -1066,9 +1080,10 @@ def delete_address(kwargs=None, call=None): 'event', 'delete address', 'salt/cloud/address/deleting', - { + args={ 'name': name, }, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) @@ -1089,9 +1104,10 @@ def delete_address(kwargs=None, call=None): 'event', 'deleted address', 'salt/cloud/address/deleted', - { + args={ 'name': name, }, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) @@ -1191,7 +1207,8 @@ def create_lb(kwargs=None, call=None): 'event', 'create load_balancer', 'salt/cloud/loadbalancer/creating', - kwargs, + args=kwargs, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) @@ -1205,7 +1222,8 @@ def create_lb(kwargs=None, call=None): 'event', 'created load_balancer', 'salt/cloud/loadbalancer/created', - kwargs, + args=kwargs, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) return _expand_balancer(lb) @@ -1239,9 +1257,10 @@ def delete_lb(kwargs=None, call=None): 'event', 'delete load_balancer', 'salt/cloud/loadbalancer/deleting', - { + args={ 'name': name, }, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) @@ -1262,9 +1281,10 @@ def delete_lb(kwargs=None, call=None): 'event', 'deleted load_balancer', 'salt/cloud/loadbalancer/deleted', - { + args={ 'name': name, }, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) return result @@ -1330,7 +1350,8 @@ def attach_lb(kwargs=None, call=None): 'event', 'attach load_balancer', 'salt/cloud/loadbalancer/attaching', - kwargs, + args=kwargs, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) @@ -1340,7 +1361,8 @@ def attach_lb(kwargs=None, call=None): 'event', 'attached load_balancer', 'salt/cloud/loadbalancer/attached', - kwargs, + args=kwargs, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) return _expand_item(result) @@ -1395,7 +1417,8 @@ def detach_lb(kwargs=None, call=None): 'event', 'detach load_balancer', 'salt/cloud/loadbalancer/detaching', - kwargs, + args=kwargs, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) @@ -1405,7 +1428,8 @@ def detach_lb(kwargs=None, call=None): 'event', 'detached load_balancer', 'salt/cloud/loadbalancer/detached', - kwargs, + args=kwargs, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) return result @@ -1439,9 +1463,10 @@ def delete_snapshot(kwargs=None, call=None): 'event', 'delete snapshot', 'salt/cloud/snapshot/deleting', - { + args={ 'name': name, }, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) @@ -1462,9 +1487,10 @@ def delete_snapshot(kwargs=None, call=None): 'event', 'deleted snapshot', 'salt/cloud/snapshot/deleted', - { + args={ 'name': name, }, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) return result @@ -1499,11 +1525,12 @@ def delete_disk(kwargs=None, call=None): 'event', 'delete disk', 'salt/cloud/disk/deleting', - { + args={ 'name': disk.name, 'location': disk.extra['zone'].name, 'size': disk.size, }, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) @@ -1522,11 +1549,12 @@ def delete_disk(kwargs=None, call=None): 'event', 'deleted disk', 'salt/cloud/disk/deleted', - { + args={ 'name': disk.name, 'location': disk.extra['zone'].name, 'size': disk.size, }, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) return result @@ -1586,12 +1614,13 @@ def create_disk(kwargs=None, call=None): 'event', 'create disk', 'salt/cloud/disk/creating', - { + args={ 'name': name, 'location': location.name, 'image': image, 'snapshot': snapshot, }, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) @@ -1603,12 +1632,13 @@ def create_disk(kwargs=None, call=None): 'event', 'created disk', 'salt/cloud/disk/created', - { + args={ 'name': name, 'location': location.name, 'image': image, 'snapshot': snapshot, }, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) return _expand_disk(disk) @@ -1661,10 +1691,11 @@ def create_snapshot(kwargs=None, call=None): 'event', 'create snapshot', 'salt/cloud/snapshot/creating', - { + args={ 'name': name, 'disk_name': disk_name, }, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) @@ -1674,10 +1705,11 @@ def create_snapshot(kwargs=None, call=None): 'event', 'created snapshot', 'salt/cloud/snapshot/created', - { + args={ 'name': name, 'disk_name': disk_name, }, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) return _expand_item(snapshot) @@ -1765,10 +1797,11 @@ def detach_disk(name=None, kwargs=None, call=None): 'event', 'detach disk', 'salt/cloud/disk/detaching', - { + args={ 'name': node_name, 'disk_name': disk_name, }, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) @@ -1778,10 +1811,11 @@ def detach_disk(name=None, kwargs=None, call=None): 'event', 'detached disk', 'salt/cloud/disk/detached', - { + args={ 'name': node_name, 'disk_name': disk_name, }, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) return result @@ -1836,12 +1870,13 @@ def attach_disk(name=None, kwargs=None, call=None): 'event', 'attach disk', 'salt/cloud/disk/attaching', - { + args={ 'name': node_name, 'disk_name': disk_name, 'mode': mode, 'boot': boot, }, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) @@ -1851,12 +1886,13 @@ def attach_disk(name=None, kwargs=None, call=None): 'event', 'attached disk', 'salt/cloud/disk/attached', - { + args={ 'name': node_name, 'disk_name': disk_name, 'mode': mode, 'boot': boot, }, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) return result @@ -1919,7 +1955,8 @@ def destroy(vm_name, call=None): 'event', 'delete instance', 'salt/cloud/{0}/deleting'.format(vm_name), - {'name': vm_name}, + args={'name': vm_name}, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) @@ -1956,7 +1993,8 @@ def destroy(vm_name, call=None): 'event', 'delete instance', 'salt/cloud/{0}/deleted'.format(vm_name), - {'name': vm_name}, + args={'name': vm_name}, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) @@ -1969,7 +2007,8 @@ def destroy(vm_name, call=None): 'event', 'delete disk', 'salt/cloud/disk/deleting', - {'name': vm_name}, + args={'name': vm_name}, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) try: @@ -1990,7 +2029,8 @@ def destroy(vm_name, call=None): 'event', 'deleted disk', 'salt/cloud/disk/deleted', - {'name': vm_name}, + args={'name': vm_name}, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) @@ -2080,11 +2120,12 @@ def request_instance(vm_): 'event', 'create instance', 'salt/cloud/{0}/creating'.format(vm_['name']), - { + args={ 'name': vm_['name'], 'profile': vm_['profile'], 'provider': vm_['driver'], }, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) @@ -2143,11 +2184,12 @@ def create(vm_=None, call=None): 'event', 'created instance', 'salt/cloud/{0}/created'.format(vm_['name']), - { + args={ 'name': vm_['name'], 'profile': vm_['profile'], 'provider': vm_['driver'], }, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) diff --git a/salt/cloud/clouds/gogrid.py b/salt/cloud/clouds/gogrid.py index e02a26f2a5..97822a1064 100644 --- a/salt/cloud/clouds/gogrid.py +++ b/salt/cloud/clouds/gogrid.py @@ -101,11 +101,12 @@ def create(vm_): 'event', 'starting create', 'salt/cloud/{0}/creating'.format(vm_['name']), - { + args={ 'name': vm_['name'], 'profile': vm_['profile'], 'provider': vm_['driver'], }, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) @@ -133,7 +134,8 @@ def create(vm_): 'event', 'requesting instance', 'salt/cloud/{0}/requesting'.format(vm_['name']), - {'kwargs': create_kwargs}, + args={'kwargs': create_kwargs}, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) @@ -188,11 +190,12 @@ def create(vm_): 'event', 'created instance', 'salt/cloud/{0}/created'.format(vm_['name']), - { + args={ 'name': vm_['name'], 'profile': vm_['profile'], 'provider': vm_['driver'], }, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) @@ -411,7 +414,8 @@ def destroy(name, call=None): 'event', 'destroying instance', 'salt/cloud/{0}/destroying'.format(name), - {'name': name}, + args={'name': name}, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) @@ -421,7 +425,8 @@ def destroy(name, call=None): 'event', 'destroyed instance', 'salt/cloud/{0}/destroyed'.format(name), - {'name': name}, + args={'name': name}, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) diff --git a/salt/cloud/clouds/joyent.py b/salt/cloud/clouds/joyent.py index 62baf37e2d..dc609b32da 100644 --- a/salt/cloud/clouds/joyent.py +++ b/salt/cloud/clouds/joyent.py @@ -182,6 +182,7 @@ def query_instance(vm_=None, call=None): 'event', 'querying instance', 'salt/cloud/{0}/querying'.format(vm_['name']), + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) @@ -263,11 +264,12 @@ def create(vm_): 'event', 'starting create', 'salt/cloud/{0}/creating'.format(vm_['name']), - { + args={ 'name': vm_['name'], 'profile': vm_['profile'], 'provider': vm_['driver'], }, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) @@ -295,7 +297,8 @@ def create(vm_): 'event', 'requesting instance', 'salt/cloud/{0}/requesting'.format(vm_['name']), - {'kwargs': kwargs}, + args={'kwargs': kwargs}, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) @@ -325,11 +328,12 @@ def create(vm_): 'event', 'created instance', 'salt/cloud/{0}/created'.format(vm_['name']), - { + args={ 'name': vm_['name'], 'profile': vm_['profile'], 'provider': vm_['driver'], }, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) @@ -394,7 +398,8 @@ def destroy(name, call=None): 'event', 'destroying instance', 'salt/cloud/{0}/destroying'.format(name), - {'name': name}, + args={'name': name}, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) @@ -406,7 +411,8 @@ def destroy(name, call=None): 'event', 'destroyed instance', 'salt/cloud/{0}/destroyed'.format(name), - {'name': name}, + args={'name': name}, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) diff --git a/salt/cloud/clouds/linode.py b/salt/cloud/clouds/linode.py index 09ec428155..078f2fddbe 100644 --- a/salt/cloud/clouds/linode.py +++ b/salt/cloud/clouds/linode.py @@ -351,11 +351,12 @@ def create(vm_): 'event', 'starting create', 'salt/cloud/{0}/creating'.format(name), - { + args={ 'name': name, 'profile': vm_['profile'], 'provider': vm_['driver'], }, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) @@ -442,7 +443,8 @@ def create(vm_): 'event', 'requesting instance', 'salt/cloud/{0}/requesting'.format(name), - {'kwargs': kwargs}, + args={'kwargs': kwargs}, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) @@ -529,11 +531,12 @@ def create(vm_): 'event', 'created instance', 'salt/cloud/{0}/created'.format(name), - { + args={ 'name': name, 'profile': vm_['profile'], 'provider': vm_['driver'], }, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) @@ -740,7 +743,8 @@ def destroy(name, call=None): 'event', 'destroying instance', 'salt/cloud/{0}/destroying'.format(name), - {'name': name}, + args={'name': name}, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) @@ -752,7 +756,8 @@ def destroy(name, call=None): 'event', 'destroyed instance', 'salt/cloud/{0}/destroyed'.format(name), - {'name': name}, + args={'name': name}, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) diff --git a/salt/cloud/clouds/lxc.py b/salt/cloud/clouds/lxc.py index 7b26b144fc..fce30da685 100644 --- a/salt/cloud/clouds/lxc.py +++ b/salt/cloud/clouds/lxc.py @@ -397,7 +397,8 @@ def destroy(vm_, call=None): 'event', 'destroying instance', 'salt/cloud/{0}/destroying'.format(vm_), - {'name': vm_, 'instance_id': vm_}, + args={'name': vm_, 'instance_id': vm_}, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) cret = _salt('lxc.destroy', vm_, stop=True, path=path) @@ -408,7 +409,8 @@ def destroy(vm_, call=None): 'event', 'destroyed instance', 'salt/cloud/{0}/destroyed'.format(vm_), - {'name': vm_, 'instance_id': vm_}, + args={'name': vm_, 'instance_id': vm_}, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) if __opts__.get('update_cachedir', False) is True: @@ -439,10 +441,15 @@ def create(vm_, call=None): vm_['driver'] = vm_.pop('provider') salt.utils.cloud.fire_event( - 'event', 'starting create', + 'event', + 'starting create', 'salt/cloud/{0}/creating'.format(vm_['name']), - {'name': vm_['name'], 'profile': profile, - 'provider': vm_['driver'], }, + args={ + 'name': vm_['name'], + 'profile': profile, + 'provider': vm_['driver'], + }, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport']) ret = {'name': vm_['name'], 'changes': {}, 'result': True, 'comment': ''} if 'pub_key' not in vm_ and 'priv_key' not in vm_: @@ -477,11 +484,12 @@ def create(vm_, call=None): 'event', 'created instance', 'salt/cloud/{0}/created'.format(vm_['name']), - { + args={ 'name': vm_['name'], 'profile': vm_['profile'], 'provider': vm_['driver'], }, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) diff --git a/salt/cloud/clouds/msazure.py b/salt/cloud/clouds/msazure.py index 8cb541ef29..6b45c8dfd1 100644 --- a/salt/cloud/clouds/msazure.py +++ b/salt/cloud/clouds/msazure.py @@ -426,11 +426,12 @@ def create(vm_): 'event', 'starting create', 'salt/cloud/{0}/creating'.format(vm_['name']), - { + args={ 'name': vm_['name'], 'profile': vm_['profile'], 'provider': vm_['driver'], }, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) @@ -541,7 +542,8 @@ def create(vm_): 'event', 'requesting instance', 'salt/cloud/{0}/requesting'.format(vm_['name']), - event_kwargs, + args=event_kwargs, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) log.debug('vm_kwargs: {0}'.format(vm_kwargs)) @@ -656,7 +658,8 @@ def create(vm_): 'event', 'attaching volumes', 'salt/cloud/{0}/attaching_volumes'.format(vm_['name']), - {'volumes': volumes}, + args={'volumes': volumes}, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) @@ -689,11 +692,12 @@ def create(vm_): 'event', 'created instance', 'salt/cloud/{0}/created'.format(vm_['name']), - { + args={ 'name': vm_['name'], 'profile': vm_['profile'], 'provider': vm_['driver'], }, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) diff --git a/salt/cloud/clouds/nova.py b/salt/cloud/clouds/nova.py index c660518d16..e44136c8e1 100644 --- a/salt/cloud/clouds/nova.py +++ b/salt/cloud/clouds/nova.py @@ -491,7 +491,8 @@ def destroy(name, conn=None, call=None): 'event', 'destroying instance', 'salt/cloud/{0}/destroying'.format(name), - {'name': name}, + args={'name': name}, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) @@ -528,7 +529,8 @@ def destroy(name, conn=None, call=None): 'event', 'destroyed instance', 'salt/cloud/{0}/destroyed'.format(name), - {'name': name}, + args={'name': name}, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) if __opts__.get('delete_sshkeys', False) is True: @@ -642,9 +644,14 @@ def request_instance(vm_=None, call=None): 'event', 'requesting instance', 'salt/cloud/{0}/requesting'.format(vm_['name']), - {'kwargs': {'name': kwargs['name'], - 'image': kwargs.get('image_id', 'Boot From Volume'), - 'size': kwargs['flavor_id']}}, + args={ + 'kwargs': { + 'name': kwargs['name'], + 'image': kwargs.get('image_id', 'Boot From Volume'), + 'size': kwargs['flavor_id'], + } + }, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) @@ -728,11 +735,12 @@ def create(vm_): 'event', 'starting create', 'salt/cloud/{0}/creating'.format(vm_['name']), - { + args={ 'name': vm_['name'], 'profile': vm_['profile'], 'provider': vm_['driver'], }, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) conn = get_conn() @@ -989,7 +997,8 @@ def create(vm_): 'event', 'created instance', 'salt/cloud/{0}/created'.format(vm_['name']), - event_data, + args=event_data, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) salt.utils.cloud.cachedir_index_add( diff --git a/salt/cloud/clouds/opennebula.py b/salt/cloud/clouds/opennebula.py index f33a206b61..88e67eb683 100644 --- a/salt/cloud/clouds/opennebula.py +++ b/salt/cloud/clouds/opennebula.py @@ -903,11 +903,12 @@ def create(vm_): 'event', 'starting create', 'salt/cloud/{0}/creating'.format(vm_['name']), - { + args={ 'name': vm_['name'], 'profile': vm_['profile'], 'provider': vm_['driver'], }, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) @@ -929,7 +930,8 @@ def create(vm_): 'event', 'requesting instance', 'salt/cloud/{0}/requesting'.format(vm_['name']), - {'kwargs': kwargs}, + args={'kwargs': kwargs}, + sock_dir=__opts__['sock_dir'], ) template = [] @@ -1056,11 +1058,12 @@ def create(vm_): 'event', 'created instance', 'salt/cloud/{0}/created'.format(vm_['name']), - { + args={ 'name': vm_['name'], 'profile': vm_['profile'], 'provider': vm_['driver'], }, + sock_dir=__opts__['sock_dir'], ) return ret @@ -1093,7 +1096,8 @@ def destroy(name, call=None): 'event', 'destroying instance', 'salt/cloud/{0}/destroying'.format(name), - {'name': name}, + args={'name': name}, + sock_dir=__opts__['sock_dir'], ) server, user, password = _get_xml_rpc() @@ -1106,7 +1110,8 @@ def destroy(name, call=None): 'event', 'destroyed instance', 'salt/cloud/{0}/destroyed'.format(name), - {'name': name}, + args={'name': name}, + sock_dir=__opts__['sock_dir'], ) if __opts__.get('update_cachedir', False) is True: diff --git a/salt/cloud/clouds/openstack.py b/salt/cloud/clouds/openstack.py index ba686d4f8a..b63cbf5b45 100644 --- a/salt/cloud/clouds/openstack.py +++ b/salt/cloud/clouds/openstack.py @@ -519,10 +519,15 @@ def request_instance(vm_=None, call=None): 'event', 'requesting instance', 'salt/cloud/{0}/requesting'.format(vm_['name']), - {'kwargs': {'name': kwargs['name'], - 'image': kwargs['image'].name, - 'size': kwargs['size'].name, - 'profile': vm_['profile']}}, + args={ + 'kwargs': { + 'name': kwargs['name'], + 'image': kwargs['image'].name, + 'size': kwargs['size'].name, + 'profile': vm_['profile'], + } + }, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) @@ -589,11 +594,12 @@ def create(vm_): 'event', 'starting create', 'salt/cloud/{0}/creating'.format(vm_['name']), - { + args={ 'name': vm_['name'], 'profile': vm_['profile'], 'provider': vm_['driver'], }, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) @@ -791,11 +797,12 @@ def create(vm_): 'event', 'created instance', 'salt/cloud/{0}/created'.format(vm_['name']), - { + args={ 'name': vm_['name'], 'profile': vm_['profile'], 'provider': vm_['driver'], }, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) diff --git a/salt/cloud/clouds/parallels.py b/salt/cloud/clouds/parallels.py index 658344ccb0..06865be677 100644 --- a/salt/cloud/clouds/parallels.py +++ b/salt/cloud/clouds/parallels.py @@ -257,7 +257,8 @@ def create_node(vm_): 'event', 'requesting instance', 'salt/cloud/{0}/requesting'.format(vm_['name']), - {'kwargs': data}, + args={'kwargs': data}, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) @@ -288,11 +289,12 @@ def create(vm_): 'event', 'starting create', 'salt/cloud/{0}/creating'.format(vm_['name']), - { + args={ 'name': vm_['name'], 'profile': vm_['profile'], 'provider': vm_['driver'], }, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) @@ -362,11 +364,12 @@ def create(vm_): 'event', 'created instance', 'salt/cloud/{0}/created'.format(vm_['name']), - { + args={ 'name': vm_['name'], 'profile': vm_['profile'], 'provider': vm_['driver'], }, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) @@ -546,7 +549,8 @@ def destroy(name, call=None): 'event', 'destroying instance', 'salt/cloud/{0}/destroying'.format(name), - {'name': name}, + args={'name': name}, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) @@ -569,7 +573,8 @@ def destroy(name, call=None): 'event', 'destroyed instance', 'salt/cloud/{0}/destroyed'.format(name), - {'name': name}, + args={'name': name}, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) diff --git a/salt/cloud/clouds/profitbricks.py b/salt/cloud/clouds/profitbricks.py index 0c8af4fb9d..ac555f53fe 100644 --- a/salt/cloud/clouds/profitbricks.py +++ b/salt/cloud/clouds/profitbricks.py @@ -623,7 +623,8 @@ def create(vm_): 'event', 'requesting instance', 'salt/cloud/{0}/requesting'.format(vm_['name']), - {'name': vm_['name']}, + args={'name': vm_['name']}, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) @@ -718,11 +719,12 @@ def create(vm_): 'event', 'created instance', 'salt/cloud/{0}/created'.format(vm_['name']), - { + args={ 'name': vm_['name'], 'profile': vm_['profile'], 'provider': vm_['driver'], }, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) @@ -761,7 +763,8 @@ def destroy(name, call=None): 'event', 'destroying instance', 'salt/cloud/{0}/destroying'.format(name), - {'name': name}, + args={'name': name}, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) @@ -775,7 +778,8 @@ def destroy(name, call=None): 'event', 'destroyed instance', 'salt/cloud/{0}/destroyed'.format(name), - {'name': name}, + args={'name': name}, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) diff --git a/salt/cloud/clouds/proxmox.py b/salt/cloud/clouds/proxmox.py index 2d698368e1..10781cf37f 100644 --- a/salt/cloud/clouds/proxmox.py +++ b/salt/cloud/clouds/proxmox.py @@ -520,11 +520,12 @@ def create(vm_): 'event', 'starting create', 'salt/cloud/{0}/creating'.format(vm_['name']), - { + args={ 'name': vm_['name'], 'profile': vm_['profile'], 'provider': vm_['driver'], }, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) @@ -618,11 +619,12 @@ def create(vm_): 'event', 'created instance', 'salt/cloud/{0}/created'.format(vm_['name']), - { + args={ 'name': vm_['name'], 'profile': vm_['profile'], 'provider': vm_['driver'], }, + sock_dir=__opts__['sock_dir'], ) return ret @@ -707,7 +709,8 @@ def create_node(vm_, newid): 'event', 'requesting instance', 'salt/cloud/{0}/requesting'.format(vm_['name']), - {'kwargs': newnode}, + args={'kwargs': newnode}, + sock_dir=__opts__['sock_dir'], ) log.debug('Preparing to generate a node using these parameters: {0} '.format( @@ -825,7 +828,8 @@ def destroy(name, call=None): 'event', 'destroying instance', 'salt/cloud/{0}/destroying'.format(name), - {'name': name}, + args={'name': name}, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) @@ -850,7 +854,8 @@ def destroy(name, call=None): 'event', 'destroyed instance', 'salt/cloud/{0}/destroyed'.format(name), - {'name': name}, + args={'name': name}, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) if __opts__.get('update_cachedir', False) is True: diff --git a/salt/cloud/clouds/qingcloud.py b/salt/cloud/clouds/qingcloud.py index 47fcfc4314..1356cea308 100644 --- a/salt/cloud/clouds/qingcloud.py +++ b/salt/cloud/clouds/qingcloud.py @@ -675,11 +675,12 @@ def create(vm_): 'event', 'starting create', 'salt/cloud/{0}/creating'.format(vm_['name']), - { + args={ 'name': vm_['name'], 'profile': vm_['profile'], 'provider': vm_['driver'], }, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) @@ -701,7 +702,8 @@ def create(vm_): 'event', 'requesting instance', 'salt/cloud/{0}/requesting'.format(vm_['name']), - {'kwargs': params}, + args={'kwargs': params}, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) @@ -749,11 +751,12 @@ def create(vm_): 'event', 'created instance', 'salt/cloud/{0}/created'.format(vm_['name']), - { + args={ 'name': vm_['name'], 'profile': vm_['profile'], 'provider': vm_['driver'], }, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) @@ -883,7 +886,8 @@ def destroy(instance_id, call=None): 'event', 'destroying instance', 'salt/cloud/{0}/destroying'.format(name), - {'name': name}, + args={'name': name}, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) @@ -898,7 +902,8 @@ def destroy(instance_id, call=None): 'event', 'destroyed instance', 'salt/cloud/{0}/destroyed'.format(name), - {'name': name}, + args={'name': name}, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) diff --git a/salt/cloud/clouds/rackspace.py b/salt/cloud/clouds/rackspace.py index 5d44389021..2ade6e41d1 100644 --- a/salt/cloud/clouds/rackspace.py +++ b/salt/cloud/clouds/rackspace.py @@ -212,11 +212,12 @@ def create(vm_): 'event', 'starting create', 'salt/cloud/{0}/creating'.format(vm_['name']), - { + args={ 'name': vm_['name'], 'profile': vm_['profile'], 'provider': vm_['driver'], }, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) @@ -232,9 +233,14 @@ def create(vm_): 'event', 'requesting instance', 'salt/cloud/{0}/requesting'.format(vm_['name']), - {'kwargs': {'name': kwargs['name'], - 'image': kwargs['image'].name, - 'size': kwargs['size'].name}}, + args={ + 'kwargs': { + 'name': kwargs['name'], + 'image': kwargs['image'].name, + 'size': kwargs['size'].name, + } + }, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) @@ -369,11 +375,12 @@ def create(vm_): 'event', 'created instance', 'salt/cloud/{0}/created'.format(vm_['name']), - { + args={ 'name': vm_['name'], 'profile': vm_['profile'], 'provider': vm_['driver'], }, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) diff --git a/salt/cloud/clouds/scaleway.py b/salt/cloud/clouds/scaleway.py index bf1efbb205..539e9bf66c 100644 --- a/salt/cloud/clouds/scaleway.py +++ b/salt/cloud/clouds/scaleway.py @@ -224,11 +224,12 @@ def create(server_): 'event', 'starting create', 'salt/cloud/{0}/creating'.format(server_['name']), - { + args={ 'name': server_['name'], 'profile': server_['profile'], 'provider': server_['driver'], }, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) @@ -253,7 +254,8 @@ def create(server_): 'event', 'requesting instance', 'salt/cloud/{0}/requesting'.format(server_['name']), - {'kwargs': kwargs}, + args={'kwargs': kwargs}, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) @@ -317,11 +319,12 @@ def create(server_): 'event', 'created instance', 'salt/cloud/{0}/created'.format(server_['name']), - { + args={ 'name': server_['name'], 'profile': server_['profile'], 'provider': server_['driver'], }, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) @@ -439,7 +442,8 @@ def destroy(name, call=None): 'event', 'destroying instance', 'salt/cloud/{0}/destroying'.format(name), - {'name': name}, + args={'name': name}, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) @@ -453,7 +457,8 @@ def destroy(name, call=None): 'event', 'destroyed instance', 'salt/cloud/{0}/destroyed'.format(name), - {'name': name}, + args={'name': name}, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) diff --git a/salt/cloud/clouds/softlayer.py b/salt/cloud/clouds/softlayer.py index eba22191af..cba4160f5d 100644 --- a/salt/cloud/clouds/softlayer.py +++ b/salt/cloud/clouds/softlayer.py @@ -275,11 +275,12 @@ def create(vm_): 'event', 'starting create', 'salt/cloud/{0}/creating'.format(name), - { + args={ 'name': name, 'profile': vm_['profile'], 'provider': vm_['driver'], }, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) @@ -380,7 +381,8 @@ def create(vm_): 'event', 'requesting instance', 'salt/cloud/{0}/requesting'.format(name), - {'kwargs': kwargs}, + args={'kwargs': kwargs}, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) @@ -492,11 +494,12 @@ def create(vm_): 'event', 'created instance', 'salt/cloud/{0}/created'.format(name), - { + args={ 'name': name, 'profile': vm_['profile'], 'provider': vm_['driver'], }, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) @@ -597,7 +600,8 @@ def destroy(name, call=None): 'event', 'destroying instance', 'salt/cloud/{0}/destroying'.format(name), - {'name': name}, + args={'name': name}, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) @@ -612,7 +616,8 @@ def destroy(name, call=None): 'event', 'destroyed instance', 'salt/cloud/{0}/destroyed'.format(name), - {'name': name}, + args={'name': name}, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) if __opts__.get('update_cachedir', False) is True: diff --git a/salt/cloud/clouds/softlayer_hw.py b/salt/cloud/clouds/softlayer_hw.py index a39a8ef63b..05e34ec0fb 100644 --- a/salt/cloud/clouds/softlayer_hw.py +++ b/salt/cloud/clouds/softlayer_hw.py @@ -246,11 +246,12 @@ def create(vm_): 'event', 'starting create', 'salt/cloud/{0}/creating'.format(name), - { + args={ 'name': name, 'profile': vm_['profile'], 'provider': vm_['driver'], }, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) @@ -333,7 +334,8 @@ def create(vm_): 'event', 'requesting instance', 'salt/cloud/{0}/requesting'.format(name), - {'kwargs': kwargs}, + args={'kwargs': kwargs}, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) @@ -424,11 +426,12 @@ def create(vm_): 'event', 'created instance', 'salt/cloud/{0}/created'.format(name), - { + args={ 'name': name, 'profile': vm_['profile'], 'provider': vm_['driver'], }, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) @@ -529,7 +532,8 @@ def destroy(name, call=None): 'event', 'destroying instance', 'salt/cloud/{0}/destroying'.format(name), - {'name': name}, + args={'name': name}, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) @@ -552,7 +556,8 @@ def destroy(name, call=None): 'event', 'destroyed instance', 'salt/cloud/{0}/destroyed'.format(name), - {'name': name}, + args={'name': name}, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) if __opts__.get('update_cachedir', False) is True: diff --git a/salt/cloud/clouds/virtualbox.py b/salt/cloud/clouds/virtualbox.py index 1e97f1209b..f4ce8613c8 100644 --- a/salt/cloud/clouds/virtualbox.py +++ b/salt/cloud/clouds/virtualbox.py @@ -140,11 +140,12 @@ def create(vm_info): 'event', 'starting create', 'salt/cloud/{0}/creating'.format(vm_info['name']), - { + args={ 'name': vm_info['name'], 'profile': vm_info['profile'], 'driver': vm_info['driver'], }, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) @@ -158,7 +159,8 @@ def create(vm_info): 'event', 'requesting instance', 'salt/cloud/{0}/requesting'.format(vm_info['name']), - request_kwargs, + args=request_kwargs, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) vm_result = vb_clone_vm(**request_kwargs) @@ -183,7 +185,8 @@ def create(vm_info): 'event', 'created machine', 'salt/cloud/{0}/created'.format(vm_info['name']), - vm_result, + args=vm_result, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) @@ -311,7 +314,8 @@ def destroy(name, call=None): 'event', 'destroying instance', 'salt/cloud/{0}/destroying'.format(name), - {'name': name}, + args={'name': name}, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) @@ -321,7 +325,8 @@ def destroy(name, call=None): 'event', 'destroyed instance', 'salt/cloud/{0}/destroyed'.format(name), - {'name': name}, + args={'name': name}, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) diff --git a/salt/cloud/clouds/vmware.py b/salt/cloud/clouds/vmware.py index 4c2580605e..68b1d4fb9a 100644 --- a/salt/cloud/clouds/vmware.py +++ b/salt/cloud/clouds/vmware.py @@ -2074,7 +2074,8 @@ def destroy(name, call=None): 'event', 'destroying instance', 'salt/cloud/{0}/destroying'.format(name), - {'name': name}, + args={'name': name}, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) @@ -2122,7 +2123,8 @@ def destroy(name, call=None): 'event', 'destroyed instance', 'salt/cloud/{0}/destroyed'.format(name), - {'name': name}, + args={'name': name}, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) if __opts__.get('update_cachedir', False) is True: @@ -2163,11 +2165,12 @@ def create(vm_): 'event', 'starting create', 'salt/cloud/{0}/creating'.format(vm_['name']), - { + args={ 'name': vm_['name'], 'profile': vm_['profile'], 'provider': vm_['driver'], }, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) @@ -2464,7 +2467,8 @@ def create(vm_): 'event', 'requesting instance', 'salt/cloud/{0}/requesting'.format(vm_['name']), - {'kwargs': vm_}, + args={'kwargs': vm_}, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) @@ -2538,11 +2542,12 @@ def create(vm_): 'event', 'created instance', 'salt/cloud/{0}/created'.format(vm_['name']), - { + args={ 'name': vm_['name'], 'profile': vm_['profile'], 'provider': vm_['driver'], }, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) return data diff --git a/salt/cloud/clouds/vsphere.py b/salt/cloud/clouds/vsphere.py index 1bac405f4c..e86f4216fa 100644 --- a/salt/cloud/clouds/vsphere.py +++ b/salt/cloud/clouds/vsphere.py @@ -261,11 +261,12 @@ def create(vm_): 'event', 'starting create', 'salt/cloud/{0}/creating'.format(vm_['name']), - { + args={ 'name': vm_['name'], 'profile': vm_['profile'], 'provider': vm_['driver'], }, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) @@ -276,7 +277,8 @@ def create(vm_): 'event', 'requesting instance', 'salt/cloud/{0}/requesting'.format(vm_['name']), - {'kwargs': vm_}, + args={'kwargs': vm_}, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) @@ -346,11 +348,12 @@ def create(vm_): 'event', 'created instance', 'salt/cloud/{0}/created'.format(vm_['name']), - { + args={ 'name': vm_['name'], 'profile': vm_['profile'], 'provider': vm_['driver'], }, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) return ret @@ -479,7 +482,8 @@ def _deploy(vm_): 'event', 'executing deploy script', 'salt/cloud/{0}/deploying'.format(vm_['name']), - {'kwargs': deploy_kwargs}, + args={'kwargs': deploy_kwargs}, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) @@ -647,7 +651,8 @@ def destroy(name, call=None): # pylint: disable=W0613 'event', 'destroying instance', 'salt/cloud/{0}/destroying'.format(name), - {'name': name}, + args={'name': name}, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) @@ -664,7 +669,8 @@ def destroy(name, call=None): # pylint: disable=W0613 'event', 'destroyed instance', 'salt/cloud/{0}/destroyed'.format(name), - {'name': name}, + args={'name': name}, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) if __opts__.get('update_cachedir', False) is True: diff --git a/salt/cloud/clouds/vultrpy.py b/salt/cloud/clouds/vultrpy.py index 12a63a017f..b5404e2989 100644 --- a/salt/cloud/clouds/vultrpy.py +++ b/salt/cloud/clouds/vultrpy.py @@ -245,11 +245,12 @@ def create(vm_): 'event', 'starting create', 'salt/cloud/{0}/creating'.format(vm_['name']), - { + args={ 'name': vm_['name'], 'profile': vm_['profile'], 'provider': vm_['driver'], }, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) @@ -283,7 +284,8 @@ def create(vm_): 'event', 'requesting instance', 'salt/cloud/{0}/requesting'.format(vm_['name']), - {'kwargs': kwargs}, + args={'kwargs': kwargs}, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'], ) @@ -299,7 +301,8 @@ def create(vm_): 'event', 'instance request failed', 'salt/cloud/{0}/requesting/failed'.format(vm_['name']), - {'kwargs': kwargs}, + args={'kwargs': kwargs}, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'], ) return False @@ -317,7 +320,8 @@ def create(vm_): 'event', 'instance request failed', 'salt/cloud/{0}/requesting/failed'.format(vm_['name']), - {'kwargs': kwargs}, + args={'kwargs': kwargs}, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'], ) return False @@ -378,11 +382,12 @@ def create(vm_): 'event', 'created instance', 'salt/cloud/{0}/created'.format(vm_['name']), - { + args={ 'name': vm_['name'], 'profile': vm_['profile'], 'provider': vm_['driver'], }, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) diff --git a/salt/cloud/libcloudfuncs.py b/salt/cloud/libcloudfuncs.py index 6edb052c8d..8af1218b58 100644 --- a/salt/cloud/libcloudfuncs.py +++ b/salt/cloud/libcloudfuncs.py @@ -346,7 +346,8 @@ def destroy(name, conn=None, call=None): 'event', 'destroying instance', 'salt/cloud/{0}/destroying'.format(name), - {'name': name}, + args={'name': name}, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) @@ -386,7 +387,8 @@ def destroy(name, conn=None, call=None): 'event', 'destroyed instance', 'salt/cloud/{0}/destroyed'.format(name), - {'name': name}, + args={'name': name}, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) if __opts__['delete_sshkeys'] is True: @@ -426,7 +428,8 @@ def reboot(name, conn=None): 'event', '{0} has been rebooted'.format(name), 'salt-cloud' 'salt/cloud/{0}/rebooting'.format(name), - {'name': name}, + args={'name': name}, + sock_dir=__opts__['sock_dir'], transport=__opts__['transport'] ) return True diff --git a/salt/utils/cloud.py b/salt/utils/cloud.py index 06a83f7305..0f5bb32265 100644 --- a/salt/utils/cloud.py +++ b/salt/utils/cloud.py @@ -511,7 +511,10 @@ def bootstrap(vm_, opts): 'event', 'executing deploy script', 'salt/cloud/{0}/deploying'.format(vm_['name']), - {'kwargs': event_kwargs}, + args={'kwargs': event_kwargs}, + sock_dir=opts.get( + 'sock_dir', + os.path.join(syspaths.SOCK_DIR, 'master')), transport=opts.get('transport', 'zeromq') ) @@ -1152,7 +1155,10 @@ def deploy_windows(host, 'event', '{0} has been deployed at {1}'.format(name, host), 'salt/cloud/{0}/deploy_windows'.format(name), - {'name': name}, + args={'name': name}, + sock_dir=opts.get( + 'sock_dir', + os.path.join(syspaths.SOCK_DIR, 'master')), transport=opts.get('transport', 'zeromq') ) @@ -1620,10 +1626,13 @@ def deploy_script(host, 'event', '{0} has been deployed at {1}'.format(name, host), 'salt/cloud/{0}/deploy_script'.format(name), - { + args={ 'name': name, 'host': host }, + sock_dir=opts.get( + 'sock_dir', + os.path.join(syspaths.SOCK_DIR, 'master')), transport=opts.get('transport', 'zeromq') ) if file_map_fail or file_map_success: @@ -2864,7 +2873,10 @@ def missing_node_cache(prov_dir, node_list, provider, opts): 'event', 'cached node missing from provider', 'salt/cloud/{0}/cache_node_missing'.format(node), - {'missing node': node}, + args={'missing node': node}, + sock_dir=opts.get( + 'sock_dir', + os.path.join(syspaths.SOCK_DIR, 'master')), transport=opts.get('transport', 'zeromq') ) @@ -2897,7 +2909,10 @@ def diff_node_cache(prov_dir, node, new_data, opts): 'event', 'new node found', 'salt/cloud/{0}/cache_node_new'.format(node), - {'new_data': event_data}, + args={'new_data': event_data}, + sock_dir=opts.get( + 'sock_dir', + os.path.join(syspaths.SOCK_DIR, 'master')), transport=opts.get('transport', 'zeromq') ) return @@ -2918,10 +2933,13 @@ def diff_node_cache(prov_dir, node, new_data, opts): 'event', 'node data differs', 'salt/cloud/{0}/cache_node_diff'.format(node), - { + args={ 'new_data': _strip_cache_events(new_data, opts), 'cache_data': _strip_cache_events(cache_data, opts), }, + sock_dir=opts.get( + 'sock_dir', + os.path.join(syspaths.SOCK_DIR, 'master')), transport=opts.get('transport', 'zeromq') ) From 149ef135f4a52e27a573c339d6c7cecf8b2fe3b3 Mon Sep 17 00:00:00 2001 From: John Kristensen Date: Sun, 31 Jul 2016 00:39:39 +1000 Subject: [PATCH 2/2] Warn users when calling `salt.utils.cloud.fire_event()` without `sock_dir` The `sock_dir` parameter should be used when calling `fire_event()` because it currently defaults to a value that isn't very useful if no value is passed in. Eventually the default value will be removed, at which point the `sock_dir` parameter will become a hard requirement. In the meantime we use `salt.utils.warn_until()` to warn the users of this impending change. --- salt/utils/cloud.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/salt/utils/cloud.py b/salt/utils/cloud.py index 0f5bb32265..d7cb9a80b2 100644 --- a/salt/utils/cloud.py +++ b/salt/utils/cloud.py @@ -1728,6 +1728,11 @@ def run_inline_script(host, def fire_event(key, msg, tag, args=None, sock_dir=None, transport='zeromq'): # Fire deploy action if sock_dir is None: + salt.utils.warn_until( + 'Nitrogen', + '`salt.utils.cloud.fire_event` requires that the `sock_dir`' + 'parameter be passed in when calling the function.' + ) sock_dir = os.path.join(syspaths.SOCK_DIR, 'master') event = salt.utils.event.get_event( 'master',