github/octocatalog-diff

octocatalog-test changes string to array with a single element

slauger opened this issue · 4 comments

Hi,

i'm trying to get octocatalog-diff up and running and now having one last issue.

It seems that octocatalog casts some parameters (e.g. Class, Notify, ...) from a string to an array with a single element. Because of that octocatalog-diff always shows us changes for nodes.

My Environment:

  • From Puppetmaster: Puppetmaster 3.8.7 on CentOS 6
  • To Puppetmaster: Puppetserver 2.8.0 on CentOS 7
  • Agent: Puppet 3.8.7

Output of octocatalog-test:

Using /opt/jenkins/.rvm/gems/ruby-2.1.10
I, [2017-12-07T16:22:07.624795 #20507]  INFO -- : Catalogs compiled for node7.customer.local
I, [2017-12-07T16:22:08.750119 #20507]  INFO -- : Diffs computed for node7.customer.local
  Anchor[my_module::start] =>
   parameters =>
     notify =>
      - Class[my_module::Package]
      + ["Class[my_module::Package]"]
*******************************************

I'm using the following command line parameters for the tests.

octocatalog-diff \
	-n ${1} \
	-f "${FROM_ENVIRONMENT}" \
	-t "${TO_ENVIRONMENT}" \
	--parser-from default \
	--parser-to future \
	--from-environment "${FROM_ENVIRONMENT}" \
	--to-environment "${TO_ENVIRONMENT}" \
	--puppetdb-api-version ${PUPPETDB_API}  \
	--puppet-master-api-version 2 \
	--puppet-master-timeout 600 \
	--from-puppet-master "puppet" \
	--to-puppet-master "puppetserver" \
	--puppetdb-url "${PUPPETDB_URL}" \
	--puppet-binary /usr/local/rvm/gems/ruby-2.1.10/bin/puppet \
	--puppetdb-ssl-ca ssl/certs/ca.pem \
	--puppetdb-ssl-client-cert ssl/certs/puppetci.pem \
	--puppetdb-ssl-client-key ssl/private_keys/puppetci.pem \
	--display-detail-add \
	--compare-file-text \
	--no-display-datatype-changes \
	--no-validate-references "before,require,subscribe,notify" \
	--no-storeconfigs \
	--color \
	--ignore-tags ssh,cron

The catalog test runs on a CentOS 7 machine with ruby 2.1.10.

ruby 2.1.10p492 (2016-04-01 revision 54464) [x86_64-linux]

[0] $ gem list
*** LOCAL GEMS ***

bigdecimal (default: 1.2.4)
bundler-unload (1.0.2)
diffy (3.2.0)
executable-hooks (1.3.2)
facter (2.5.1)
gem-wrappers (1.3.2)
hashdiff (0.3.7)
hiera (1.3.4)
httparty (0.15.6)
io-console (default: 0.4.3)
json (default: 1.8.1)
json_pure (2.1.0)
minitest (default: 4.7.5)
multi_xml (0.6.0)
octocatalog-diff (1.5.1)
psych (default: 2.0.5)
puppet (3.8.7)
rake (default: 10.1.0)
rdoc (default: 4.1.0)
rubygems-bundler (1.4.4)
rugged (0.26.0)
rvm (1.11.3.9)
test-unit (default: 2.1.10.0)

Would it be possible to create another custom filter for this?

Thanks in advance.

I remember this from our upgrade, and I think we just tried to ignore it. 🙀

Sounds like an ideal case for a filter as you suggested. I'll see what I can do...

Hi Kevin,

I played around a lot with --filter etc., but there are a way to much different changes to exclude them all. It would be great if you could create a custom filter for this. This would help us with our last steps in our v4 migration.

Thank your for your awesome work btw! I really love octocatalog-test. :)

Greetings, Simon

Implemented in version 1.5.2.

You can wait for that to be released, or try it earlier via #172.

Hi Kevin,

thank you! The filter works and now we have a much better overview. ;)

I still have a strange behavoir using the CLI. The command returns the exit code "2", even if changes are filtered out. Is this expected?

e.g.

# node w/o changes 
+ ./octocatalog.sh node01.customer.local 
Using /opt/jenkins/.rvm/gems/ruby-2.1.10 

I, [2017-12-18T11:22:07.648498 #11891]  INFO -- : Catalogs compiled for node01.customer.local 

I, [2017-12-18T11:22:08.601985 #11891]  INFO -- : Diffs computed for node01.customer.local 
I, [2017-12-18T11:22:08.602075 #11891]  INFO -- : No differences 
+ exit 0 
# node with changes (no output is genreated)
+ ./octocatalog.sh node02.customer.local 
Using /opt/jenkins/.rvm/gems/ruby-2.1.10 

I, [2017-12-18T11:22:41.084805 #12180]  INFO -- : Catalogs compiled for node02.customer.local 

I, [2017-12-18T11:22:42.112857 #12180]  INFO -- : Diffs computed for node02.customer.local 
+ exit 2 

My current CLI options are as follows:

octocatalog-diff \ 
        -n ${1} \ 
        -f "${FROM_ENVIRONMENT}" \ 
        -t "${TO_ENVIRONMENT}" \ 
        --parser-from default \ 
        --parser-to future \ 
        --from-environment "${FROM_ENVIRONMENT}" \ 
        --to-environment "${TO_ENVIRONMENT}" \ 
        --puppetdb-api-version ${PUPPETDB_API}  \ 
        --puppet-master-api-version 2 \ 
        --puppet-master-timeout 600 \ 
        --from-puppet-master "puppet3" \ 
        --to-puppet-master "puppet4" \ 
        --puppetdb-url "${PUPPETDB_URL}" \ 
        --puppet-binary ~/.rvm/gems/ruby-2.1.10/bin/puppet \ 
        --puppetdb-ssl-ca ssl/certs/ca.pem \ 
        --puppetdb-ssl-client-cert ssl/certs/jenkins.pem \ 
        --puppetdb-ssl-client-key ssl/private_keys/jenkins.pem \ 
        --display-detail-add \ 
        --compare-file-text \ 
        --no-display-datatype-changes \ 
        --no-validate-references \ 
        --no-storeconfigs \ 
        --color \ 
        --ignore File[/etc/cron.d/*],Anchor[*] \ 
        --ignore-attr notify \ 
        --ignore-tags ssh,cron \ 
        --filters SingleItemArray 

Am I missing something?