Sitelet https://web.archive.org/web/20201218192832/https://github.com/github/octocatalog-diff/issues/205
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A notice function with a hash as a title causes catalog validation to fail #205

Open
davidsandilands opened this issue Jan 25, 2019 · 2 comments

Comments

@davidsandilands
Copy link

@davidsandilands davidsandilands commented Jan 25, 2019 •

Description of problem

  • What did you do?
    Running octocatalog-diff
octocatalog-diff --puppetdb_url http://localhost:8080 --bootstrapped-from-dir /var/tmp/production/ --bootstrapped-to-dir /var/tmp/development/ --puppet_binary /usr/local/bin/puppet --pe-enc-url https://localhost:4433/classifier-api --pe-enc-token-file /root/.puppetlabs/token -n appserver.example.com --catalog-only
  • What happened?
    Catalog failed to compile with invalid json
  • What did you expect to happen?
    Catalog to compile
  • How can someone reproduce the problem?
    Create an array of hashes and call one of those hashes.
    ie
class iaas_linux_ibm_tivoli_monitoring_client (
  Array[Hash] $gateway_list = [ { primary => '',servername.domainname
                                  standby => 'servername2.domainname' } ],
) {
  $gateways = $::iaas_linux_ibm_tivoli_monitoring_client::gateway_list
  $rand = fqdn_rand(length($gateways))
  $randomly_chosen_gateways = "$gateways[$rand]"
}

Command used and debugging output

octocatalog-diff --puppetdb_url http://localhost:8080 --bootstrapped-from-dir /var/tmp/production/ --bootstrapped-to-dir /var/tmp/development/ --puppet_binary /usr/local/bin/puppet --pe-enc-url https://localhost:4433/classifier-api --pe-enc-token-file /root/.puppetlabs/token -n appserver.example.com --catalog-only

"/opt/puppetlabs/puppet/lib/ruby/gems/2.4.0/gems/octocatalog-diff-1.5.4/lib/octocatalog-diff/util/catalogs.rb:259:in `catalog_validator': Catalog failed: Catalog has invalid JSON: 751: unexpected token at '{primary => servername.domainname, standby => servername2.domainname} (OctocatalogDiff::Errors::CatalogError)
"

Platform and version information

  • Your OS: RHEL 7.4 x86
  • Your Ruby version: ruby 2.4.4p296 (2018-03-28 revision 63013) [x86_64-linux]
  • Your version of Puppet: PE 2018.1.4 5.5.6
  • Your version of octocatalog-diff: octocatalog-diff 1.5.4

Do the tests pass from a clean checkout? yes

Anything else to add that you think will be helpful?

@davidsandilands davidsandilands changed the title Using an Array of a hash fails catalog complication A notice function with a hash as a title causes catalog validation to fail Jan 29, 2019
@davidsandilands
Copy link
Author

@davidsandilands davidsandilands commented Jan 29, 2019 •

On further investigation the issue was down to the hash being used on the notice function which broke the validation, replacing these notices with notify resource calls fixed our issue.

class iaas_linux_ibm_tivoli_monitoring_client (
  Array[Hash] $gateway_list = [ { primary => 'hostname.dopmainname',
                                  standby => 'hostname.domainname' } ],
) {

  $gateways = $::iaas_linux_ibm_tivoli_monitoring_client::gateway_list

  $rand = fqdn_rand(length($gateways))
  notice($gateways[$rand])

  $randomly_chosen_gateways = $gateways[$rand]
  notice("Choosen gateways list: ${randomly_chosen_gateways}")
@ahayworth
Copy link
Contributor

@ahayworth ahayworth commented Oct 31, 2019

@davidsandilands I can reproduce this problem--

failing CI run: https://github.com/github/octocatalog-diff/commit/40a1c8b5eb1dffd6b8500050b14cd1d7c1d6a54b/checks?check_suite_id=289284170

failing test case: 40a1c8b

I'm curious - does the failing "notify called with a hash parameter" both compile and execute successfully on a host in your fleet? I'm wondering if this behavior is actually supported by puppet servers and clients in the wild - or maybe it only works with certain formats of catalogs?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.