Uploaded image for project: 'Puppet Development Kit'
  1. Puppet Development Kit
  2. PDK-948

PDK convert default_facts.yml does not support structured facts

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: PDK 1.4.1, PDK 1.5.0
    • Fix Version/s: None
    • Component/s: None
    • Template:
    • Acceptance Criteria:
      Hide

      The extra_facts option should allow for structured facts. 

      Show
      The extra_facts option should allow for structured facts. 
    • Team:
      Puppet Developer Experience

      Description

      The default_facts.yml directive in the .sync.yml currently iterates through the fact hash and encapsulates each fact in double quotes. 

      https://github.com/puppetlabs/pdk-templates/blob/master/moduleroot/spec/default_facts.yml.erb#L10-L11

       

      <% if !@configs['extra_facts'].nil? -%>
      <%   @configs['extra_facts'].each do |fact, value| -%>
      <%= fact %>: "<%= value %>"
      <%   end -%>
      <% end -%> 

       

      Unfortunately, this does not work if you want to add a structured fact like `os`.

       

      Given the following in the .sync.yml

       

      spec/default_facts.yml:
          extra_facts:
              'os':
                'family': 'RedHat'
                'name': 'CentOS'
                'release':
                  'major': '6' 

       

      results in the `default_facts.yml`. 

       

      ---
      concat_basedir: "/tmp"
      ipaddress: "172.16.254.254"
      is_pe: false
      macaddress: "AA:AA:AA:AA:AA:AA"
      os: "{"family"=>"RedHat", "name"=>"CentOS", "release"=>{"major"=>"6"}}" 

       

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              jarret.lavallee Jarret Lavallee
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Zendesk Support