Comments (13)
Could you set up your yaml file to send this output to debug.msg?
{{ mariadb_cnf_file_b64encoded['content'] | ansible.builtin.b64decode |
I just want to see what the string looks like before it gets to jc
. Not sure if Ansible is changing anything with it before it gets to jc
.
from jc.
Interesting, it's dying at this line in the parser:
157 ini_parser.read_string(data)
Something within the python ConfigParser library doesn't like it. I'll have to take a closer look.
from jc.
Ah, I think I see something that might be affecting this. I'm using a custom dictionary type to change None
values to empty strings (``). This seems to break the ConfigParser module in these strange cases.
class MyDict(dict):
def __setitem__(self, key, value):
# convert None values to empty string
if value is None:
self[key] = ''
ini_parser = configparser.ConfigParser(
dict_type = MyDict,
allow_no_value=True,
interpolation=None,
default_section=None,
It seems to work fine with the ini-dup
parser because it wraps the items in a list, which can be appended to. I may need to rethink this method of converting None
to a blank string.
I might even just move that type of conversion to the _process
function, so it is outside the ConfigParser responsibility.
from jc.
I have a fix in dev
:
https://github.com/kellyjonbrazil/jc/blob/dev/jc/parsers/ini.py
from jc.
fix in v1.25.1
from jc.
Hi! Could you send the debug.msg to show what the decoded string looks like?
from jc.
I'm not sure what you mean by the debug.msg
? The result are the same as above when run with -vvvvvvv
.
from jc.
Adding this:
- name: Debug the base64 decoded the existing MariaDB configuration file variables for /etc/mysql/mariadb.conf.d/50-server.cnf
ansible.builtin.debug:
msg: "{{ mariadb_cnf_file_b64encoded['content'] | ansible.builtin.b64decode }}"
verbosity: "{% if ansible_check_mode | bool %}2{% else %}3{% endif %}"
Returns:
TASK [mariadb : Debug the base64 decoded the existing MariaDB configuration file variables for /etc/mysql/mariadb.conf.d/50-server.cnf] ***
task path: /home/chris/webarch/mariadb/tasks/conf.yml:71
ok: [wsh.webarchitects.org.uk] =>
msg: |-
# Ansible managed
# These groups are read by MariaDB server.
# Use it for options that only the server (but not clients) should see
#
# See the examples of server my.cnf files in /usr/share/mysql/
#
# this is read by the standalone daemon and embedded servers
[server]
# this is only for the mysqld standalone daemon
[mysqld]
#
# * Basic Settings
#
user = mysql
pid_file = /var/run/mysqld/mysqld.pid
port = 3306
basedir = /usr
datadir = /var/lib/mysql
tmpdir = /tmp
lc_messages_dir = /usr/share/mysql
skip_external_locking
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
bind_address = 127.0.0.1
#
# * Fine Tuning
#
key_buffer_size = 16M
max_allowed_packet = 64M
thread_stack = 192K
thread_cache_size = 8
# This replaces the startup script and checks MyISAM tables if needed
# the first time they are touched
myisam_recover_options = BACKUP
max_connections = 80
max_user_connections = 0
table_cache = 64
thread_concurrency = 10
open_files_limit = 122880
table_open_cache = 6000
tmp_table_size = 32M
join_buffer_size = 8M
max_heap_table_size = 32M
#
# * Query Cache Configuration
#
# Disabled by default in MariaDB >= 10.1.7 see:
# https://mariadb.com/kb/en/query-cache/
query_cache_type = 0
query_cache_limit = 0
query_cache_size = 0
#
# * Logging and Replication
#
# Both location gets rotated by the cronjob.
# Be aware that this log type is a performance killer.
# As of 5.1 you can enable the log at runtime!
#general_log_file = /var/log/mysql/mysql.log
#general_log = 1
#
# Error log - should be very few entries.
#
log_error = /var/log/mysql/error.log
#
# Enable the slow query log to see queries with especially long duration
#slow_query_log_file = /var/log/mysql/mariadb-slow.log
#long_query_time = 10
#log_slow_rate_limit = 1000
#log_slow_verbosity = query_plan
#log-queries-not-using-indexes
#
# The following can be used as easy to replay backup logs or for replication.
# note: if you are setting up a replication slave, see README.Debian about
# other settings you may need to change.
#server-id = 1
#log_bin = /var/log/mysql/mysql-bin.log
expire_logs_days = 10
max_binlog_size = 100M
#binlog_do_db = include_database_name
#binlog_ignore_db = exclude_database_name
#
# * InnoDB
#
# InnoDB is enabled by default with a 10MB datafile in /var/lib/mysql/.
# Read the manual for more InnoDB related options. There are many!
innodb_buffer_pool_size = 1G
innodb_log_file_size = 256M
# * Security Features
#
# Read the manual, too, if you want chroot!
# chroot = /var/lib/mysql/
#
# For generating SSL certificates you can use for example the GUI tool "tinyca".
#
# ssl-ca=/etc/mysql/cacert.pem
# ssl-cert=/etc/mysql/server-cert.pem
# ssl-key=/etc/mysql/server-key.pem
#
# Accept only connections using the latest and most secure TLS protocol version.
# ..when MariaDB is compiled with OpenSSL:
# ssl-cipher=TLSv1.2
# ..when MariaDB is compiled with YaSSL (default in Debian):
# ssl=on
#
# * Character sets
#
# MySQL/MariaDB default is Latin1, but in Debian we rather default to the full
# utf8 4-byte character set. See also client.cnf
#
character_set_server = utf8mb4
collation_server = utf8mb4_general_ci
ignore_db_dir = lost+found
#
# * Unix socket authentication plugin is built-in since 10.0.22-6
#
# Needed so the root database user can authenticate without a password but
# only when running as the unix root user.
#
# Also available for other users if required.
# See https://mariadb.com/kb/en/unix_socket-authentication-plugin/
# this is only for embedded server
[embedded]
# This group is only read by MariaDB servers, not by MySQL.
# If you use the same .cnf file for MySQL and MariaDB,
# you can put MariaDB-only options here
[mariadb]
# https://mariadb.com/kb/en/library/performance-schema-overview/
performance_schema=ON
performance_schema_instrument='stage/%=ON'
performance_schema_consumer_events_stages_current=ON
performance_schema_consumer_events_stages_history=ON
performance_schema_consumer_events_stages_history_long=ON
# This group is only read by MariaDB-10.1 servers.
# If you use the same .cnf file for MariaDB of different versions,
# use this group for options that older servers don't understand
[mariadb-10.1]
# vim: syntax=dosini
Which is the contents of /etc/mysql/mariadb.conf.d/50-server.cnf
.
I also tried commenting this line:
skip_external_locking
But that made no difference.
from jc.
BTW there is a new Ansible from_ini
filter but it so far lacks support for sections and duplicates so isn't a replacement for your parsers.
from jc.
Switching back to JC version 1.24.0 appears to solve the issue.
from jc.
Strange - does that also change the python version? On my laptop if I run the following I get the same error but if I slightly change the input it works fine:
% echo '[data]
novalue
' | jc --ini
jc: Error - ini parser could not parse the input data.
If this is the correct parser, try setting the locale to C (LC_ALL=C).
For details use the -d or -dd option. Use "jc -h --ini" for help.
This is with python v3.11.1
from jc.
This is with the Debian Bookworm python3
:
apt show python3 | jc --ini | jp Version
"3.11.2-1+b1"
which jc
/home/chris/.local/bin/jc
jc --version
jc version: 1.24.0
python interpreter version: 3.11.2
python path: /home/chris/.local/pipx/venvs/ansible/bin/python
https://github.com/kellyjonbrazil/jc
© 2019-2023 Kelly Brazil
echo '[data]
novalue
' | jc --ini -p
{
"data": {
"novalue": ""
}
}
from jc.
I'm trying to see if there were any changes to the ini parser that could have caused this. I wonder if this is relevant?
from jc.
Related Issues (20)
- `lspci` parser PhySlot issue HOT 4
- Fix documentation for apt-get-sqq parser HOT 3
- New Parser - NUT-upsc command HOT 1
- [parsers /pci_ids.py] Only last [subvendor][subdevice] got loaded into result when multiple subdevices having the same subvendor id HOT 3
- Bug: Traceroute ignored IPs when multiple IPs on hop HOT 3
- "ss" Parser not working correctly: Entries Missing HOT 5
- .netrc support HOT 1
- Problem with --pip-show parser for a module with nothing on the License: line but which has following lines HOT 4
- lspci strips trailing digit on bus ID HOT 3
- `--zpool-status` fails to handle the `spares` section of `zpool status` HOT 3
- New parser request: pacman -Si HOT 9
- 1.25.3: pytest fails in nits which are comparing time HOT 8
- Python 3.12 test regression: `tests.test_ip_address.MyTests.test_ip_address_ipv6_6to4` HOT 11
- Parsing mounts with spaces in filenames fails - AttributeError: 'NoneType' object has no attribute 'groupdict' HOT 2
- New Streaming-parser proposal: traceroute-s HOT 2
- ethtool parsing doesn't work HOT 2
- Netstat issue with spaces in program name HOT 4
- jc ls --time-style=+"%F %T" -al -> wrong output HOT 1
- New Parser: cloudformation template.yaml HOT 4
- ifconfig parser of IPv4 do not support utun interfaces on macOS HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jc.