arista-eosplus/puppet-eos

eos_vlan provider does not properly set trunk_groups

Closed this issue · 1 comments

The provider attempts to call rbeapi.api('vlans').set_trunk_group when the closest method available is add_trunk_group.

The provider should check the existing trunk groups and call add_trunk_group as many times as needed to reconcile the list. Similarly, remove_trunk_group may need to be called multiple times to purge undesired trunk_groups.

Arista#bash sudo /opt/puppet/bin/puppet apply -e "eos_vlan { '4094': trunk_groups => ['test1', 'test2'], }"
Notice: Compiled catalog for larry.localdomain in environment production in 0.03 seconds
Error: undefined method `set_trunk_group' for #<Rbeapi::Api::Vlans:0xa44aef8>
Error: /Stage[main]/Main/Eos_vlan[4094]/trunk_groups: change from [] to test1 test2 failed: undefined method `set_trunk_group' for #<Rbeapi::Api::Vlans:0xa44aef8>

Investigated how this got through testing. The unit test only checks to see if set_trunk_group is called. The system test did not have a test case for set_trunk_group which was the problem. Issue #38 in rbeapi added the set_trunk_groups method (note it is plural). Changing the name of the call from set_trunk_group to set_trunk_groups and adding a system test.