Index
- containsElement
- network_detection
- check_network_connection_to_host
- network_check
- log_to_file
- noroot
- vvv_apt_keys_has
- vvv_src_list_has
- vvv_format_output
- vvv_output
- vvv_info
- vvv_error
- vvv_warn
- vvv_success
- get_config_value
- get_config_values
- get_config_type
- get_config_keys
- vvv_add_hook
- vvv_hook
- vvv_parallel_hook
- vvv_apt_update
- vvv_apt_packages_upgrade
- vvv_apt_cleanup
- vvv_package_install
- vvv_is_apt_pkg_installed
- vvv_cleanup_dpkg_locks
- vvv_apt_package_remove
- vvv_maybe_install_nginx_config
- vvv_get_sites
- vvv_update_guest_hosts
- vvv_safe_sed
- vvv_search_replace
- vvv_search_replace_in_file
containsElement
Does a bash array contain a value?
Arguments
- $1 (string): The value to search for
- $2 (string): The list/array to search in
Exit codes
- 0: If the list contains the element
- 1: If the list does not containn the element
network_detection
Test that we have network connectivity with a URL. Deprecated, use check_network_connection_to_host instead
Arguments
- $1 (string): The address to test
See also
check_network_connection_to_host
Test that we have network connectivity with a URL.
Arguments
- $1 (string): The address to test, defaults to
https://ppa.launchpadcontent.net
Exit codes
- 0: If the address is reachable
- 1: If network issues are found
network_check
Tests network connectivity with several hosts needed for provisioning
Function has no arguments.
See also
log_to_file
Redirects stdout to a log file in the provisioner log folder
Arguments
- $1 (string): name of the provisioner
noroot
Run a command that cannot be ran as root
vvv_apt_keys_has
Tests if an apt-key has been added
Arguments
- $1 (string): a key string to test
vvv_src_list_has
Tests if an apt-source has been added
Arguments
- $1 (string): a source to test for
vvv_format_output
Takes an input string and attempts to apply terminal formatting for various colours
Example
MSG=$(vvv_format_output "<success>green!</success>, <error>red :(</error>, <url>example.com</url></>normal text")
Arguments
- $1 (string): Text to format
vvv_output
Output to the terminal, and log to a provisioner log at the same time, with applied formatting
Arguments
- $1 (string): The message to print
vvv_info
Prints an information message
Arguments
- $1 (string): The message to print
vvv_error
Prints out an error message
Arguments
- $1 (string): The message to print
vvv_warn
Prints our a warning message
Arguments
- $1 (string): The message to print
vvv_success
Prints out a success message
Arguments
- $1 (string): The message to print
get_config_value
Retrieves a config value from the main config YAML file
Uses shyaml get-value
internally
Arguments
- $1 (string): the path/key to read from, e.g. sites.wordpress-one.repo
- $2 (string): a default value to fall back upon
get_config_values
Retrieves config values from the main config YAML file
Uses shyaml get-values
internally
Arguments
- $1 (string): the path/key to read from, e.g. sites.wordpress-one.hosts
- $2 (string): a default value to fall back upon
get_config_type
Retrieves the type of a config value from the main config YAML file
Uses shyaml get-type
internally
Arguments
- $1 (string): the path/key to read from, e.g. sites.wordpress-one.repo
get_config_keys
Retrieves config keys from the main config YAML file
Uses shyaml keys
internally
Arguments
- $1 (string): the path/key to read from, e.g. sites.wordpress-one.repo
- $2 (string): a default value to fall back upon
vvv_add_hook
Add a bash function to execute on a hook
Example
vvv_add_hook init vvv_init_profile 0
Arguments
- $1 (string): the name of the hook
- $2 (string): the name of the bash function to call
- $3 (number): the priority of the function when the hook executes, determines order, lower values execute earlier
vvv_hook
Executes a hook. Functions added to this hook will be executed
Example
vvv_hook before_packages
Arguments
- $1 (string): the hook to execute
vvv_parallel_hook
Executes a hook. Functions added to this hook will be executed in parallel
Example
vvv_parallel_hook before_packages
Arguments
- $1 (string): the hook to execute
vvv_apt_update
Updates Apt keys then fetches Apt updates.
vvv_apt_packages_upgrade
Upgrades all Apt packages.
vvv_apt_cleanup
Performs Apt autoremoval and cleanup.
vvv_package_install
Installs a selection of packages via apt
Example
vvv_package_install wget curl etc
vvv_is_apt_pkg_installed
checks if an apt package is installed, returns 0 if installed, 1 if not
Arguments
- $1 (string): the package to check for
vvv_cleanup_dpkg_locks
cleans up dpkg lock files to avoid provisioning issues based on a fix from https://github.com/Varying-Vagrant-Vagrants/VVV/issues/2150
vvv_apt_package_remove
removes a selection of packages via apt
Example
vvv_apt_package_remove wget curl etc
vvv_maybe_install_nginx_config
Installs an Nginx config file and reload Nginx. If Nginx fails to load after doing this it will print an error and attempt to undo the change.
Example
vvv_maybe_install_nginx_config /tmp/nginx-site-config.conf vvv-site-mysite.conf sites
Arguments
- $1 (string): the path and filename of the nginx config that needs to be installed
- $2 (string): the file name of the config when installed
- $3 (the): type of config, valid values as sites and utilities
vvv_get_sites
Retrieves a list of sites.
Function has no arguments.
vvv_update_guest_hosts
Updates the guest environments hosts file.
Function has no arguments.
vvv_safe_sed
Performs an in place sed command via a temporary file to avoid permission issues
vvv_search_replace
Takes a string and replaces all instances of a token with a value
vvv_search_replace_in_file
Takes a file, and replaces all instances of a token with a value