zoukankan      html  css  js  c++  java
  • Saltstack module ini 详解

    ini.remove_option

    Remove a key/value pair from a section in an ini file. Returns the value of
    the removed key, or ``None`` if nothing was removed.
    
    API Example:
    
        import salt
        sc = salt.client.get_local_client()
        sc.cmd('target', 'ini.remove_option',
               [path_to_ini_file, section_name, option])
    
    CLI Example:
    
        salt '*' ini.remove_option /path/to/ini section_name option_name
    

    ini.remove_section

    Remove a section in an ini file. Returns the removed section as dictionary,
    or ``None`` if nothing was removed.
    
    API Example:
    
        import salt
        sc = salt.client.get_local_client()
        sc.cmd('target', 'ini.remove_section',
               [path_to_ini_file, section_name])
    
    CLI Example:
    
        salt '*' ini.remove_section /path/to/ini section_name
    

    ini.get_ini

    Retrieve whole structure from an ini file and return it as dictionary.
    
    API Example:
    
        import salt
        sc = salt.client.get_local_client()
        sc.cmd('target', 'ini.get_ini',
               [path_to_ini_file])
    
    CLI Example:
    
        salt '*' ini.get_ini /path/to/ini
    

    ini.get_option

    Get value of a key from a section in an ini file. Returns ``None`` if
    no matching key was found.
    
    API Example:
    
        import salt
        sc = salt.client.get_local_client()
        sc.cmd('target', 'ini.get_option',
               [path_to_ini_file, section_name, option])
    
    CLI Example:
    
        salt '*' ini.get_option /path/to/ini section_name option_name
    

    ini.get_section

    Retrieve a section from an ini file. Returns the section as dictionary. If
    the section is not found, an empty dictionary is returned.
    
    API Example:
    
        import salt
        sc = salt.client.get_local_client()
        sc.cmd('target', 'ini.get_section',
               [path_to_ini_file, section_name])
    
    CLI Example:
    
        salt '*' ini.get_section /path/to/ini section_name
    

    ini.set_option

    Edit an ini file, replacing one or more sections. Returns a dictionary
    containing the changes made.
    
    file_name
        path of ini_file
    
    sections : None
        A dictionary representing the sections to be edited ini file
        The keys are the section names and the values are the dictionary
        containing the options
        If the ini file does not contain sections the keys and values represent
        the options
    
    separator : =
        A character used to separate keys and values. Standard ini files use
        the "=" character.
    
        New in version 2016.11.0
    
    API Example:
    
        import salt
        sc = salt.client.get_local_client()
        sc.cmd('target', 'ini.set_option',
               ['path_to_ini_file', '{"section_to_change": {"key": "value"}}'])
    
    CLI Example:
    
        salt '*' ini.set_option /path/to/ini '{section_foo: {key: value}}'
  • 相关阅读:
    单词翻转
    潜伏者
    8.8-8.9总结
    园艺工人的求助
    灰zhu姑xiao娘mei
    [bzoj] 2724 蒲公英 || 分块
    [poj] 2079 Triangle || 旋转卡壳
    [poj] 3384 Feng Shui || 半平面交
    [poj] 1228 Grandpa's Estate || 稳定凸包
    [poj] 2187 Beauty Contest || 旋转卡壳
  • 原文地址:https://www.cnblogs.com/randomlee/p/Saltstack_module_ini.html
Copyright © 2011-2022 走看看