octofacts icon indicating copy to clipboard operation
octofacts copied to clipboard

octofacts does not like unquoted yaml keys that look like floats

Open sirinek opened this issue 6 years ago • 0 comments

Description of problem

  • What did you do? Tried to run a test
  • What happened? An error showed up about not being able to convert a float to a symbol.
  • What did you expect to happen? Nothing (I am not using this particular fact)
  • How can someone reproduce the problem? Add the fact to a fact file and run a test using that file.

Command/code used

rake spec

Platform and version information

  • Your OS: RHEL 7
  • Your Ruby version: ruby 2.4.3p205 (2017-12-14 revision 61247) [x86_64-linux]
  • Your version of Puppet: 5.3.5 (PE 2017.3.5)
  • Your version of octofacts: 0.5.1

Do the tests pass from a clean checkout? Yes all tests pass

Anything else to add that you think will be helpful?

I have a flat file of facts from my puppet master, but Octofacts does not like it. In particular it trips up on the following YAML:

pe_postgresql_info:
  installed_server_version: "9.6"
  data_partition_size_bytes: 804913152000
  data_partition_available_bytes: 598647898112
  versions:
    9.4:
      app_dir: /opt/puppetlabs/server/apps/postgresql/9.4
      data_dir: /opt/puppetlabs/server/data/postgresql/9.4
      tablespaces:
        - /opt/puppetlabs/server/data/postgresql/activity/PG_9.4_201409291
        - /opt/puppetlabs/server/data/postgresql/classifier/PG_9.4_201409291
        - /opt/puppetlabs/server/data/postgresql/orchestrator/PG_9.4_201409291
        - /opt/puppetlabs/server/data/postgresql/puppetdb/PG_9.4_201409291
        - /opt/puppetlabs/server/data/postgresql/rbac/PG_9.4_201409291
      used_bytes: 91782041600
    9.6:
      app_dir: /opt/puppetlabs/server/apps/postgresql
      data_dir: /opt/puppetlabs/server/data/postgresql/9.6
      tablespaces:
        - /opt/puppetlabs/server/data/postgresql/activity/PG_9.6_201608131
        - /opt/puppetlabs/server/data/postgresql/classifier/PG_9.6_201608131
        - /opt/puppetlabs/server/data/postgresql/orchestrator/PG_9.6_201608131
        - /opt/puppetlabs/server/data/postgresql/puppetdb/PG_9.6_201608131
        - /opt/puppetlabs/server/data/postgresql/rbac/PG_9.6_201608131
      used_bytes: 100328099840

When I use the fact file in a test, I get the following error:

     NoMethodError:
       undefined method `to_sym' for 9.4:Float
       Did you mean?  to_s

sirinek avatar Jul 10 '18 20:07 sirinek