Write-attribute: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
No edit summary
 
(13 intermediate revisions by the same user not shown)
Line 6: Line 6:


Sets the value of an attribute for the selected resource. The value may be null if the underlying model supports null values.
Sets the value of an attribute for the selected resource. The value may be null if the underlying model supports null values.
If the attribute does not exist, but it is a ''known attribute'' to the management resource, it is created and assigned to the given value.
If the attribute does not exist and it is not a known attribute to the management resource, the operation fails with <tt>"outcome" => "failed"</tt> and description "JBAS014792: Unknown attribute ..."
If the attribute exists, the current value is overwritten.


=Syntax=
=Syntax=


<pre>
<pre>
:write-attribute(name="...",value="...")
:write-attribute(name="..."[, value="..."])
</pre>
</pre>


=Use Cases=
=Use Cases=
==Adding a Known Attribute==
Add an "autoflush" configuration to a logging file handler:
<pre>
/subsystem=logging/file-handler=TEST:write-attribute(name="autoflush", value="true")
</pre>
Because it is a known attribute of the management node, the attribute will be added if it does not exist, or its value overwritten if it exists.
==Changing the Value of a Known Attribute==
Use the same syntax as in the above example.
There are situations where the an attribute added as such is expanded into a different layout. See the [[WildFly Logging Subsystem CLI Configuration#formatter|logging handler format]] case.


==Removing an Attribute==
==Removing an Attribute==
Use the following syntax to remove an attribute:


<pre>
<pre>
:write-attribute(name=socket-binding)
:write-attribute(name="socket-binding")
</pre>
</pre>


<tt>socket-binding</tt> will be removed from the current node.
<tt>socket-binding</tt> will be removed from the current node.  
 
If the management resource is listed in CLI, the "removed" attribute shows as "undefined":
 
<pre>
...  socket-binding=undefined ...
</pre>

Latest revision as of 04:32, 16 November 2016

Internal

Overview

Sets the value of an attribute for the selected resource. The value may be null if the underlying model supports null values.

If the attribute does not exist, but it is a known attribute to the management resource, it is created and assigned to the given value.

If the attribute does not exist and it is not a known attribute to the management resource, the operation fails with "outcome" => "failed" and description "JBAS014792: Unknown attribute ..."

If the attribute exists, the current value is overwritten.

Syntax

:write-attribute(name="..."[, value="..."])

Use Cases

Adding a Known Attribute

Add an "autoflush" configuration to a logging file handler:

/subsystem=logging/file-handler=TEST:write-attribute(name="autoflush", value="true")

Because it is a known attribute of the management node, the attribute will be added if it does not exist, or its value overwritten if it exists.

Changing the Value of a Known Attribute

Use the same syntax as in the above example.

There are situations where the an attribute added as such is expanded into a different layout. See the logging handler format case.

Removing an Attribute

Use the following syntax to remove an attribute:

:write-attribute(name="socket-binding")

socket-binding will be removed from the current node.

If the management resource is listed in CLI, the "removed" attribute shows as "undefined":

...  socket-binding=undefined ...