Juniper / puppet-netdev-stdlib-junos

Junos specific Provider code for "netdev_stdlib". Netdev is a vendor-neutral network abstraction framework developed by Juniper Networks and contributed freely to the DevOps community.
Apache License 2.0
25 stars 14 forks source link

Puppet: Error message while executing XML format ERB template #23

Closed ganeshrn closed 8 years ago

ganeshrn commented 8 years ago

Manifest file

node "puppet-junos-agent" {
    netdev_device { $hostname: }
    $interfaces = {
        'ge-0/0/1' => {'unit' => 0, 'description' => 'to-B', 'family' => 'inet', 'address' =>'198.51.100.1/30' },
        'ge-0/0/2' => {'unit' => 0, 'description' => 'to-D', 'family' => 'inet', 'address' =>'198.51.100.5/30' },
        'ge-0/0/3' => {'description' => 'to-E'}
    }

    netdev_stdlib_junos::apply_group{ "interface_group1":
        template_path => "netdev_stdlib_junos/template.xml.erb",
        active        => true,
        ensure        => present
    }
}

Template file

<interfaces>
  <% @interfaces.each do | name, hash | %>
    <interface>
     <name><%= name %></name>
        <description><%= hash['description'] %></description>
        <% if hash.has_key?('unit') %>
        <unit>
          <name><%= hash['unit'] %></name>
          <family>
            <<%= hash['family'] %>>
              <address>
                <name><%= hash['address'] %></name>
              </address>
            </<%= hash['family'] %>>
         </family>
        </unit>
        <% end %>
    </interface>
  <% end %>
</interfaces>

Puppet agent run log.

% puppet agent --test
Info: Retrieving pluginfacts
Info: Retrieving plugin
<--snip-->
Error: /Stage[main]/Main/Node[puppet-junos-agent]/Netdev_stdlib_junos::Apply_group[interface_group1]/Netdev_group[interface_group1]: Failed to call refresh: Document already has a root node                                                 
Error: /Stage[main]/Main/Node[puppet-junos-agent]/Netdev_stdlib_junos::Apply_group[interface_group1]/Netdev_group[interface_group1]: Document already has a root node                                                 
<--snip-->
- apply-groups [ global re0 ];
+ apply-groups [ global re0 interface_group1 ];

Notice: JUNOS: OK: COMMIT success!
Notice: Finished catalog run in 22.39 seconds

Issue:- Configuration is getting applied. But, two error messages are thrown while running the agent.