(* libguestfs * Copyright (C) 2009-2025 Red Hat Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *) (* Please read generator/README first. *) open Types (* Augeas APIs. *) let daemon_functions = [ { defaults with name = "aug_init"; added = (0, 0, 7); style = RErr, [String (Pathname, "root"); Int "flags"], []; tests = [ InitBasicFS, Always, TestResultString ( [["mkdir"; "/etc"]; ["write"; "/etc/hostname"; "test.example.org"]; ["aug_init"; "/"; "0"]; ["aug_get"; "/files/etc/hostname/hostname"]], "test.example.org"), [["aug_close"]] ]; shortdesc = "create a new Augeas handle"; longdesc = {|Create a new Augeas handle for editing configuration files. If there was any previous Augeas handle associated with this guestfs session, then it is closed. You must call this before using any other C commands. C is the filesystem root. C must not be NULL, use F instead. The flags are the same as the flags defined in Eaugeas.hE, the logical I of the following integers: =over 4 =item C = 1 Keep the original file with a C<.augsave> extension. =item C = 2 Save changes into a file with extension C<.augnew>, and do not overwrite original. Overrides C. =item C = 4 Typecheck lenses. This option is only useful when debugging Augeas lenses. Use of this option may require additional memory for the libguestfs appliance. You may need to set the C environment variable or call C. =item C = 8 Do not use standard load path for modules. =item C = 16 Make save a no-op, just record what would have been changed. =item C = 32 Do not load the tree in C. =back To close the handle, you can call C. To find out more about Augeas, see L.|} }; { defaults with name = "aug_close"; added = (0, 0, 7); style = RErr, [], []; shortdesc = "close the current Augeas handle"; longdesc = "\ Close the current Augeas handle and free up any resources used by it. After calling this, you have to call C again before you can use any other Augeas functions." }; { defaults with name = "aug_defvar"; added = (0, 0, 7); style = RInt "nrnodes", [String (PlainString, "name"); OptString "expr"], []; shortdesc = "define an Augeas variable"; longdesc = {|Defines an Augeas variable C whose value is the result of evaluating C. If C is NULL, then C is undefined. On success this returns the number of nodes in C, or C<0> if C evaluates to something which is not a nodeset.|} }; { defaults with name = "aug_defnode"; added = (0, 0, 7); style = RStruct ("nrnodescreated", "int_bool"), [String (PlainString, "name"); String (PlainString, "expr"); String (PlainString, "val")], []; shortdesc = "define an Augeas node"; longdesc = {|Defines a variable C whose value is the result of evaluating C. If C evaluates to an empty nodeset, a node is created, equivalent to calling C C, C. C will be the nodeset containing that single node. On success this returns a pair containing the number of nodes in the nodeset, and a boolean flag if a node was created.|} }; { defaults with name = "aug_get"; added = (0, 0, 7); style = RString (RPlainString, "val"), [String (PlainString, "augpath")], []; shortdesc = "look up the value of an Augeas path"; longdesc = "\ Look up the value associated with C. If C matches exactly one node, the C is returned." }; { defaults with name = "aug_set"; added = (0, 0, 7); style = RErr, [String (PlainString, "augpath"); String (PlainString, "val")], []; tests = [ InitBasicFS, Always, TestResultString ( [["mkdir"; "/etc"]; ["write"; "/etc/hostname"; "test.example.org"]; ["aug_init"; "/"; "0"]; ["aug_set"; "/files/etc/hostname/hostname"; "replace.example.com"]; ["aug_get"; "/files/etc/hostname/hostname"]], "replace.example.com"), [["aug_close"]] ]; shortdesc = "set Augeas path to value"; longdesc = {|Set the value associated with C to C. In the Augeas API, it is possible to clear a node by setting the value to NULL. Due to an oversight in the libguestfs API you cannot do that with this call. Instead you must use the C call.|} }; { defaults with name = "aug_insert"; added = (0, 0, 7); style = RErr, [String (PlainString, "augpath"); String (PlainString, "label"); Bool "before"], []; tests = [ InitBasicFS, Always, TestResultString ( [["mkdir"; "/etc"]; ["write"; "/etc/hosts"; ""]; ["aug_init"; "/"; "0"]; ["aug_insert"; "/files/etc/hosts"; "1"; "false"]; ["aug_set"; "/files/etc/hosts/1/ipaddr"; "127.0.0.1"]; ["aug_set"; "/files/etc/hosts/1/canonical"; "foobar"]; ["aug_clear"; "/files/etc/hosts/1/canonical"]; ["aug_set"; "/files/etc/hosts/1/canonical"; "localhost"]; ["aug_save"]; ["cat"; "/etc/hosts"]], "\n127.0.0.1\tlocalhost\n"), [["aug_close"]] ]; shortdesc = "insert a sibling Augeas node"; longdesc = {|Create a new sibling C