Charmed OpenSearch
- By Canonical Data Platform
- Databases
Channel | Revision | Published | Runs on |
---|---|---|---|
2/edge | 90 | 08 May 2024 |
juju deploy opensearch --channel 2/edge
Deploy universal operators easily with Juju, the Universal Operator Lifecycle Manager.
Platform:
charms.opensearch.v0.helper_conf_setter
-
- Last updated 21 Oct 2022
- Revision Library version 0.1
Utilities for editing yaml config files at any depth level and maintaining comments.
Index
class OutputType
Description
Enum representing the output type of a write operation. None
Methods
OutputType. __str__( self )
Description
String representation of enum value. None
class YamlConfigSetter
Utility class for updating YAML config, supporting diverse object types and nestedness.
Description
conf_setter = YamlConfigSetter() put("file.yml", "a.b", "new_name") put("file.yml", "a.b/c.obj/key3/key1.a/obj", {"a": "new_name_1", "b": ["hello", "world"]}) put("file.yml", "a.b/c.arr.simple/[0]", "hello") put("file.yml", "a.b/c.arr.complex/[name:name1]", {"a": "new_name_1", "b": ["hello", "world"]}) put("file.yml", "a.b/c.arr.complex/[name:name5]/val/key", "new_val25") put("file.yml", "a.b/c.arr.complex/[0]/val", "complex2_updated") put("file.yml", "a.b/c.arr.complex/[0]/new_val/new_sub_key", "updated")
Methods
YamlConfigSetter. __init__( self , base_path: str )
Description
base_path: if set, where to look for files relatively on "load/put/delete" methods. None
YamlConfigSetter. load( self , config_file: str )
Description
Load the content of a YAML file. None
YamlConfigSetter. put( self , config_file: str , key_path: str , val: any , sep , output_type: OutputType , inline_array: bool , output_file: str )
Description
Add or update the value of a key (or content of array at index / key) if it exists. None
YamlConfigSetter. delete( self , config_file: str , key_path: str , sep , output_type: OutputType , output_file: str )
Description
Delete the value of a key (or content of array at index / key) if it exists. None
YamlConfigSetter. replace( self , config_file: str , old_val: str , new_val: any , regex: bool , output_type: OutputType , output_file: str )
Description
Replace any substring in a text file. None