text
stringlengths
81
112k
Turns an IPv4 netmask into it's corresponding prefix length (255.255.255.0 -> 24 as in 192.168.1.10/24). def get_net_size(mask): ''' Turns an IPv4 netmask into it's corresponding prefix length (255.255.255.0 -> 24 as in 192.168.1.10/24). ''' binary_str = '' for octet in mask.split('.'): ...
Takes IP (CIDR notation supported) and optionally netmask and returns the network in CIDR-notation. (The IP can be any IP inside the subnet) def calc_net(ipaddr, netmask=None): ''' Takes IP (CIDR notation supported) and optionally netmask and returns the network in CIDR-notation. (The IP can be...
Accepts an IPv4 dotted quad and returns a string representing its binary counterpart def _ipv4_to_bits(ipaddr): ''' Accepts an IPv4 dotted quad and returns a string representing its binary counterpart ''' return ''.join([bin(int(x))[2:].rjust(8, '0') for x in ipaddr.split('.')])
If `iface` is available, return interface info and no error, otherwise return no info and log and return an error def _get_iface_info(iface): ''' If `iface` is available, return interface info and no error, otherwise return no info and log and return an error ''' iface_info = interfaces() ...
Return the hardware address (a.k.a. MAC address) for a given interface on AIX MAC address not available in through interfaces def _hw_addr_aix(iface): ''' Return the hardware address (a.k.a. MAC address) for a given interface on AIX MAC address not available in through interfaces ''' cmd = subp...
Return the hardware address (a.k.a. MAC address) for a given interface .. versionchanged:: 2016.11.4 Added support for AIX def hw_addr(iface): ''' Return the hardware address (a.k.a. MAC address) for a given interface .. versionchanged:: 2016.11.4 Added support for AIX ''' if...
Return the details of `iface` or an error if it does not exist def interface(iface): ''' Return the details of `iface` or an error if it does not exist ''' iface_info, error = _get_iface_info(iface) if error is False: return iface_info.get(iface, {}).get('inet', '') else: retur...
Return `iface` IPv4 addr or an error if `iface` does not exist def interface_ip(iface): ''' Return `iface` IPv4 addr or an error if `iface` does not exist ''' iface_info, error = _get_iface_info(iface) if error is False: inet = iface_info.get(iface, {}).get('inet', None) return ine...
Returns a list of subnets to which the host belongs def _subnets(proto='inet', interfaces_=None): ''' Returns a list of subnets to which the host belongs ''' if interfaces_ is None: ifaces = interfaces() elif isinstance(interfaces_, list): ifaces = {} for key, value in six.i...
Returns True if host or (any of) addrs is within specified subnet, otherwise False def in_subnet(cidr, addr=None): ''' Returns True if host or (any of) addrs is within specified subnet, otherwise False ''' try: cidr = ipaddress.ip_network(cidr) except ValueError: log.error('Invalid ...
Return the full list of IP adresses matching the criteria proto = inet|inet6 def _ip_addrs(interface=None, include_loopback=False, interface_data=None, proto='inet'): ''' Return the full list of IP adresses matching the criteria proto = inet|inet6 ''' ret = set() ifaces = interface_data ...
Convert a hex string to an ip, if a failure occurs the original hex is returned. If 'invert=True' assume that ip from /proc/net/<proto> def hex2ip(hex_ip, invert=False): ''' Convert a hex string to an ip, if a failure occurs the original hex is returned. If 'invert=True' assume that ip from /proc/net/<...
Convert a MAC address to a EUI64 identifier or, with prefix provided, a full IPv6 address def mac2eui64(mac, prefix=None): ''' Convert a MAC address to a EUI64 identifier or, with prefix provided, a full IPv6 address ''' # http://tools.ietf.org/html/rfc4291#section-2.5.1 eui64 = re.sub(r'[....
Return a dict describing all active tcp connections as quickly as possible def active_tcp(): ''' Return a dict describing all active tcp connections as quickly as possible ''' ret = {} for statf in ['/proc/net/tcp', '/proc/net/tcp6']: if os.path.isfile(statf): with salt.utils.fi...
Return a set of ip addrs active tcp connections def _remotes_on(port, which_end): ''' Return a set of ip addrs active tcp connections ''' port = int(port) ret = _netlink_tool_remote_on(port, which_end) if ret is not None: return ret ret = set() proc_available = False for s...
Parse a single line from the contents of /proc/net/tcp or /proc/net/tcp6 def _parse_tcp_line(line): ''' Parse a single line from the contents of /proc/net/tcp or /proc/net/tcp6 ''' ret = {} comps = line.strip().split() sl = comps[0].rstrip(':') ret[sl] = {} l_addr, l_port = comps[1].spl...
Returns set of ipv4 host addresses of remote established connections on local or remote tcp port. Parses output of shell 'ss' to get connections [root@salt-master ~]# ss -ant State Recv-Q Send-Q Local Address:Port Peer Address:Port LISTEN 0 511 ...
Returns set of ipv4 host addresses of remote established connections on local tcp port port. Parses output of shell 'sockstat' (NetBSD) to get connections $ sudo sockstat -4 -n USER COMMAND PID FD PROTO LOCAL ADDRESS FOREIGN ADDRESS root python2.7 1456 29 tcp *.4505...
OpenBSD specific helper function. Returns set of ipv4 host addresses of remote established connections on local or remote tcp port. Parses output of shell 'netstat' to get connections $ netstat -nf inet Active Internet connections Proto Recv-Q Send-Q Local Address Foreign Address ...
r''' Windows specific helper function. Returns set of ipv4 host addresses of remote established connections on local or remote tcp port. Parses output of shell 'netstat' to get connections C:\>netstat -n Active Connections Proto Local Address Foreign Address State ...
Linux specific helper function. Returns set of ip host addresses of remote established connections on local tcp port port. Parses output of shell 'lsof' to get connections $ sudo lsof -iTCP:4505 -n COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME Python 9971 root 35...
Generates a MAC address with the defined OUI prefix. Common prefixes: - ``00:16:3E`` -- Xen - ``00:18:51`` -- OpenVZ - ``00:50:56`` -- VMware (manually generated) - ``52:54:00`` -- QEMU/KVM - ``AC:DE:48`` -- PRIVATE References: - http://standards.ieee.org/develop/regauth/oui/ou...
Convert a MAC address string into bytes. Works with or without separators: b1 = mac_str_to_bytes('08:00:27:13:69:77') b2 = mac_str_to_bytes('080027136977') assert b1 == b2 assert isinstance(b1, bytes) def mac_str_to_bytes(mac_str): ''' Convert a MAC address string into bytes. Works with or wit...
Provides a convenient alias for the dns_check filter. def connection_check(addr, port=80, safe=False, ipv6=None): ''' Provides a convenient alias for the dns_check filter. ''' return dns_check(addr, port, safe, ipv6)
Return the ip resolved by dns, but do not exit on failure, only raise an exception. Obeys system preference for IPv4/6 address resolution - this can be overridden by the ipv6 flag. Tries to connect to the address before considering it useful. If no address can be reached, the first one resolved is used ...
Takes a string argument specifying host or host:port. Returns a (hostname, port) or (ip_address, port) tuple. If no port is given, the second (port) element of the returned tuple will be None. host:port argument, for example, is accepted in the forms of: - hostname - hostname:1234 - host...
Verify if hostname conforms to be a FQDN. :param hostname: text string with the name of the host :return: bool, True if hostname is correct FQDN, False otherwise def is_fqdn(hostname): """ Verify if hostname conforms to be a FQDN. :param hostname: text string with the name of the host :return...
List active mounts on Linux systems def _active_mounts(ret): ''' List active mounts on Linux systems ''' _list = _list_mounts() filename = '/proc/self/mounts' if not os.access(filename, os.R_OK): msg = 'File not readable {0}' raise CommandExecutionError(msg.format(filename)) ...
List active mounts on AIX systems def _active_mounts_aix(ret): ''' List active mounts on AIX systems ''' for line in __salt__['cmd.run_stdout']('mount -p').split('\n'): comps = re.sub(r"\s+", " ", line).split() if comps: if comps[0] == 'node' or comps[0] == '--------': ...
List active mounts on FreeBSD systems def _active_mounts_freebsd(ret): ''' List active mounts on FreeBSD systems ''' for line in __salt__['cmd.run_stdout']('mount -p').split('\n'): comps = re.sub(r"\s+", " ", line).split() ret[comps[1]] = {'device': comps[0], 'f...
List active mounts on OpenBSD systems def _active_mounts_openbsd(ret): ''' List active mounts on OpenBSD systems ''' for line in __salt__['cmd.run_stdout']('mount -v').split('\n'): comps = re.sub(r"\s+", " ", line).split() parens = re.findall(r'\((.*?)\)', line, re.DOTALL) if le...
List active mounts on Mac OS systems def _active_mounts_darwin(ret): ''' List active mounts on Mac OS systems ''' for line in __salt__['cmd.run_stdout']('mount').split('\n'): comps = re.sub(r"\s+", " ", line).split() parens = re.findall(r'\((.*?)\)', line, re.DOTALL)[0].split(", ") ...
Resolve user and group names in related opts def _resolve_user_group_names(opts): ''' Resolve user and group names in related opts ''' name_id_opts = {'uid': 'user.info', 'gid': 'group.info'} for ind, opt in enumerate(opts): if opt.split('=')[0] in name_id_opts: ...
List the active mounts. CLI Example: .. code-block:: bash salt '*' mount.active def active(extended=False): ''' List the active mounts. CLI Example: .. code-block:: bash salt '*' mount.active ''' ret = {} if __grains__['os'] == 'FreeBSD': _active_mounts...
.. versionchanged:: 2016.3.2 List the contents of the fstab CLI Example: .. code-block:: bash salt '*' mount.fstab def fstab(config='/etc/fstab'): ''' .. versionchanged:: 2016.3.2 List the contents of the fstab CLI Example: .. code-block:: bash salt '*' mount.fst...
.. versionchanged:: 2016.3.2 Remove the mount point from the fstab CLI Example: .. code-block:: bash salt '*' mount.rm_fstab /mnt/foo /dev/sdg def rm_fstab(name, device, config='/etc/fstab'): ''' .. versionchanged:: 2016.3.2 Remove the mount point from the fstab CLI Example: ...
Verify that this mount is represented in the fstab, change the mount to match the data passed, or add the mount if it is not present. CLI Example: .. code-block:: bash salt '*' mount.set_fstab /mnt/foo /dev/sdz1 ext4 def set_fstab( name, device, fstype, opts='defa...
Remove the mount point from the auto_master CLI Example: .. code-block:: bash salt '*' mount.rm_automaster /mnt/foo /dev/sdg def rm_automaster(name, device, config='/etc/auto_salt'): ''' Remove the mount point from the auto_master CLI Example: .. code-block:: bash salt '*'...
Verify that this mount is represented in the auto_salt, change the mount to match the data passed, or add the mount if it is not present. CLI Example: .. code-block:: bash salt '*' mount.set_automaster /mnt/foo /dev/sdz1 ext4 def set_automaster( name, device, fstype, ...
List the contents of the auto master CLI Example: .. code-block:: bash salt '*' mount.automaster def automaster(config='/etc/auto_salt'): ''' List the contents of the auto master CLI Example: .. code-block:: bash salt '*' mount.automaster ''' ret = {} if not os...
Mount a device CLI Example: .. code-block:: bash salt '*' mount.mount /mnt/foo /dev/sdz1 True def mount(name, device, mkmnt=False, fstype='', opts='defaults', user=None, util='mount'): ''' Mount a device CLI Example: .. code-block:: bash salt '*' mount.mount /mnt/foo /dev/...
Attempt to remount a device, if the device is not already mounted, mount is called CLI Example: .. code-block:: bash salt '*' mount.remount /mnt/foo /dev/sdz1 True def remount(name, device, mkmnt=False, fstype='', opts='defaults', user=None): ''' Attempt to remount a device, if the devic...
Attempt to unmount a device by specifying the directory it is mounted on CLI Example: .. code-block:: bash salt '*' mount.umount /mnt/foo .. versionadded:: 2015.5.0 .. code-block:: bash salt '*' mount.umount /mnt/foo /dev/xvdc1 def umount(name, device=None, user=None, util='mount')...
Returns true if the command passed is a fuse mountable application. CLI Example: .. code-block:: bash salt '*' mount.is_fuse_exec sshfs def is_fuse_exec(cmd): ''' Returns true if the command passed is a fuse mountable application. CLI Example: .. code-block:: bash salt '*'...
Return a dict containing information on active swap .. versionchanged:: 2016.3.2 CLI Example: .. code-block:: bash salt '*' mount.swaps def swaps(): ''' Return a dict containing information on active swap .. versionchanged:: 2016.3.2 CLI Example: .. code-block:: bash ...
Activate a swap disk .. versionchanged:: 2016.3.2 CLI Example: .. code-block:: bash salt '*' mount.swapon /root/swapfile def swapon(name, priority=None): ''' Activate a swap disk .. versionchanged:: 2016.3.2 CLI Example: .. code-block:: bash salt '*' mount.swapon...
Deactivate a named swap mount .. versionchanged:: 2016.3.2 CLI Example: .. code-block:: bash salt '*' mount.swapoff /root/swapfile def swapoff(name): ''' Deactivate a named swap mount .. versionchanged:: 2016.3.2 CLI Example: .. code-block:: bash salt '*' mount.s...
.. versionadded:: 2018.3.0 Provide information if the path is mounted CLI Example: .. code-block:: bash salt '*' mount.read_mount_cache /mnt/share def read_mount_cache(name): ''' .. versionadded:: 2018.3.0 Provide information if the path is mounted CLI Example: .. code-bl...
.. versionadded:: 2018.3.0 Provide information if the path is mounted :param real_name: The real name of the mount point where the device is mounted. :param device: The device that is being mounted. :param mkmnt: Whether or not the mount point should be created. :param fstype: ...
.. versionadded:: 2018.3.0 Provide information if the path is mounted CLI Example: .. code-block:: bash salt '*' mount.delete_mount_cache /mnt/share def delete_mount_cache(real_name): ''' .. versionadded:: 2018.3.0 Provide information if the path is mounted CLI Example: ....
Return the contents of the filesystems in an OrderedDict config File containing filesystem infomation leading_key True return dictionary keyed by 'name' and value as dictionary with other keys, values (name excluded) OrderedDict({ '/dir' : OrderedDict({'dev': '/dev/hd8', ......
.. versionadded:: 2018.3.3 List the contents of the filesystems CLI Example: .. code-block:: bash salt '*' mount.filesystems def filesystems(config='/etc/filesystems'): ''' .. versionadded:: 2018.3.3 List the contents of the filesystems CLI Example: .. code-block:: bash ...
.. versionadded:: 2018.3.3 Verify that this mount is represented in the filesystems, change the mount to match the data passed, or add the mount if it is not present on AIX Provide information if the path is mounted :param name: The name of the mount point where the device is mounted. ...
.. versionadded:: 2018.3.3 Remove the mount point from the filesystems CLI Example: .. code-block:: bash salt '*' mount.rm_filesystems /mnt/foo /dev/sdg def rm_filesystems(name, device, config='/etc/filesystems'): ''' .. versionadded:: 2018.3.3 Remove the mount point from the files...
Returns an instance with just those keys def pick(self, keys): ''' Returns an instance with just those keys ''' subset = dict([(key, self.criteria[key]) for key in keys]) return self.__class__(**subset)
Compare potentially partial criteria against line def match(self, line): ''' Compare potentially partial criteria against line ''' entry = self.dict_from_line(line) for key, value in six.iteritems(self.criteria): if entry[key] != value: return False ...
Compare potentially partial criteria against built filesystems entry dictionary def match(self, fsys_view): ''' Compare potentially partial criteria against built filesystems entry dictionary ''' evalue_dict = fsys_view[1] for key, value in six.viewitems(self.criteria): ...
Returns the __virtual__. def virtual(opts, virtualname, filename): ''' Returns the __virtual__. ''' if ((HAS_NAPALM and NAPALM_MAJOR >= 2) or HAS_NAPALM_BASE) and (is_proxy(opts) or is_minion(opts)): return virtualname else: return ( False, ( ...
Calls arbitrary methods from the network driver instance. Please check the readthedocs_ page for the updated list of getters. .. _readthedocs: http://napalm.readthedocs.org/en/latest/support/index.html#getters-support-matrix method Specifies the name of the method to be called. *args ...
Returns the options of the napalm device. :pram: opts :return: the network device opts def get_device_opts(opts, salt_obj=None): ''' Returns the options of the napalm device. :pram: opts :return: the network device opts ''' network_device = {} # by default, look in the proxy config ...
Initialise the connection with the network device through NAPALM. :param: opts :return: the network device object def get_device(opts, salt_obj=None): ''' Initialise the connection with the network device through NAPALM. :param: opts :return: the network device object ''' log.debug('Set...
This decorator is used to make the execution module functions available outside a proxy minion, or when running inside a proxy minion. If we are running in a proxy, retrieve the connection details from the __proxy__ injected variable. If we are not, then use the connection information from the opts. ...
Return the final state output. ret The initial state output structure. loaded The loaded dictionary. def loaded_ret(ret, loaded, test, debug, compliance_report=False, opts=None): ''' Return the final state output. ret The initial state output structure. loaded Th...
Api to listen for webhooks to send to the reactor. Implement the webhook behavior in an engine. :py:class:`rest_cherrypy Webhook docs <salt.netapi.rest_cherrypy.app.Webhook>` Unlike the rest_cherrypy Webhook, this is only an unauthenticated webhook endpoint. If an authenticated webhook endpoint is ne...
Ensure Microsoft Updates are installed. Updates will be downloaded if needed. Args: name (str): The identifier of a single update to install. updates (list): A list of identifiers for updates to be installed. Overrides ``name``. Default is None. .. not...
Ensure Microsoft Updates are uninstalled. Args: name (str): The identifier of a single update to uninstall. updates (list): A list of identifiers for updates to be removed. Overrides ``name``. Default is None. .. note:: Identifiers can be the GUID, the KB ...
Ensure Microsoft Updates that match the passed criteria are installed. Updates will be downloaded if needed. This state allows you to update a system without specifying a specific update to apply. All matching updates will be installed. Args: name (str): The name has no functional...
Graylog 'raw' format is essentially the raw record, minimally munged to provide the bare minimum that td-agent requires to accept and route the event. This is well suited to a config where the client td-agents log directly to Graylog. def format_graylog_v0(self, record): ''' Graylog 'r...
Messages are formatted in logstash's expected format. def format_logstash_v0(self, record): ''' Messages are formatted in logstash's expected format. ''' host = salt.utils.network.get_fqhostname() message_dict = { '@timestamp': self.formatTime(record), '@...
List all connected minions on a salt-master def connected(): ''' List all connected minions on a salt-master ''' opts = salt.config.master_config(__opts__['conf_file']) if opts.get('con_cache'): cache_cli = CacheCli(opts) minions = cache_cli.get_cached() else: minions =...
Return the first configured instance. def get_configured_provider(): ''' Return the first configured instance. ''' return config.is_provider_configured( opts=__opts__, provider=__active_provider_name__ or __virtualname__, aliases=__virtual_aliases__, required_keys=('pers...
Return a dict of all available VM locations on the cloud provider with relevant data def avail_locations(call=None): ''' Return a dict of all available VM locations on the cloud provider with relevant data ''' if call == 'action': raise SaltCloudSystemExit( 'The avail_locati...
Return a list of the images that are on the provider def avail_images(call=None): ''' Return a list of the images that are on the provider ''' if call == 'action': raise SaltCloudSystemExit( 'The avail_images function must be called with ' '-f or --function, or with the ...
Return a list of the image sizes that are on the provider def avail_sizes(call=None): ''' Return a list of the image sizes that are on the provider ''' if call == 'action': raise SaltCloudSystemExit( 'The avail_sizes function must be called with ' '-f or --function, or w...
Return a list of the VMs that are on the provider def list_nodes_full(call=None, for_output=True): ''' Return a list of the VMs that are on the provider ''' if call == 'action': raise SaltCloudSystemExit( 'The list_nodes_full function must be called with -f or --function.' )...
Return the image object to use def get_image(vm_): ''' Return the image object to use ''' images = avail_images() vm_image = config.get_cloud_config_value( 'image', vm_, __opts__, search_global=False ) if not isinstance(vm_image, six.string_types): vm_image = six.text_type(v...
Return the VM's size. Used by create_node(). def get_size(vm_): ''' Return the VM's size. Used by create_node(). ''' sizes = avail_sizes() vm_size = six.text_type(config.get_cloud_config_value( 'size', vm_, __opts__, search_global=False )) for size in sizes: if vm_size.lower...
Return the VM's location def get_location(vm_): ''' Return the VM's location ''' locations = avail_locations() vm_location = six.text_type(config.get_cloud_config_value( 'location', vm_, __opts__, search_global=False )) for location in locations: if vm_location in (location...
Create a single VM from a data dict def create(vm_): ''' Create a single VM from a data dict ''' try: # Check for required profile parameters before sending any API calls. if vm_['profile'] and config.is_profile_configured(__opts__, ...
Make a web call to DigitalOcean def query(method='droplets', droplet_id=None, command=None, args=None, http_method='get'): ''' Make a web call to DigitalOcean ''' base_path = six.text_type(config.get_cloud_config_value( 'api_root', get_configured_provider(), __opts__, se...
Show the details from DigitalOcean concerning a droplet def show_instance(name, call=None): ''' Show the details from DigitalOcean concerning a droplet ''' if call != 'action': raise SaltCloudSystemExit( 'The show_instance action must be called with -a or --action.' ) no...
Return a dict of all available VM locations on the cloud provider with relevant data def list_keypairs(call=None): ''' Return a dict of all available VM locations on the cloud provider with relevant data ''' if call != 'function': log.error( 'The list_keypairs function must ...
Show the details of an SSH keypair def show_keypair(kwargs=None, call=None): ''' Show the details of an SSH keypair ''' if call != 'function': log.error( 'The show_keypair function must be called with -f or --function.' ) return False if not kwargs: kwar...
Upload public key to cloud provider. Similar to EC2 import_keypair. .. versionadded:: 2016.11.0 kwargs file(mandatory): public key file-name keyname(mandatory): public key name in the provider def import_keypair(kwargs=None, call=None): ''' Upload public key to cloud provider. ...
Upload a public key def create_key(kwargs=None, call=None): ''' Upload a public key ''' if call != 'function': log.error( 'The create_key function must be called with -f or --function.' ) return False try: result = query( method='account', ...
Return the ID of the keyname def get_keyid(keyname): ''' Return the ID of the keyname ''' if not keyname: return None keypairs = list_keypairs(call='function') keyid = keypairs[keyname]['id'] if keyid: return keyid raise SaltCloudNotFound('The specified ssh key could not...
Destroy a node. Will check termination protection and warn if enabled. CLI Example: .. code-block:: bash salt-cloud --destroy mymachine def destroy(name, call=None): ''' Destroy a node. Will check termination protection and warn if enabled. CLI Example: .. code-block:: bash ...
Creates a DNS record for the given name if the domain is managed with DO. def post_dns_record(**kwargs): ''' Creates a DNS record for the given name if the domain is managed with DO. ''' if 'kwargs' in kwargs: # flatten kwargs if called via salt-cloud -f f_kwargs = kwargs['kwargs'] del...
Deletes DNS records for the given hostname if the domain is managed with DO. def destroy_dns_records(fqdn): ''' Deletes DNS records for the given hostname if the domain is managed with DO. ''' domain = '.'.join(fqdn.split('.')[-2:]) hostname = '.'.join(fqdn.split('.')[:-2]) # TODO: remove this ...
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-digitalocean-config profile=my-profile def show_pricing(kwargs=None, call=None): ''' Show...
Show the details of a floating IP .. versionadded:: 2016.3.0 CLI Examples: .. code-block:: bash salt-cloud -f show_floating_ip my-digitalocean-config floating_ip='45.55.96.47' def show_floating_ip(kwargs=None, call=None): ''' Show the details of a floating IP .. versionadded:: 2016...
Create a new floating IP .. versionadded:: 2016.3.0 CLI Examples: .. code-block:: bash salt-cloud -f create_floating_ip my-digitalocean-config region='NYC2' salt-cloud -f create_floating_ip my-digitalocean-config droplet_id='1234567' def create_floating_ip(kwargs=None, call=None): ...
Delete a floating IP .. versionadded:: 2016.3.0 CLI Examples: .. code-block:: bash salt-cloud -f delete_floating_ip my-digitalocean-config floating_ip='45.55.96.47' def delete_floating_ip(kwargs=None, call=None): ''' Delete a floating IP .. versionadded:: 2016.3.0 CLI Examples...
Unassign a floating IP .. versionadded:: 2016.3.0 CLI Examples: .. code-block:: bash salt-cloud -f unassign_floating_ip my-digitalocean-config floating_ip='45.55.96.47' def unassign_floating_ip(kwargs=None, call=None): ''' Unassign a floating IP .. versionadded:: 2016.3.0 CLI ...
Helper function to format and parse node data. def _list_nodes(full=False, for_output=False): ''' Helper function to format and parse node data. ''' fetch = True page = 1 ret = {} while fetch: items = query(method='droplets', command='?page=' + six.text_type(p...
Reboot a droplet in DigitalOcean. .. versionadded:: 2015.8.8 name The name of the droplet to restart. CLI Example: .. code-block:: bash salt-cloud -a reboot droplet_name def reboot(name, call=None): ''' Reboot a droplet in DigitalOcean. .. versionadded:: 2015.8.8 ...
Helper function for _list_nodes to loop through all node information. Returns a dictionary containing the full information of a node. def _get_full_output(node, for_output=False): ''' Helper function for _list_nodes to loop through all node information. Returns a dictionary containing the full informat...
Helper function for list_nodes. Returns public and private ip lists based on a given network dictionary. def _get_ips(networks): ''' Helper function for list_nodes. Returns public and private ip lists based on a given network dictionary. ''' v4s = networks.get('v4') v6s = networks.get('v6')...
Adds a cluster to the Postgres server. .. warning: Only works for debian family distros so far. CLI Example: .. code-block:: bash salt '*' postgres.cluster_create '9.3' salt '*' postgres.cluster_create '9.3' 'main' salt '*' postgres.cluster_create '9.3' locale='fr_FR' ...
Return a list of cluster of Postgres server (tuples of version and name). CLI Example: .. code-block:: bash salt '*' postgres.cluster_list salt '*' postgres.cluster_list verbose=True def cluster_list(verbose=False): ''' Return a list of cluster of Postgres server (tuples of version ...