Skip to content

Commit

Permalink
Merge pull request #328 from amousset/ust_7879/add_documentation_for_…
Browse files Browse the repository at this point in the history
…ncf_generic_methods

Fixes #7879: Add documentation for ncf generic methods
  • Loading branch information
peckpeck committed Mar 14, 2016
2 parents 652c4f8 + 6087ada commit ba2887e
Show file tree
Hide file tree
Showing 65 changed files with 61 additions and 112 deletions.
1 change: 0 additions & 1 deletion tree/30_generic_methods/command_execution.cf
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
#
# @class_prefix command_execution
# @class_parameter command_name
# This bundle will define a class command_execution_${command_name}_{kept,repaired,not_ok,ok,reached}

bundle agent command_execution(command_name)
{
Expand Down
9 changes: 4 additions & 5 deletions tree/30_generic_methods/command_execution_result.cf
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,17 @@

# @name Command execution result
# @description Execute a command and create outcome classes depending on its exit code
# @documentation Execute a command and create outcome classes
# depending on the exit codes given in parameters.
# If an exit code is not in the list it will lead to an error status.
# If you want 0 to be a success you have to list it in the kept_codes list
#
# @parameter command The command to run
# @parameter kept_codes List of codes that produce a kept status separated with commas (ex: 1,2,5)
# @parameter repaired_codes List of codes that produce a repaired status separated with commas (ex: 3,4,6)
#
# @class_prefix command_execution_result
# @class_parameter command
#
# This bundle will define a class command_execution_result_${command}_{kept,repaired,not_ok,ok,reached}
# depending on the exit codes given in parameters.
# If an exit code is not in the list it will lead to an error status.
# If you want 0 to be a success you have to list it in the kept_codes list

bundle agent command_execution_result(command, kept_codes, repaired_codes)
{
Expand Down
6 changes: 3 additions & 3 deletions tree/30_generic_methods/directory_check_exists.cf
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@

# @name Directory check exists
# @description Checks if a directory exists
# @documentation This bundle will define a class directory_check_exists_${directory_name}_{ok, reached, kept} if the
# directory exists, or directory_check_exists_${directory_name}_{not_ok, reached, not_kept, failed} if
# the directory doesn't exists
#
# @parameter directory_name Full path of the directory to check
#
# @class_prefix directory_check_exists
# @class_parameter directory_name
# This bundle will define a class directory_check_exists_${directory_name}_{ok, reached, kept} if the
# directory exists, or directory_check_exists_${directory_name}_{not_ok, reached, not_kept, failed} if
# the directory doesn't exists

bundle agent directory_check_exists(directory_name)
{
Expand Down
1 change: 0 additions & 1 deletion tree/30_generic_methods/directory_create.cf
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
#
# @class_prefix directory_create
# @class_parameter target
# This bundle will define a class directory_create_${target}_{kept,repaired,not_ok,ok,reached}

bundle agent directory_create(target)
{
Expand Down
6 changes: 3 additions & 3 deletions tree/30_generic_methods/file_check_exists.cf
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@

# @name File check exists
# @description Checks if a file exists
# @documentation This bundle will define a class file_check_exists_${file_name}_{ok, reached, kept} if the
# file exists, or file_check_exists_${file_name}_{not_ok, reached, not_kept, failed} if
# the file doesn't exists
#
# @parameter file_name File name
#
# @class_prefix file_check_exists
# @class_parameter file_name
# This bundle will define a class file_check_exists_${file_name}_{ok, reached, kept} if the
# file exists, or file_check_exists_${file_name}_{not_ok, reached, not_kept, failed} if
# the file doesn't exists

bundle agent file_check_exists(file_name)
{
Expand Down
1 change: 0 additions & 1 deletion tree/30_generic_methods/file_copy_from_local_source.cf
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
#
# @class_prefix file_copy_from_local_source
# @class_parameter destination
# This bundle will define a class file_copy_from_local_source_${destination}_{kept,repaired,not_ok,ok,reached}

bundle agent file_copy_from_local_source(source, destination)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
#
# @class_prefix file_copy_from_local_source
# @class_parameter destination
# This bundle will define a class file_copy_from_local_source_${destination}_{kept,repaired,not_ok,ok,reached}

bundle agent file_copy_from_local_source_recursion(source, destination, recursion)
{
Expand Down
1 change: 0 additions & 1 deletion tree/30_generic_methods/file_copy_from_remote_source.cf
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
#
# @class_prefix file_copy_from_remote_source
# @class_parameter destination
# This bundle will define a class file_copy_from_remote_source_${destination}_{kept,repaired,not_ok,ok,reached}

bundle agent file_copy_from_remote_source(source, destination)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
#
# @class_prefix file_copy_from_remote_source
# @class_parameter destination
# This bundle will define a class file_copy_from_remote_source_${destination}_{kept,repaired,not_ok,ok,reached}

bundle agent file_copy_from_remote_source_recursion(source, destination, recursion)
{
Expand Down
1 change: 0 additions & 1 deletion tree/30_generic_methods/file_create.cf
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
#
# @class_prefix file_create
# @class_parameter target
# This bundle will define a class file_create_${target}_{kept,repaired,not_ok,ok,reached}

bundle agent file_create(target)
{
Expand Down
1 change: 0 additions & 1 deletion tree/30_generic_methods/file_create_symlink.cf
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
#
# @class_prefix file_create_symlink
# @class_parameter destination
# This bundle will define a class file_create_symlink_${destination}_{kept,repaired,not_ok,ok,reached}

bundle agent file_create_symlink(source, destination)
{
Expand Down
1 change: 0 additions & 1 deletion tree/30_generic_methods/file_create_symlink_enforce.cf
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
#
# @class_prefix file_create_symlink
# @class_parameter destination
# This bundle will define a class file_create_symlink_${destination}_{kept,repaired,not_ok,ok,reached}

bundle agent file_create_symlink_enforce(source, destination, enforce)
{
Expand Down
1 change: 0 additions & 1 deletion tree/30_generic_methods/file_create_symlink_force.cf
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
#
# @class_prefix file_create_symlink
# @class_parameter destination
# This bundle will define a class file_create_symlink_${destination}_{kept,repaired,not_ok,ok,reached}

bundle agent file_create_symlink_force(source, destination)
{
Expand Down
5 changes: 4 additions & 1 deletion tree/30_generic_methods/file_download.cf
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,16 @@

# @name File download
# @description Download a file if it does not exit, using curl with a fallback on wget
# @documentation This method finds a HTTP command-line tool and downloads the given source
# into the destination.
#
# It tries `curl` first, and `wget` as fallback.
#
# @parameter source URL to download from
# @parameter destination File destination
#
# @class_prefix file_download
# @class_parameter destination
# This bundle will define a class file_download_${destination}_{kept,repaired,not_ok,ok,reached}

bundle agent file_download(source, destination)
{
Expand Down
1 change: 0 additions & 1 deletion tree/30_generic_methods/file_enforce_content.cf
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
#
# @class_prefix file_ensure_lines_present
# @class_parameter file
# This bundle will define a class file_ensure_lines_present_${file}_{kept,repaired,not_ok,ok,reached}

bundle agent file_enforce_content(file, lines, enforce)
{
Expand Down
3 changes: 1 addition & 2 deletions tree/30_generic_methods/file_ensure_block_in_section.cf
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@
#
# @class_prefix file_ensure_block_in_section
# @class_parameter file
#
# This bundle will define a class file_ensure_block_in_section_${file}_{kept,repaired,not_ok,ok,reached}

bundle agent file_ensure_block_in_section(file, section_start, section_end, block)
{
vars:
Expand Down
3 changes: 1 addition & 2 deletions tree/30_generic_methods/file_ensure_block_present.cf
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@
#
# @class_prefix file_ensure_block_present
# @class_parameter file
#
# This bundle will define a class file_ensure_block_present_${file}_{kept,repaired,not_ok,ok,reached}

bundle agent file_ensure_block_present(file, block)
{
vars:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@
#
# @class_prefix file_ensure_key_value_present_in_ini_section
# @class_parameter file
#
# This bundle will define a class file_ensure_key_value_present_in_ini_section_${file}_{kept,repaired,not_ok,ok,not_ok,reached}

bundle agent file_ensure_key_value_present_in_ini_section(file, section, name, value)
{
Expand Down
2 changes: 0 additions & 2 deletions tree/30_generic_methods/file_ensure_keys_values.cf
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@
#
# @class_prefix file_ensure_keys_values
# @class_parameter file
#
# This bundle will define a class file_ensure_keys_values_${file}_{kept,repaired,not_ok,ok,reached}

bundle agent file_ensure_keys_values(file, keys, separator)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@
#
# @class_prefix file_ensure_line_present_in_ini_section
# @class_parameter file
#
# This bundle will define a class file_ensure_line_present_in_ini_section_${file}_{kept,repaired,not_ok,ok,not_ok,reached}

bundle agent file_ensure_line_present_in_ini_section(file, section, line)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@
#
# @class_prefix file_ensure_line_present_in_xml_tag
# @class_parameter file
#
# This bundle will define a class file_ensure_line_present_in_xml_tag_${file}_{kept,repaired,failed,ok,not_ok,reached}

bundle agent file_ensure_line_present_in_xml_tag(file, tag, line)
{
Expand Down
1 change: 0 additions & 1 deletion tree/30_generic_methods/file_ensure_lines_absent.cf
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
#
# @class_prefix file_ensure_lines_absent
# @class_parameter file
# This bundle will define a class file_ensure_lines_absent_${file}_{kept,repaired,not_ok,ok,reached}

bundle agent file_ensure_lines_absent(file, lines)
{
Expand Down
1 change: 0 additions & 1 deletion tree/30_generic_methods/file_ensure_lines_present.cf
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
#
# @class_prefix file_ensure_lines_present
# @class_parameter file
# This bundle will define a class file_ensure_lines_present_${file}_{kept,repaired,not_ok,ok,reached}

bundle agent file_ensure_lines_present(file, lines)
{
Expand Down
1 change: 0 additions & 1 deletion tree/30_generic_methods/file_from_template.cf
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
#
# @class_prefix file_from_template
# @class_parameter destination
# This bundle will define a class file_from_template_${destination}_{kept,repaired,not_ok,ok,reached}

bundle agent file_from_template(source_template, destination)
{
Expand Down
1 change: 0 additions & 1 deletion tree/30_generic_methods/file_from_template_mustache.cf
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
#
# @class_prefix file_from_template
# @class_parameter destination
# This bundle will define a class file_from_template_${destination}_{kept,repaired,not_ok,ok,reached}

bundle agent file_from_template_mustache(source_template, destination)
{
Expand Down
1 change: 0 additions & 1 deletion tree/30_generic_methods/file_from_template_type.cf
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
#
# @class_prefix file_from_template
# @class_parameter destination
# This bundle will define a class file_from_template_${destination}_{kept,repaired,not_ok,ok,reached}

bundle agent file_from_template_type(source_template, destination, template_type)
{
Expand Down
1 change: 0 additions & 1 deletion tree/30_generic_methods/file_remove.cf
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
#
# @class_prefix file_remove
# @class_parameter target
# This bundle will define a class file_remove_${target}_{kept,repaired,not_ok,ok,reached}

bundle agent file_remove(target)
{
Expand Down
2 changes: 0 additions & 2 deletions tree/30_generic_methods/file_replace_lines.cf
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@
#
# @class_prefix file_replace_lines
# @class_parameter file
#
# This bundle will define a class file_replace_lines_${file}_{kept,repaired,not_ok,ok,reached}

bundle agent file_replace_lines(file, line, replacement)
{
Expand Down
2 changes: 0 additions & 2 deletions tree/30_generic_methods/file_template_expand.cf
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@
#
# @class_prefix file_template_expand
# @class_parameter target_file
#
# This bundle will define a class file_template_expand_${target_file}_{kept,repaired,not_ok,ok,reached}

bundle agent file_template_expand(tml_file, target_file, mode, owner, group)
{
Expand Down
1 change: 0 additions & 1 deletion tree/30_generic_methods/group_absent.cf
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@

# @class_prefix group_absent
# @class_parameter group
# This bundle will define a class group_absent_${group}_{kept,repaired,not_ok,ok,reached}

bundle agent group_absent(group)
{
Expand Down
1 change: 0 additions & 1 deletion tree/30_generic_methods/group_present.cf
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@

# @class_prefix group_present
# @class_parameter group
# This bundle will define a class group_present_${group}_{kept,repaired,not_ok,ok,reached}

bundle agent group_present(group)
{
Expand Down
4 changes: 2 additions & 2 deletions tree/30_generic_methods/http_request_check_status_headers.cf
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
#####################################################################################

# @name HTTP request check status with headers
# @description Perform a HTTP request on the URL, method and headers provided and check that the response has the expected status code (ie 200, 404, 503, etc)
# @description Checks status of an HTTP URL
# @documentation Perform a HTTP request on the URL, method and headers provided and check that the response has the expected status code (ie 200, 404, 503, etc)
#
# @parameter method Method to call the URL (GET, POST, PUT, DELETE)
# @parameter url URL to query
Expand All @@ -26,7 +27,6 @@

# @class_prefix http_request_check_status_headers
# @class_parameter url
# This bundle will define a class http_request_check_status_headers_${url}_{kept,not_ok,ok,reached}

bundle agent http_request_check_status_headers(method, url, expected_status, headers)
{
Expand Down
5 changes: 3 additions & 2 deletions tree/30_generic_methods/http_request_content_headers.cf
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@
#####################################################################################

# @name HTTP request sending content with headers
# @description Perform a HTTP request on the URL, method and headers provided and send the content provided. Will return an error if the request failed.
# @description Make an HTTP request with a specific header
# @documentation Perform a HTTP request on the URL, method and headers provided
# and send the content provided. Will return an error if the request failed.
#
# @parameter method Method to call the URL (POST, PUT)
# @parameter url URL to send content to
Expand All @@ -26,7 +28,6 @@

# @class_prefix http_content_headers
# @class_parameter url
# This bundle will define a class http_content_headers_${url}_{repaired,not_ok,ok,reached}

bundle agent http_request_content_headers(method, url, content, headers)
{
Expand Down
7 changes: 3 additions & 4 deletions tree/30_generic_methods/package_check_installed.cf
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,15 @@

# @name Package check installed
# @description Verify if a package is installed in any version
# @documentation This bundle will define a class package_check_installed_${file_name}_{ok, reached, kept} if the
# package is installed, or package_check_installed_${file_name}_{not_ok, reached, not_kept, failed} if
# the package is not installed
#
# @parameter package_name Name of the package to check
#
# @class_prefix package_check_installed
# @class_parameter package_name

# This bundle will define a class package_check_installed_${file_name}_{ok, reached, kept} if the
# package is installed, or package_check_installed_${file_name}_{not_ok, reached, not_kept, failed} if
# the package is not installed

bundle agent package_check_installed(package_name)
{
vars:
Expand Down
1 change: 0 additions & 1 deletion tree/30_generic_methods/package_install.cf
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
#
# @class_prefix package_install
# @class_parameter package_name
# This bundle will define a class package_install_${package_name}_{kept,repaired,not_ok,ok,reached}

bundle agent package_install(package_name)
{
Expand Down
1 change: 0 additions & 1 deletion tree/30_generic_methods/package_install_version.cf
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
#
# @class_prefix package_install
# @class_parameter package_name
# This bundle will define a class package_install_${package_name}_{kept,repaired,not_ok,ok,reached}

bundle agent package_install_version(package_name, package_version)
{
Expand Down
10 changes: 5 additions & 5 deletions tree/30_generic_methods/package_install_version_cmp.cf
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@

# @name Package install version compare
# @description Install a package or verify if it is installed in a specific version, or higher or lower version than a version specified
# @documentation *Example*:
# ```
# methods:
# "any" usebundle => package_install_version_cmp("postgresql", ">=", "9.1", "verify");
# ```
#
# @parameter package_name Name of the package to install or verify
# @parameter version_comparator Comparator between installed version and defined version, can be ==,<=,>=,<,>,!=
Expand All @@ -26,11 +31,6 @@
#
# @class_prefix package_install
# @class_parameter package_name
# This bundle will define a class package_install_${package_name}_{kept,repaired,not_ok,ok,reached}
#
# Usage example:
# methods:
# "any" usebundle => package_install_version_cmp("postgresql", ">=", "9.1", "verify");

bundle agent package_install_version_cmp(package_name, version_comparator, package_version, action)
{
Expand Down
Loading

0 comments on commit ba2887e

Please sign in to comment.