text stringlengths 81 112k |
|---|
Need to override libcloud to find the machine type in the proper zone.
def __get_size(conn, vm_):
'''
Need to override libcloud to find the machine type in the proper zone.
'''
size = config.get_cloud_config_value(
'size', vm_, __opts__, default='n1-standard-1', search_global=False)
return ... |
Get configured tags.
def __get_tags(vm_):
'''
Get configured tags.
'''
t = config.get_cloud_config_value(
'tags', vm_, __opts__,
default='[]', search_global=False)
# Consider warning the user that the tags in the cloud profile
# could not be interpreted, bad formatting?
try:... |
Get configured metadata and add 'salt-cloud-profile'.
def __get_metadata(vm_):
'''
Get configured metadata and add 'salt-cloud-profile'.
'''
md = config.get_cloud_config_value(
'metadata', vm_, __opts__,
default='{}', search_global=False)
# Consider warning the user that the metadat... |
Return public IP, private IP, or hostname for the libcloud 'node' object
def __get_host(node, vm_):
'''
Return public IP, private IP, or hostname for the libcloud 'node' object
'''
if __get_ssh_interface(vm_) == 'private_ips' or vm_['external_ip'] is None:
ip_address = node.private_ips[0]
... |
Return a GCE libcloud network object with matching name
def __get_network(conn, vm_):
'''
Return a GCE libcloud network object with matching name
'''
network = config.get_cloud_config_value(
'network', vm_, __opts__,
default='default', search_global=False)
return conn.ex_get_network... |
Get configured subnetwork.
def __get_subnetwork(vm_):
'''
Get configured subnetwork.
'''
ex_subnetwork = config.get_cloud_config_value(
'subnetwork', vm_, __opts__,
search_global=False)
return ex_subnetwork |
Return a GCE libcloud region object with matching name.
def __get_region(conn, vm_):
'''
Return a GCE libcloud region object with matching name.
'''
location = __get_location(conn, vm_)
region = '-'.join(location.name.split('-')[:2])
return conn.ex_get_region(region) |
Reuse or create a static IP address.
Returns a native GCEAddress construct to use with libcloud.
def __create_orget_address(conn, name, region):
'''
Reuse or create a static IP address.
Returns a native GCEAddress construct to use with libcloud.
'''
try:
addy = conn.ex_get_address(name,... |
Convert firewall rule allowed user-string to specified REST API format.
def _parse_allow(allow):
'''
Convert firewall rule allowed user-string to specified REST API format.
'''
# input=> tcp:53,tcp:80,tcp:443,icmp,tcp:4201,udp:53
# output<= [
# {"IPProtocol": "tcp", "ports": ["53","80","443... |
Get configured SSH credentials.
def __get_ssh_credentials(vm_):
'''
Get configured SSH credentials.
'''
ssh_user = config.get_cloud_config_value(
'ssh_username', vm_, __opts__, default=os.getenv('USER'))
ssh_key = config.get_cloud_config_value(
'ssh_keyfile', vm_, __opts__,
... |
... versionchanged:: 2017.7.0
Create a GCE network. Must specify name and cidr.
CLI Example:
.. code-block:: bash
salt-cloud -f create_network gce name=mynet cidr=10.10.10.0/24 mode=legacy description=optional
salt-cloud -f create_network gce name=mynet description=optional
def create_ne... |
Permanently delete a network.
CLI Example:
.. code-block:: bash
salt-cloud -f delete_network gce name=mynet
def delete_network(kwargs=None, call=None):
'''
Permanently delete a network.
CLI Example:
.. code-block:: bash
salt-cloud -f delete_network gce name=mynet
'''
... |
Show the details of an existing network.
CLI Example:
.. code-block:: bash
salt-cloud -f show_network gce name=mynet
def show_network(kwargs=None, call=None):
'''
Show the details of an existing network.
CLI Example:
.. code-block:: bash
salt-cloud -f show_network gce name... |
... versionadded:: 2017.7.0
Create a GCE Subnetwork. Must specify name, cidr, network, and region.
CLI Example:
.. code-block:: bash
salt-cloud -f create_subnetwork gce name=mysubnet network=mynet1 region=us-west1 cidr=10.0.0.0/24 description=optional
def create_subnetwork(kwargs=None, call=None... |
... versionadded:: 2017.7.0
Delete a GCE Subnetwork. Must specify name and region.
CLI Example:
.. code-block:: bash
salt-cloud -f delete_subnetwork gce name=mysubnet network=mynet1 region=us-west1
def delete_subnetwork(kwargs=None, call=None):
'''
... versionadded:: 2017.7.0
Delete ... |
... versionadded:: 2017.7.0
Show details of an existing GCE Subnetwork. Must specify name and region.
CLI Example:
.. code-block:: bash
salt-cloud -f show_subnetwork gce name=mysubnet region=us-west1
def show_subnetwork(kwargs=None, call=None):
'''
... versionadded:: 2017.7.0
Show de... |
Create a GCE firewall rule. The 'default' network is used if not specified.
CLI Example:
.. code-block:: bash
salt-cloud -f create_fwrule gce name=allow-http allow=tcp:80
def create_fwrule(kwargs=None, call=None):
'''
Create a GCE firewall rule. The 'default' network is used if not specified... |
Permanently delete a firewall rule.
CLI Example:
.. code-block:: bash
salt-cloud -f delete_fwrule gce name=allow-http
def delete_fwrule(kwargs=None, call=None):
'''
Permanently delete a firewall rule.
CLI Example:
.. code-block:: bash
salt-cloud -f delete_fwrule gce name=a... |
Show the details of an existing firewall rule.
CLI Example:
.. code-block:: bash
salt-cloud -f show_fwrule gce name=allow-http
def show_fwrule(kwargs=None, call=None):
'''
Show the details of an existing firewall rule.
CLI Example:
.. code-block:: bash
salt-cloud -f show_f... |
Create an HTTP health check configuration.
CLI Example:
.. code-block:: bash
salt-cloud -f create_hc gce name=hc path=/healthy port=80
def create_hc(kwargs=None, call=None):
'''
Create an HTTP health check configuration.
CLI Example:
.. code-block:: bash
salt-cloud -f crea... |
Permanently delete a health check.
CLI Example:
.. code-block:: bash
salt-cloud -f delete_hc gce name=hc
def delete_hc(kwargs=None, call=None):
'''
Permanently delete a health check.
CLI Example:
.. code-block:: bash
salt-cloud -f delete_hc gce name=hc
'''
if call ... |
Show the details of an existing health check.
CLI Example:
.. code-block:: bash
salt-cloud -f show_hc gce name=hc
def show_hc(kwargs=None, call=None):
'''
Show the details of an existing health check.
CLI Example:
.. code-block:: bash
salt-cloud -f show_hc gce name=hc
... |
Create a static address in a region.
CLI Example:
.. code-block:: bash
salt-cloud -f create_address gce name=my-ip region=us-central1 address=IP
def create_address(kwargs=None, call=None):
'''
Create a static address in a region.
CLI Example:
.. code-block:: bash
salt-clou... |
Permanently delete a static address.
CLI Example:
.. code-block:: bash
salt-cloud -f delete_address gce name=my-ip
def delete_address(kwargs=None, call=None):
'''
Permanently delete a static address.
CLI Example:
.. code-block:: bash
salt-cloud -f delete_address gce name=m... |
Show the details of an existing static address.
CLI Example:
.. code-block:: bash
salt-cloud -f show_address gce name=mysnapshot region=us-central1
def show_address(kwargs=None, call=None):
'''
Show the details of an existing static address.
CLI Example:
.. code-block:: bash
... |
Create a load-balancer configuration.
CLI Example:
.. code-block:: bash
salt-cloud -f create_lb gce name=lb region=us-central1 ports=80
def create_lb(kwargs=None, call=None):
'''
Create a load-balancer configuration.
CLI Example:
.. code-block:: bash
salt-cloud -f create_l... |
Permanently delete a load-balancer.
CLI Example:
.. code-block:: bash
salt-cloud -f delete_lb gce name=lb
def delete_lb(kwargs=None, call=None):
'''
Permanently delete a load-balancer.
CLI Example:
.. code-block:: bash
salt-cloud -f delete_lb gce name=lb
'''
if cal... |
Show the details of an existing load-balancer.
CLI Example:
.. code-block:: bash
salt-cloud -f show_lb gce name=lb
def show_lb(kwargs=None, call=None):
'''
Show the details of an existing load-balancer.
CLI Example:
.. code-block:: bash
salt-cloud -f show_lb gce name=lb
... |
Add an existing node/member to an existing load-balancer configuration.
CLI Example:
.. code-block:: bash
salt-cloud -f attach_lb gce name=lb member=myinstance
def attach_lb(kwargs=None, call=None):
'''
Add an existing node/member to an existing load-balancer configuration.
CLI Example:... |
Remove an existing node/member from an existing load-balancer configuration.
CLI Example:
.. code-block:: bash
salt-cloud -f detach_lb gce name=lb member=myinstance
def detach_lb(kwargs=None, call=None):
'''
Remove an existing node/member from an existing load-balancer configuration.
CL... |
Permanently delete a disk snapshot.
CLI Example:
.. code-block:: bash
salt-cloud -f delete_snapshot gce name=disk-snap-1
def delete_snapshot(kwargs=None, call=None):
'''
Permanently delete a disk snapshot.
CLI Example:
.. code-block:: bash
salt-cloud -f delete_snapshot gce... |
Permanently delete a persistent disk.
CLI Example:
.. code-block:: bash
salt-cloud -f delete_disk gce disk_name=pd
def delete_disk(kwargs=None, call=None):
'''
Permanently delete a persistent disk.
CLI Example:
.. code-block:: bash
salt-cloud -f delete_disk gce disk_name=p... |
Create a new persistent disk. Must specify `disk_name` and `location`,
and optionally can specify 'disk_type' as pd-standard or pd-ssd, which
defaults to pd-standard. Can also specify an `image` or `snapshot` but
if neither of those are specified, a `size` (in GB) is required.
CLI Example:
.. code... |
Create a new disk snapshot. Must specify `name` and `disk_name`.
CLI Example:
.. code-block:: bash
salt-cloud -f create_snapshot gce name=snap1 disk_name=pd
def create_snapshot(kwargs=None, call=None):
'''
Create a new disk snapshot. Must specify `name` and `disk_name`.
CLI Example:
... |
Show the details of an existing disk.
CLI Example:
.. code-block:: bash
salt-cloud -a show_disk myinstance disk_name=mydisk
salt-cloud -f show_disk gce disk_name=mydisk
def show_disk(name=None, kwargs=None, call=None): # pylint: disable=W0613
'''
Show the details of an existing disk... |
Show the details of an existing snapshot.
CLI Example:
.. code-block:: bash
salt-cloud -f show_snapshot gce name=mysnapshot
def show_snapshot(kwargs=None, call=None):
'''
Show the details of an existing snapshot.
CLI Example:
.. code-block:: bash
salt-cloud -f show_snapsho... |
Detach a disk from an instance.
CLI Example:
.. code-block:: bash
salt-cloud -a detach_disk myinstance disk_name=mydisk
def detach_disk(name=None, kwargs=None, call=None):
'''
Detach a disk from an instance.
CLI Example:
.. code-block:: bash
salt-cloud -a detach_disk myins... |
Attach an existing disk to an existing instance.
CLI Example:
.. code-block:: bash
salt-cloud -a attach_disk myinstance disk_name=mydisk mode=READ_WRITE
def attach_disk(name=None, kwargs=None, call=None):
'''
Attach an existing disk to an existing instance.
CLI Example:
.. code-blo... |
Call GCE 'reset' on the instance.
CLI Example:
.. code-block:: bash
salt-cloud -a reboot myinstance
def reboot(vm_name, call=None):
'''
Call GCE 'reset' on the instance.
CLI Example:
.. code-block:: bash
salt-cloud -a reboot myinstance
'''
if call != 'action':
... |
Call GCE 'start on the instance.
.. versionadded:: 2017.7.0
CLI Example:
.. code-block:: bash
salt-cloud -a start myinstance
def start(vm_name, call=None):
'''
Call GCE 'start on the instance.
.. versionadded:: 2017.7.0
CLI Example:
.. code-block:: bash
salt-clou... |
Call GCE 'stop' on the instance.
.. versionadded:: 2017.7.0
CLI Example:
.. code-block:: bash
salt-cloud -a stop myinstance
def stop(vm_name, call=None):
'''
Call GCE 'stop' on the instance.
.. versionadded:: 2017.7.0
CLI Example:
.. code-block:: bash
salt-cloud ... |
Call 'destroy' on the instance. Can be called with "-a destroy" or -d
CLI Example:
.. code-block:: bash
salt-cloud -a destroy myinstance1 myinstance2 ...
salt-cloud -d myinstance1 myinstance2 ...
def destroy(vm_name, call=None):
'''
Call 'destroy' on the instance. Can be called wit... |
.. versionadded:: 2017.7.0
Create and attach multiple volumes to a node. The 'volumes' and 'node'
arguments are required, where 'node' is a libcloud node, and 'volumes'
is a list of maps, where each map contains:
size
The size of the new disk in GB. Required.
type
The disk type, e... |
Request a single GCE instance from a data dict.
.. versionchanged: 2017.7.0
def request_instance(vm_):
'''
Request a single GCE instance from a data dict.
.. versionchanged: 2017.7.0
'''
if not GCE_VM_NAME_REGEX.match(vm_['name']):
raise SaltCloudSystemExit(
'VM names must... |
Create a single GCE instance from a data dict.
def create(vm_=None, call=None):
'''
Create a single GCE instance from a data dict.
'''
if call:
raise SaltCloudSystemExit(
'You cannot create an instance with -a or -f.'
)
node_info = request_instance(vm_)
if isinstanc... |
Download most recent pricing information from GCE and save locally
CLI Examples:
.. code-block:: bash
salt-cloud -f update_pricing my-gce-config
.. versionadded:: 2015.8.0
def update_pricing(kwargs=None, call=None):
'''
Download most recent pricing information from GCE and save locally
... |
Show pricing for a particular profile. This is only an estimate, based on
unofficial pricing sources.
.. versionadded:: 2015.8.0
CLI Examples:
.. code-block:: bash
salt-cloud -f show_pricing my-gce-config profile=my-profile
def show_pricing(kwargs=None, call=None):
'''
Show pricing ... |
Issues HTTP queries to the logstash server.
def _logstash(url, data):
'''
Issues HTTP queries to the logstash server.
'''
result = salt.utils.http.query(
url,
'POST',
header_dict=_HEADERS,
data=salt.utils.json.dumps(data),
decode=True,
status=True,
... |
Listen to salt events and forward them to logstash.
url
The Logstash endpoint.
funs: ``None``
A list of functions to be compared against, looking into the ``fun``
field from the event data. This option helps to select the events
generated by one or more functions.
If an... |
Ensure that the grant is present with the specified properties
name
The name (key) of the grant to add
grant
The grant priv_type (i.e. select,insert,update OR all privileges)
database
The database priv_level (i.e. db.tbl OR db.*)
user
The user to apply the grant to
... |
Ensure that the grant is absent
name
The name (key) of the grant to add
grant
The grant priv_type (i.e. select,insert,update OR all privileges)
database
The database priv_level (i.e. db.tbl OR db.*)
user
The user to apply the grant to
host
The network/hos... |
Internal cassandra nodetool wrapper. Some functions are not
available via pycassa so we must rely on nodetool.
def _nodetool(cmd):
'''
Internal cassandra nodetool wrapper. Some functions are not
available via pycassa so we must rely on nodetool.
'''
nodetool = __salt__['config.option']('cassand... |
Return a pycassa system manager connection object
def _sys_mgr():
'''
Return a pycassa system manager connection object
'''
thrift_port = six.text_type(__salt__['config.option']('cassandra.THRIFT_PORT'))
host = __salt__['config.option']('cassandra.host')
return SystemManager('{0}:{1}'.format(ho... |
Return existing column families for all keyspaces
or just the provided one.
CLI Example:
.. code-block:: bash
salt '*' cassandra.column_families
salt '*' cassandra.column_families <keyspace>
def column_families(keyspace=None):
'''
Return existing column families for all keyspaces... |
Return a dictionary of column family definitions for the given
keyspace/column_family
CLI Example:
.. code-block:: bash
salt '*' cassandra.column_family_definition <keyspace> <column_family>
def column_family_definition(keyspace, column_family):
'''
Return a dictionary of column family d... |
Update a tenant's quota
def update_quota(self, tenant_id, subnet=None, router=None,
network=None, floatingip=None, port=None,
sec_grp=None, sec_grp_rule=None):
'''
Update a tenant's quota
'''
body = {}
if subnet:
body['subnet... |
Delete the specified tenant's quota value
def delete_quota(self, tenant_id):
'''
Delete the specified tenant's quota value
'''
ret = self.network_conn.delete_quota(tenant_id=tenant_id)
return ret if ret else True |
Creates a new port
def create_port(self, name, network, device_id=None, admin_state_up=True):
'''
Creates a new port
'''
net_id = self._find_network_id(network)
body = {'admin_state_up': admin_state_up,
'name': name,
'network_id': net_id}
... |
Updates a port
def update_port(self, port, name, admin_state_up=True):
'''
Updates a port
'''
port_id = self._find_port_id(port)
body = {'name': name,
'admin_state_up': admin_state_up}
return self.network_conn.update_port(port=port_id,
... |
Deletes the specified port
def delete_port(self, port):
'''
Deletes the specified port
'''
port_id = self._find_port_id(port)
ret = self.network_conn.delete_port(port=port_id)
return ret if ret else True |
Creates a new network
def create_network(self, name, admin_state_up=True, router_ext=None, network_type=None, physical_network=None, segmentation_id=None, shared=None, vlan_transparent=None):
'''
Creates a new network
'''
body = {'name': name,
'admin_state_up': admin_sta... |
Updates a network
def update_network(self, network, name):
'''
Updates a network
'''
net_id = self._find_network_id(network)
return self.network_conn.update_network(
network=net_id, body={'network': {'name': name}}) |
Deletes the specified network
def delete_network(self, network):
'''
Deletes the specified network
'''
net_id = self._find_network_id(network)
ret = self.network_conn.delete_network(network=net_id)
return ret if ret else True |
Creates a new subnet
def create_subnet(self, network, cidr, name=None, ip_version=4):
'''
Creates a new subnet
'''
net_id = self._find_network_id(network)
body = {'cidr': cidr,
'ip_version': ip_version,
'network_id': net_id,
'name'... |
Updates a subnet
def update_subnet(self, subnet, name=None):
'''
Updates a subnet
'''
subnet_id = self._find_subnet_id(subnet)
return self.network_conn.update_subnet(
subnet=subnet_id, body={'subnet': {'name': name}}) |
Deletes the specified subnet
def delete_subnet(self, subnet):
'''
Deletes the specified subnet
'''
subnet_id = self._find_subnet_id(subnet)
ret = self.network_conn.delete_subnet(subnet=subnet_id)
return ret if ret else True |
Creates a new router
def create_router(self, name, ext_network=None, admin_state_up=True):
'''
Creates a new router
'''
body = {'name': name,
'admin_state_up': admin_state_up}
if ext_network:
net_id = self._find_network_id(ext_network)
bod... |
Updates a router
def update_router(self, router, name=None, admin_state_up=None, **kwargs):
'''
Updates a router
'''
router_id = self._find_router_id(router)
body = {}
if 'ext_network' in kwargs:
if kwargs.get('ext_network') is None:
body['ex... |
Delete the specified router
def delete_router(self, router):
'''
Delete the specified router
'''
router_id = self._find_router_id(router)
ret = self.network_conn.delete_router(router=router_id)
return ret if ret else True |
Adds an internal network interface to the specified router
def add_interface_router(self, router, subnet):
'''
Adds an internal network interface to the specified router
'''
router_id = self._find_router_id(router)
subnet_id = self._find_subnet_id(subnet)
return self.net... |
Adds an external network gateway to the specified router
def add_gateway_router(self, router, network):
'''
Adds an external network gateway to the specified router
'''
router_id = self._find_router_id(router)
net_id = self._find_network_id(network)
return self.network_c... |
Removes an external network gateway from the specified router
def remove_gateway_router(self, router):
'''
Removes an external network gateway from the specified router
'''
router_id = self._find_router_id(router)
return self.network_conn.remove_gateway_router(router=router_id) |
Creates a new floatingip
def create_floatingip(self, floating_network, port=None):
'''
Creates a new floatingip
'''
net_id = self._find_network_id(floating_network)
body = {'floating_network_id': net_id}
if port:
port_id = self._find_port_id(port)
... |
Updates a floatingip, disassociates the floating ip if
port is set to `None`
def update_floatingip(self, floatingip_id, port=None):
'''
Updates a floatingip, disassociates the floating ip if
port is set to `None`
'''
if port is None:
body = {'floatingip': {}}... |
Deletes the specified floatingip
def delete_floatingip(self, floatingip_id):
'''
Deletes the specified floatingip
'''
ret = self.network_conn.delete_floatingip(floatingip_id)
return ret if ret else True |
Creates a new security group
def create_security_group(self, name, desc=None):
'''
Creates a new security group
'''
body = {'security_group': {'name': name,
'description': desc}}
return self.network_conn.create_security_group(body=body) |
Updates a security group
def update_security_group(self, sec_grp, name=None, desc=None):
'''
Updates a security group
'''
sec_grp_id = self._find_security_group_id(sec_grp)
body = {'security_group': {}}
if name:
body['security_group']['name'] = name
i... |
Deletes the specified security group
def delete_security_group(self, sec_grp):
'''
Deletes the specified security group
'''
sec_grp_id = self._find_security_group_id(sec_grp)
ret = self.network_conn.delete_security_group(sec_grp_id)
return ret if ret else True |
Creates a new security group rule
def create_security_group_rule(
self, sec_grp, remote_grp_id=None, direction='ingress',
protocol=None, port_range_min=None, port_range_max=None,
ether=None):
'''
Creates a new security group rule
'''
sec_grp_id = self... |
Deletes the specified security group rule
def delete_security_group_rule(self, sec_grp_rule_id):
'''
Deletes the specified security group rule
'''
ret = self.network_conn.delete_security_group_rule(
security_group_rule=sec_grp_rule_id)
return ret if ret else True |
Fetches a list of all configured VPN services for a tenant
def list_vpnservices(self, retrieve_all=True, **kwargs):
'''
Fetches a list of all configured VPN services for a tenant
'''
return self.network_conn.list_vpnservices(retrieve_all, **kwargs) |
Fetches information of a specific VPN service
def show_vpnservice(self, vpnservice, **kwargs):
'''
Fetches information of a specific VPN service
'''
vpnservice_id = self._find_vpnservice_id(vpnservice)
return self.network_conn.show_vpnservice(vpnservice_id, **kwargs) |
Creates a new VPN service
def create_vpnservice(self, subnet, router, name, admin_state_up=True):
'''
Creates a new VPN service
'''
subnet_id = self._find_subnet_id(subnet)
router_id = self._find_router_id(router)
body = {'subnet_id': subnet_id,
'router_i... |
Updates a VPN service
def update_vpnservice(self, vpnservice, desc):
'''
Updates a VPN service
'''
vpnservice_id = self._find_vpnservice_id(vpnservice)
body = {'description': desc}
return self.network_conn.update_vpnservice(vpnservice_id,
... |
Deletes the specified VPN service
def delete_vpnservice(self, vpnservice):
'''
Deletes the specified VPN service
'''
vpnservice_id = self._find_vpnservice_id(vpnservice)
ret = self.network_conn.delete_vpnservice(vpnservice_id)
return ret if ret else True |
Creates a new IPsecSiteConnection
def create_ipsec_site_connection(self, name, ipsecpolicy,
ikepolicy,
vpnservice,
peer_cidrs,
peer_address,
... |
Deletes the specified IPsecSiteConnection
def delete_ipsec_site_connection(self, ipsec_site_connection):
'''
Deletes the specified IPsecSiteConnection
'''
ipsec_site_connection_id = self._find_ipsec_site_connection_id(
ipsec_site_connection)
ret = self.network_conn.d... |
Creates a new IKEPolicy
def create_ikepolicy(self, name, **kwargs):
'''
Creates a new IKEPolicy
'''
body = {'name': name}
if 'phase1_negotiation_mode' in kwargs:
body['phase1_negotiation_mode'] = kwargs['phase1_negotiation_mode']
if 'auth_algorithm' in kwargs... |
Deletes the specified IKEPolicy
def delete_ikepolicy(self, ikepolicy):
'''
Deletes the specified IKEPolicy
'''
ikepolicy_id = self._find_ikepolicy_id(ikepolicy)
ret = self.network_conn.delete_ikepolicy(ikepolicy_id)
return ret if ret else True |
Creates a new IPsecPolicy
def create_ipsecpolicy(self, name, **kwargs):
'''
Creates a new IPsecPolicy
'''
body = {'name': name}
if 'transform_protocol' in kwargs:
body['transform_protocol'] = kwargs['transform_protocol']
if 'auth_algorithm' in kwargs:
... |
Deletes the specified IPsecPolicy
def delete_ipsecpolicy(self, ipseecpolicy):
'''
Deletes the specified IPsecPolicy
'''
ipseecpolicy_id = self._find_ipsecpolicy_id(ipseecpolicy)
ret = self.network_conn.delete_ipsecpolicy(ipseecpolicy_id)
return ret if ret else True |
Create a new firlwall rule
def create_firewall_rule(self, protocol, action, **kwargs):
'''
Create a new firlwall rule
'''
body = {'protocol': protocol, 'action': action}
if 'tenant_id' in kwargs:
body['tenant_id'] = kwargs['tenant_id']
if 'name' in kwargs:
... |
Deletes the specified firewall rule
def delete_firewall_rule(self, firewall_rule):
'''
Deletes the specified firewall rule
'''
firewall_rule_id = self._find_firewall_rule_id(firewall_rule)
ret = self.network_conn.delete_firewall_rule(firewall_rule_id)
return ret if ret e... |
Update a firewall rule
def update_firewall_rule(self, firewall_rule, protocol=None, action=None,
name=None, description=None, ip_version=None,
source_ip_address=None, destination_ip_address=None, source_port=None,
destination_port=N... |
Return True if the chroot environment is present.
def exist(name):
'''
Return True if the chroot environment is present.
'''
dev = os.path.join(name, 'dev')
proc = os.path.join(name, 'proc')
return all(os.path.isdir(i) for i in (name, dev, proc)) |
Create a basic chroot environment.
Note that this environment is not functional. The caller needs to
install the minimal required binaries, including Python if
chroot.call is called.
name
Path to the chroot environment
CLI Example:
.. code-block:: bash
salt myminion chroot.c... |
Executes a Salt function inside a chroot environment.
The chroot does not need to have Salt installed, but Python is
required.
name
Path to the chroot environment
function
Salt execution module function
CLI Example:
.. code-block:: bash
salt myminion chroot.call /ch... |
Save the register to <salt cachedir>/thorium/saves/<name>, or to an
absolute path.
If an absolute path is specified, then the directory will be created
non-recursively if it doesn't exist.
USAGE:
.. code-block:: yaml
foo:
file.save
/tmp/foo:
file.save
def sa... |
Search the environment for the relative path.
def find_file(path, saltenv='base', **kwargs):
'''
Search the environment for the relative path.
'''
if 'env' in kwargs:
# "env" is not supported; Use "saltenv".
kwargs.pop('env')
path = os.path.normpath(path)
fnd = {'path': '',
... |
Return a chunk from a file based on the data received
def serve_file(load, fnd):
'''
Return a chunk from a file based on the data received
'''
if 'env' in load:
# "env" is not supported; Use "saltenv".
load.pop('env')
ret = {'data': '',
'dest': ''}
if 'path' not in l... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.