Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #11766: Rename class to condition in the interface #713

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions builder/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -424,14 +424,14 @@ <h3 >{{getMethodName(selectedMethod)}}
</div>
<form name="CForm.form">
<div class="form-group condition-form">
<label class="control-label" for="advanced">Other classes:</label>
<label class="control-label" for="advanced">Other conditions:</label>
<textarea msd-elastic name="cfClasses" class="form-control" rows="1" id="advanced" ng-pattern="/^\S+$/" ng-model="selectedMethod.advanced_class" ng-change="updateClassContext()"></textarea>
<div ng-messages="CForm.form.cfClasses.$error" role="alert">
<div ng-message="pattern" class="text-danger">This field cannot contain whitespace</div>
</div>
</div>
<div class="form-group condition-form">
<label for="class_context">Class context:</label>
<label for="class_context">Applied condition expression:</label>
<textarea style="cursor:text" msd-elastic name="cfClassContext" class="form-control" rows="1" id="advanced" ng-maxlength="2048" ng-model="selectedMethod.class_context" ng-readonly="true"></textarea>
<span class="text-danger" ng-show="CForm.form.cfClassContext.$error.maxlength">
Classes over 2048 characters are currently not supported.
Expand Down Expand Up @@ -468,7 +468,7 @@ <h5 class="control-label method-param" >{{parameter.name}}:
</div>
<div class="col-md-5 fixed-footer" style="padding-top: 0; border-right:0; padding-bottom: 0;">
<h4 style="text-align:left; margin-top:0px;" class="panel-title">
Result classes defined by this method
Result conditions defined by this method
</h4>
<form class="form-horizontal editForm" name="editForm">
<div class="form-group" style="margin-bottom:3px;margin-top:3px">
Expand Down
2 changes: 1 addition & 1 deletion tree/30_generic_methods/_abort.cf
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
# @parameter reason The reason to abort the agent
# @parameter message The human readable message to display
#
# As this ends with an abort, we define no classes
# As this ends with an abort, we define no result conditions
#

bundle agent _abort(reason, message)
Expand Down
2 changes: 1 addition & 1 deletion tree/30_generic_methods/_abort_default.cf
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
# @parameter reason The reason to abort the agent
# @parameter message The human readable message to display
#
# As this ends with an abort, we define no classes
# As this ends with an abort, we define no result conditions
#

bundle agent _abort_default(reason, message)
Expand Down
2 changes: 1 addition & 1 deletion tree/30_generic_methods/_classes_combine_four.cf
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

# @name Class combine two
# @description Aggregate 2 class prefix into a new one
# @documentation This bundle will define a class ${destination_prefix}_{kept,repaired,not_ok,ok,reached}
# @documentation This bundle will define a condition ${destination_prefix}_{kept,repaired,not_ok,ok,reached}
# based on ${first_prefix}_{kept,repaired,not_ok,ok,reached} and ${second_prefix}_{kept,repaired,not_ok,ok,reached}
# keeping the worst outcome
#
Expand Down
2 changes: 1 addition & 1 deletion tree/30_generic_methods/_classes_combine_ifthenelse.cf
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

# @name Class combine ifthenelse
# @description Aggregate class outcomes within an if then else structure
# @documentation This bundle will define a class ${destination_prefix}_{kept,repaired,not_ok,ok,reached}
# @documentation This bundle will define a condition ${destination_prefix}_{kept,repaired,not_ok,ok,reached}
# based on the test result and the method called afterwards.
#
# If the 'test' call has a '_true' outcome then the 'then' result is copied to destination
Expand Down
2 changes: 1 addition & 1 deletion tree/30_generic_methods/_classes_combine_three.cf
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

# @name Class combine two
# @description Aggregate 2 class prefix into a new one
# @documentation This bundle will define a class ${destination_prefix}_{kept,repaired,not_ok,ok,reached}
# @documentation This bundle will define a condition ${destination_prefix}_{kept,repaired,not_ok,ok,reached}
# based on ${first_prefix}_{kept,repaired,not_ok,ok,reached} and ${second_prefix}_{kept,repaired,not_ok,ok,reached}
# keeping the worst outcome
#
Expand Down
2 changes: 1 addition & 1 deletion tree/30_generic_methods/_classes_combine_two.cf
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

# @name Class combine two
# @description Aggregate 2 class prefix into a new one
# @documentation This bundle will define a class ${destination_prefix}_{kept,repaired,not_ok,ok,reached}
# @documentation This bundle will define a condition ${destination_prefix}_{kept,repaired,not_ok,ok,reached}
# based on ${first_prefix}_{kept,repaired,not_ok,ok,reached} and ${second_prefix}_{kept,repaired,not_ok,ok,reached}
# keeping the worst outcome
#
Expand Down
2 changes: 1 addition & 1 deletion tree/30_generic_methods/_classes_copy.cf
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

# @name Classes copy
# @description Copy a class prefix to another one, to switch the context from a bundle to another
# @documentation This bundle will define a class ${destination_prefix}_{kept,repaired,not_ok,ok,reached}
# @documentation This bundle will define a condition ${destination_prefix}_{kept,repaired,not_ok,ok,reached}
# based on ${source_prefix}_{kept,repaired,not_ok,ok,reached}
#
# @parameter source_prefix The prefix of the source class to copy
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#
# @parameter source_prefix The prefix of the source class to copy
# @parameter destination_prefix The prefix of the destination class to copy
# @documentation This bundle will define a class ${destination_prefix}_{kept,repaired,not_ok,ok,reached}
# @documentation This bundle will define a condition ${destination_prefix}_{kept,repaired,not_ok,ok,reached}
# based on an inverted ${source_prefix}_{kept,repaired,not_ok,ok,reached}
#
# Conversion tables are:
Expand Down
2 changes: 1 addition & 1 deletion tree/30_generic_methods/_file_check_special.cf
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#
# @class_prefix file_check_special
# @class_parameter file_name
# This bundle will define a class file_check_${file_type}_${file_name}_{ok, reached, kept} if the
# This bundle will define a condition file_check_${file_type}_${file_name}_{ok, reached, kept} if the
# file is a special file of type ${file_type}, or file_check_${file_type}_${file_name}_{not_ok, reached, not_kept, failed} if
# the file is not a special file or does not exist

Expand Down
4 changes: 2 additions & 2 deletions tree/30_generic_methods/command_execution_result.cf
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
#####################################################################################

# @name Command execution result
# @description Execute a command and create outcome classes depending on its exit code
# @description Execute a command and create result conditions depending on its exit code
# @action
# @documentation Execute a command and create outcome classes
# @documentation Execute a command and create result conditions
# 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
Expand Down
10 changes: 5 additions & 5 deletions tree/30_generic_methods/condition_from_command.cf
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@
#####################################################################################

# @name Condition from command
# @description Execute a command and create outcome classes depending on its exit code
# @documentation This bundle will define a class `condition_from_command_${condition_prefix}_{kept,not_ok,ok,reached}`
# @description Execute a command and create result conditions depending on its exit code
# @documentation This bundle will define a condition `condition_from_command_${condition_prefix}_{kept,not_ok,ok,reached}`
# depending on the exit codes given in parameters.
#
# This bundle will additionnaly produce a `${condition_prefix}_true` or a `${condition_prefix}_false` condition depending on the result on the command:
#
# * If the exit code is in the `true_codes` list, this will produce a kept outcome class and a `${condition_prefix}_true` condition
# * If the exit code is in the `false_codes` list, this will produce a repaired outcome class and a `${condition_prefix}_false` condition
# * If the exit code is not in the list, this will produce an error outcome class and no classes with `${condition_prefix}`
# * If the exit code is in the `true_codes` list, this will produce a kept outcome condition and a `${condition_prefix}_true` condition
# * If the exit code is in the `false_codes` list, this will produce a repaired outcome condition and a `${condition_prefix}_false` condition
# * If the exit code is not in the list, this will produce an error outcome condition and no conditions with `${condition_prefix}`
#
# The created condition (class in cfengine speaking) is global to the agent.
#
Expand Down
8 changes: 4 additions & 4 deletions tree/30_generic_methods/condition_from_expression.cf
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,17 @@
#####################################################################################

# @name Condition from expression
# @description Create a new condition class
# @documentation This bundle will define a class `condition_from_expression_${condition_prefix}_{kept,ok,reached}`
# @description Create a new condition
# @documentation This bundle will define a condition `condition_from_expression_${condition_prefix}_{kept,ok,reached}`
#
# This bundle will additionnaly produce a `${condition_prefix}_true` or a `${condition_prefix}_false` condition depending on the result on the expression:
#
# * If the expression results in a "defined" state, this will produce a kept outcome class and a `${condition_prefix}_true` condition
# * If the expression results in an "undefined" state, this will produce a kept outcome class and a `${condition_prefix}_false` condition
#
# Calling this method with a condition expression transforms a complex expression into a single class condition.
# Calling this method with a condition expression transforms a complex expression into a single condition.
#
# The created condition (class in cfengine speaking) is global to the agent.
# The created condition (class in CFEngine speaking) is global to the agent.
#
# @parameter condition_prefix The condition prefix
# @parameter condition_expression The expression evaluated to create the condition (use 'any' to alwaus evaluate to true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@
#####################################################################################

# @name Condition from expression persistent
# @description Create a new condition class that persists accross runs
# @documentation This bundle will define a class `condition_from_expression_persistent_${condition_prefix}_{kept,ok,reached}`
# @description Create a new condition that persists accross runs
# @documentation This bundle will define a condition `condition_from_expression_persistent_${condition_prefix}_{kept,ok,reached}`
#
# This bundle will additionnaly produce a `${condition_prefix}_true` or a `${condition_prefix}_false` condition depending on the result on the expression:
#
# * If the expression results in a "defined" state, this will produce a kept outcome class and a `${condition_prefix}_true` condition
# * If the expression results in an "undefined" state, this will produce a kept outcome class and a `${condition_prefix}_false` condition
#
# The created condition (class in cfengine speaking) is global to the agent and is persisted accross runs.
# The created condition (class in CFEngine speaking) is global to the agent and is persisted accross runs.
# The persistence duration is controlled using `${duration}`. There is no way to persist indefinitly.
#
# @parameter condition_prefix The condition prefix
Expand Down
2 changes: 1 addition & 1 deletion tree/30_generic_methods/directory_check_exists.cf
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

# @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
# @documentation This bundle will define a condition `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
#
Expand Down
2 changes: 1 addition & 1 deletion tree/30_generic_methods/file_check_FIFO_pipe.cf
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

# @name File check is FIFO/Pipe
# @description Checks if a file exists and is a FIFO/Pipe
# @documentation This bundle will define a class `file_check_FIFO_pipe_${file_name}_{ok, reached, kept}` if the
# @documentation This bundle will define a condition `file_check_FIFO_pipe_${file_name}_{ok, reached, kept}` if the
# file is a FIFO, or `file_check_FIFO_pipe_${file_name}_{not_ok, reached, not_kept, failed}` if
# the file is not a fifo or does not exist
#
Expand Down
2 changes: 1 addition & 1 deletion tree/30_generic_methods/file_check_block_device.cf
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

# @name File check if block device
# @description Checks if a file exists and is a block device
# @documentation This bundle will define a class `file_check_block_device_${file_name}_{ok, reached, kept}` if the
# @documentation This bundle will define a condition `file_check_block_device_${file_name}_{ok, reached, kept}` if the
# file is a block_device, or `file_check_block_device_${file_name}_{not_ok, reached, not_kept, failed}` if
# the file is not a block device or does not exist
#
Expand Down
2 changes: 1 addition & 1 deletion tree/30_generic_methods/file_check_character_device.cf
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

# @name File check if character device
# @description Checks if a file exists and is a character device
# @documentation This bundle will define a class `file_check_character_device_${file_name}_{ok, reached, kept}` if the
# @documentation This bundle will define a condition `file_check_character_device_${file_name}_{ok, reached, kept}` if the
# file is a character device, or `file_check_character_device_${file_name}_{not_ok, reached, not_kept, failed}` if
# the file is not a character device or does not exist
#
Expand Down
2 changes: 1 addition & 1 deletion tree/30_generic_methods/file_check_exists.cf
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

# @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
# @documentation This bundle will define a condition `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
#
Expand Down
2 changes: 1 addition & 1 deletion tree/30_generic_methods/file_check_hardlink.cf
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

# @name File check is hardlink
# @description Checks if two files are the same (hard links)
# @documentation This bundle will define a class `file_check_hardlink_${file_name_1}_{ok, reached, kept}` if the
# @documentation This bundle will define a condition `file_check_hardlink_${file_name_1}_{ok, reached, kept}` if the
# two files `${file_name_1}` and `${file_name_2}` are hard links of each other, or `file_check_hardlink_${file_name_1}_{not_ok, reached, not_kept, failed}` if
# if the files are not hard links.
#
Expand Down
2 changes: 1 addition & 1 deletion tree/30_generic_methods/file_check_regular.cf
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

# @name File check if regular
# @description Checks if a file exists and is a regular file
# @documentation This bundle will define a class `file_check_regular_${file_name}_{ok, reached, kept}` if the
# @documentation This bundle will define a condition `file_check_regular_${file_name}_{ok, reached, kept}` if the
# file is a regular_file, or `file_check_regular_${file_name}_{not_ok, reached, not_kept, failed}` if
# the file is not a regular file or does not exist
#
Expand Down
2 changes: 1 addition & 1 deletion tree/30_generic_methods/file_check_socket.cf
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

# @name File check if socket
# @description Checks if a file exists and is a socket
# @documentation This bundle will define a class `file_check_socket_${file_name}_{ok, reached, kept}` if the
# @documentation This bundle will define a condition `file_check_socket_${file_name}_{ok, reached, kept}` if the
# file is a socket, or `file_check_socket_${file_name}_{not_ok, reached, not_kept, failed}` if
# the file is not a socket or does not exist
#
Expand Down
2 changes: 1 addition & 1 deletion tree/30_generic_methods/file_check_symlink.cf
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

# @name File check if symlink
# @description Checks if a file exists and is a symlink
# @documentation This bundle will define a class `file_check_symlink_${file_name}_{ok, reached, kept}` if the
# @documentation This bundle will define a condition `file_check_symlink_${file_name}_{ok, reached, kept}` if the
# file is a symlink, or `file_check_symlink_${file_name}_{not_ok, reached, not_kept, failed}` if
# the file is not a symlink or does not exist
#
Expand Down
2 changes: 1 addition & 1 deletion tree/30_generic_methods/file_check_symlinkto.cf
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

# @name File check is symlink to
# @description Checks if first file is symlink to second file
# @documentation This bundle will define a class `file_check_symlinkto_${target}_{ok, reached, kept}` if the file `${symlink}`
# @documentation This bundle will define a condition `file_check_symlinkto_${target}_{ok, reached, kept}` if the file `${symlink}`
# is a symbolic link to `${target}`, or `file_check_symlinkto_${target}_{not_ok, reached, not_kept, failed}` if
# if it is not a symbolic link, or any of the files does not exist. The symlink's path is resolved to the
# absolute path and checked against the target file's path, which must also be an absolute path.
Expand Down
2 changes: 1 addition & 1 deletion tree/30_generic_methods/file_from_string_mustache.cf
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#
# @class_prefix file_from_string_mustache
# @class_parameter destination
# This bundle will define a class file_from_string_mustache_${destination}_{kept,repaired,not_ok,ok,reached}
# This bundle will define a condition file_from_string_mustache_${destination}_{kept,repaired,not_ok,ok,reached}

bundle agent file_from_string_mustache(template, destination)
{
Expand Down
12 changes: 6 additions & 6 deletions tree/30_generic_methods/file_from_template_jinja2.cf
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
# templates usage.
#
# This generic method will build a file from a jinja2 template
# using data (classes and variables) found in the execution context.
# using data (conditions and variables) found in the execution context.
#
#
# #### Setup
Expand All @@ -46,26 +46,26 @@
#
# The main specificity of jinja2 templating is the use of two root containers:
#
# * `classes` to access currently defined classes
# * `classes` to access currently defined conditions
# * `vars` to access all currently defined variables
#
# Note: You can add comments in the template, that will not be rendered in the output file with
# `{# ... #}`.
#
# ##### Classes
#
# To display content based on classes definition:
# To display content based on conditions definition:
#
# ```jinja2
# {% if classes.my_class is defined %}
# {% if classes.my_condition is defined %}
# display this if defined
# {% endif %}
# {% if not classes.my_class is defined %}
# {% if not classes.my_condition is defined %}
# display this if not defined
# {% endif %}
# ```
#
# Note: You cannot use class expressions here.
# Note: You cannot use condition expressions here.
#
# ##### Scalar variables
#
Expand Down
18 changes: 9 additions & 9 deletions tree/30_generic_methods/file_from_template_mustache.cf
Original file line number Diff line number Diff line change
Expand Up @@ -32,24 +32,24 @@
#
# The main specificity compared to standard mustache syntax of prefixes in all expanded values:
#
# * `classes` to access classes
# * `classes` to access conditons
# * `vars` to access all variables
#
# ##### Classes
#
# Here is how to display content depending on classes definition:
# Here is how to display content depending on conditions definition:
#
# ```mustache
# {{#classes.my_class}}
# content when my_class is defined
# {{/classes.my_class}}
# {{#classes.my_condition}}
# content when my_condition is defined
# {{/classes.my_condition}}
#
# {{^classes.my_class}}
# content when my_class is *not* defined
# {{/classes.my_class}}
# {{^classes.my_condition}}
# content when my_condition is *not* defined
# {{/classes.my_condition}}
# ```
#
# Note: You cannot use class expressions here.
# Note: You cannot use condition expressions here.
#
# ##### Scalar variable
#
Expand Down
6 changes: 3 additions & 3 deletions tree/30_generic_methods/file_from_template_type.cf
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@
# The data that will be used while expanding the template is the data available in
# the agent at the time of expansion. That means:
#
# * CFEngine's sytem variables (`${sys.*}`, ...) and classes (`linux`, ``)
# * data defined during execution (outcome classes of generic methods, ...)
# * classes based on `condition_` generic methods
# * CFEngine's sytem variables (`${sys.*}`, ...) and conditions (`linux`, ...)
# * data defined during execution (result conditions of generic methods, ...)
# * conditions based on `condition_` generic methods
# * data defined in ncf using `variable_*` generic methods, which allow for example
# to load data from local json or yaml files.
#
Expand Down
2 changes: 1 addition & 1 deletion tree/30_generic_methods/package_check_installed.cf
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

# @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
# @documentation This bundle will define a condition `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
#
Expand Down
Loading