ansible-collections / community.cassandra

Cassandra Ansible Collection
http://galaxy.ansible.com/community/cassandra
GNU General Public License v3.0
25 stars 19 forks source link

match brackets better #160

Closed acelinkio closed 2 years ago

acelinkio commented 2 years ago
SUMMARY

Fixing matching pattern to better match content between brackets. Previous pattern would match brackets across different lines and cause the following error:

fatal: [localhost]: FAILED! => {"changed": false, "msg": "An error occured: invalid syntax (<string>, line 1)"}
ISSUE TYPE
COMPONENT NAME

module: cassandra_keyspace

ADDITIONAL INFORMATION

SAMPLE KEYSPACE

CREATE KEYSPACE test_keyspace WITH replication = {'class': 'NetworkTopologyStrategy', 'DC1': '3'}  AND durable_writes = true;

CREATE TABLE test_keyspace.database_migrations (
    id uuid PRIMARY KEY,
    applied_at timestamp,
    checksum blob,
    content text,
    name text,
    state text,
    version int
) WITH bloom_filter_fp_chance = 0.01
    AND caching = {'keys': 'NONE', 'rows_per_partition': 'NONE'}
    AND comment = ''
    AND compaction = {'class': 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy', 'max_threshold': '32', 'min_threshold': '4'}
    AND compression = {'chunk_length_in_kb': '64', 'class': 'org.apache.cassandra.io.compress.LZ4Compressor'}
    AND crc_check_chance = 1.0
    AND dclocal_read_repair_chance = 0.1
    AND default_time_to_live = 0
    AND gc_grace_seconds = 864000
    AND max_index_interval = 2048
    AND memtable_flush_period_in_ms = 0
    AND min_index_interval = 128
    AND read_repair_chance = 0.0
    AND speculative_retry = '99PERCENTILE';

PREVIOUS MATCH PATTERN {([\S\s]*)} RESULTS

{'class': 'NetworkTopologyStrategy', 'DC1': '3'} AND durable_writes = true;

CREATE TABLE test_keyspace.database_migrations (
id uuid PRIMARY KEY,
applied_at timestamp,
checksum blob,
content text,
name text,
state text,
version int
) WITH bloom_filter_fp_chance = 0.01
AND caching = {'keys': 'NONE', 'rows_per_partition': 'NONE'}
AND comment = ''
AND compaction = {'class': 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy', 'max_threshold': '32', 'min_threshold': '4'}
AND compression = {'chunk_length_in_kb': '64', 'class': 'org.apache.cassandra.io.compress.LZ4Compressor'}

NEW MATCH PATTERN {(.*)} RESULTS

'class': 'NetworkTopologyStrategy', 'DC1': '3'
codecov[bot] commented 2 years ago

Codecov Report

Merging #160 (fde230d) into master (064c0ec) will not change coverage. The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #160   +/-   ##
=======================================
  Coverage   78.27%   78.27%           
=======================================
  Files          25       25           
  Lines        1850     1850           
  Branches      431      431           
=======================================
  Hits         1448     1448           
  Misses        205      205           
  Partials      197      197           

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 064c0ec...fde230d. Read the comment docs.

rhysmeister commented 2 years ago

Hello @acelinkit,

Can an integration test be added for this?

Rhys

acelinkio commented 2 years ago

@rhysmeister added a test in recent commit. Let me know if any questions. Thanks!

rhysmeister commented 2 years ago

All good @acelinkit

Vielen Dank!

Rhys

acelinkio commented 2 years ago

@rhysmeister any chance of triggering a new release to ansible-galaxy anytime soon? Lmk if I can do anything to help with that

rhysmeister commented 2 years ago

@acelinkit At the moment the Zuul job is failing on the galaxy import test...

https://github.com/ansible-collections/community.cassandra/runs/3666247849

I've had a quick look in the logs but I couldn't find anything useful. Once that's solved it should be easy enough.