voxpupuli / puppet-cassandra

Installs Cassandra & DataStax Agent on RHEL/Ubuntu/Debian.
https://forge.puppetlabs.com/puppet/cassandra
Apache License 2.0
13 stars 65 forks source link

Configuring ~/.cassandra/cqlshrc to display query results with colors breaks cassandra::schema #454

Open jchoksijudopay opened 4 years ago

jchoksijudopay commented 4 years ago

Affected Puppet, Ruby, OS and module versions/distributions

How to reproduce (e.g Puppet code you use)

class { 'cassandra::schema':
  cqlsh_user     => 'puppet',
  cqlsh_password => $puppet_user_password,
  users          => {
    'dummy1'    => {
      password  => $dummy1_user_password,
      superuser => true,
    },
    'dummy2'  => {
      password  => $dummy2_user_password,
      superuser => true,
    },
    'cassandra' => {
      ensure => absent,
    }
  },
  require        => Exec['cassandra-bootstrap'],
}

What are you seeing

The puppet module keeps trying to create the dummy1 and dummy2 users and fails to remove the cassandra user on each run.

What behaviour did you expect instead

The dummy1 and dummy2 users should have been created once and the cassandra user should have been removed.

Any additional information you'd like to impart

We identified that the issue was being caused by the enabling of color output in query results. This broke the logic in https://github.com/voxpupuli/puppet-cassandra/blob/master/manifests/schema/user.pp as it was not expecting the extra characters when running cqlsh and checking its output.

File: ~/.cassandra/cqlshrc

[ui]
;; Whether or not to display query results with colors
color = on

A quick fix for us was to make use of the cqlsh_additional_options parameter and set it to: --no-color.

Raised this issue to request whether the cqlsh_additional_options could be set to --no-color as a default to prevent others facing an issue.

igalic commented 4 years ago

yes, we could do that.

alternatively, we might want to ignore ~/.cassandra/cqlshrc