From 4e72dcaae616069af454483f402d9cf50ac78931 Mon Sep 17 00:00:00 2001 From: Benedikt Trefzer Date: Thu, 4 Dec 2025 13:35:06 +0100 Subject: [PATCH 1/4] let lint fix several identions --- README.md | 2 +- REFERENCE.md | 870 +++++++++--------- data/AlmaLinux/default.yaml | 6 +- data/RedHat-family.yaml | 8 +- data/common.yaml | 12 +- data/profiles/default_ignore.yaml | 2 +- data/profiles/nwfilter_default_v7.yaml | 2 +- manifests/init.pp | 2 +- manifests/network.pp | 32 +- manifests/nwfilter.pp | 10 +- manifests/service.pp | 8 +- types/domain/device.pp | 4 +- types/domain/disk.pp | 12 +- types/domain/interface.pp | 34 +- types/filterref.pp | 20 +- types/net/bandwith.pp | 22 +- types/net/bridge.pp | 10 +- types/net/dns.pp | 46 +- types/net/dnsmasq_options.pp | 6 +- types/net/domain.pp | 4 +- types/net/forward.pp | 56 +- types/net/ip.pp | 62 +- types/net/metadata.pp | 4 +- types/net/port.pp | 2 +- types/net/portgroup.pp | 16 +- types/net/route.pp | 12 +- types/net/virtualport.pp | 18 +- types/net/vlan.pp | 10 +- types/nwfilter/protocol/arp_rarp.pp | 58 +- .../espipv6_ahipv6_udpliteipv6_allipv6.pp | 34 +- types/nwfilter/protocol/icmp.pp | 44 +- types/nwfilter/protocol/icmpv6.pp | 38 +- .../protocol/igmp_esp_ah_udplite_all.pp | 40 +- types/nwfilter/protocol/ipv4.pp | 44 +- types/nwfilter/protocol/ipv6.pp | 46 +- types/nwfilter/protocol/mac.pp | 24 +- types/nwfilter/protocol/stp.pp | 56 +- types/nwfilter/protocol/tcp_udp_sctp.pp | 40 +- .../protocol/tcpipv6_udpipv6_sctpipv6.pp | 44 +- types/nwfilter/protocol/vlan.pp | 26 +- types/nwfilter/rule.pp | 36 +- types/profiles/devices.pp | 2 +- 42 files changed, 912 insertions(+), 912 deletions(-) diff --git a/README.md b/README.md index 5eda29d..bee71fd 100644 --- a/README.md +++ b/README.md @@ -149,7 +149,7 @@ libvirt::domain { 'my-domain': autostart => true, } ``` - + Define a domain (VM) with a bridged network: *the network device must exist* ``` diff --git a/REFERENCE.md b/REFERENCE.md index a8b69d4..347f94c 100644 --- a/REFERENCE.md +++ b/REFERENCE.md @@ -2084,8 +2084,8 @@ Alias of ```puppet Variant[Array[Libvirt::Domain::Device], String[1], Integer, Struct[{ - values => Optional[Variant[Hash, String[1],Integer, Libvirt::Domain::Device]], - attrs => Optional[Variant[String[1], Integer, Hash]], + values => Optional[Variant[Hash, String[1],Integer, Libvirt::Domain::Device]], + attrs => Optional[Variant[String[1], Integer, Hash]], }], Hash[String[1], Libvirt::Domain::Device]] ``` @@ -2097,12 +2097,12 @@ Alias of ```puppet Struct[{ - type => Enum['file', 'block', 'network', 'volume'], - device => Enum['floppy', 'disk', 'cdrom', 'lun'], - bus => String[1], - driver => Optional[Hash[String[1],String[1]]], - boot_order => Optional[Integer], - source => Optional[Hash[String[1], String[1]]], + type => Enum['file', 'block', 'network', 'volume'], + device => Enum['floppy', 'disk', 'cdrom', 'lun'], + bus => String[1], + driver => Optional[Hash[String[1],String[1]]], + boot_order => Optional[Integer], + source => Optional[Hash[String[1], String[1]]], }] ``` @@ -2114,24 +2114,24 @@ Alias of ```puppet Struct[{ - type => Optional[String[1]], - interface_type => Optional[Enum['network','bridge', 'vdpa', 'mcast', 'server', 'client', 'null', 'vds']], - network => Optional[String[1]], # deprecated, do not use - source => Optional[Hash[String[1],String[1]]], - portgroup => Optional[String[1]], # deprecated, do not use, use source hash instead - address => Optional[Hash[String[1],String[1]]], - mac => Optional[String[1]], - filter => Optional[Variant[ + type => Optional[String[1]], + interface_type => Optional[Enum['network','bridge', 'vdpa', 'mcast', 'server', 'client', 'null', 'vds']], + network => Optional[String[1]], # deprecated, do not use + source => Optional[Hash[String[1],String[1]]], + portgroup => Optional[String[1]], # deprecated, do not use, use source hash instead + address => Optional[Hash[String[1],String[1]]], + mac => Optional[String[1]], + filter => Optional[Variant[ + String[1], + Struct[{ + filterref => String[1], + parameters => Optional[Hash[ String[1], - Struct[{ - filterref => String[1], - parameters => Optional[Hash[ - String[1], - Variant[String[1],Array[String[1]]] - ]], - }], - ]], - boot_order => Optional[Integer], + Variant[String[1],Array[String[1]]] + ]], + }], + ]], + boot_order => Optional[Integer], }] ``` @@ -2143,17 +2143,17 @@ Alias of ```puppet Array[Optional[ - Struct[{ - filter => String[1], - parameters => Optional[ - Array[ - Hash[ - Pattern[/\A[A-Z]/], - Variant[String[1],Integer], - ] - ] + Struct[{ + filter => String[1], + parameters => Optional[ + Array[ + Hash[ + Pattern[/\A[A-Z]/], + Variant[String[1],Integer], ] - }] + ] + ] + }] ]] ``` @@ -2165,17 +2165,17 @@ Alias of ```puppet Struct[{ - inbound => Optional[Struct[{ - average => Optional[Integer], - peak => Optional[Integer], - burst => Optional[Integer], - floot => Optional[Integer], - }]], - outbound => Optional[Struct[{ - average => Optional[Integer], - peak => Optional[Integer], - burst => Optional[Integer], - }]], + inbound => Optional[Struct[{ + average => Optional[Integer], + peak => Optional[Integer], + burst => Optional[Integer], + floot => Optional[Integer], + }]], + outbound => Optional[Struct[{ + average => Optional[Integer], + peak => Optional[Integer], + burst => Optional[Integer], + }]], }] ``` @@ -2187,11 +2187,11 @@ Alias of ```puppet Variant[String[1], Struct[{ - name => String[1], - stp => Optional[Enum['on','off']], - delay => Optional[Integer], - macTableManager => Optional[Enum['kernel','libvirt']], - zone => Optional[String[1]], + name => String[1], + stp => Optional[Enum['on','off']], + delay => Optional[Integer], + macTableManager => Optional[Enum['kernel','libvirt']], + zone => Optional[String[1]], }]] ``` @@ -2203,29 +2203,29 @@ Alias of ```puppet Struct[{ - enable => Optional[Enum['yes','no']], - forwardPlainNames => Optional[Enum['yes','no']], - forwarder => Optional[Array[Struct[{ - addr => Optional[String[1]], - domain => Optional[String[1]], - }]]], - txt => Optional[Array[Struct[{ - name => Optional[String[1]], - value => Optional[String[1]], - }]]], - srv => Optional[Array[Struct[{ - service => String[1], - protocol => String[1], - domain => Optional[String[1]], - target => Optional[String[1]], - port => Optional[Integer], - priority => Optional[Integer], - weight => Optional[Integer], - }]]], - host => Optional[Array[Struct[{ - ip => String[1], - hostname => Array[String[1]], - }]]], + enable => Optional[Enum['yes','no']], + forwardPlainNames => Optional[Enum['yes','no']], + forwarder => Optional[Array[Struct[{ + addr => Optional[String[1]], + domain => Optional[String[1]], + }]]], + txt => Optional[Array[Struct[{ + name => Optional[String[1]], + value => Optional[String[1]], + }]]], + srv => Optional[Array[Struct[{ + service => String[1], + protocol => String[1], + domain => Optional[String[1]], + target => Optional[String[1]], + port => Optional[Integer], + priority => Optional[Integer], + weight => Optional[Integer], + }]]], + host => Optional[Array[Struct[{ + ip => String[1], + hostname => Array[String[1]], + }]]], }] ``` @@ -2237,9 +2237,9 @@ Alias of ```puppet Array[Struct[{ - 'dnsmasq:option' => Struct[{ - value => String[1], - }], + 'dnsmasq:option' => Struct[{ + value => String[1], + }], }]] ``` @@ -2251,8 +2251,8 @@ Alias of ```puppet Struct[{ - name => String[1], - localOnly => Optional[Enum['yes','no']], + name => String[1], + localOnly => Optional[Enum['yes','no']], }] ``` @@ -2264,36 +2264,36 @@ Alias of ```puppet Struct[{ - mode => Enum['nat','route','open','bridge','private','vepa','passthrough','hostdev'], - managed => Optional[Enum['yes','no']], - dev => Optional[String[1]], - nat => Optional[Struct[{ - addresses => Optional[Array[Struct[{ - start => String[1], - end => String[1], - }]]], - port => Optional[Struct[{ - start => Integer, - end => Integer, - }]], - ipv6 => Optional[Enum['yes']], - }]], - interface => Optional[Array[Struct[{ - dev => String[1], + mode => Enum['nat','route','open','bridge','private','vepa','passthrough','hostdev'], + managed => Optional[Enum['yes','no']], + dev => Optional[String[1]], + nat => Optional[Struct[{ + addresses => Optional[Array[Struct[{ + start => String[1], + end => String[1], }]]], - pf => Optional[Struct[{ - dev => String[1], + port => Optional[Struct[{ + start => Integer, + end => Integer, }]], - driver => Optional[Struct[{ - name => Enum['vfio','kvm'], - }]], - address => Optional[Array[Struct[{ - type => Optional[String[1]], - domain => Optional[String[1]], - bus => Optional[String[1]], - slot => Optional[String[1]], - function => Optional[String[1]], - }]]], + ipv6 => Optional[Enum['yes']], + }]], + interface => Optional[Array[Struct[{ + dev => String[1], + }]]], + pf => Optional[Struct[{ + dev => String[1], + }]], + driver => Optional[Struct[{ + name => Enum['vfio','kvm'], + }]], + address => Optional[Array[Struct[{ + type => Optional[String[1]], + domain => Optional[String[1]], + bus => Optional[String[1]], + slot => Optional[String[1]], + function => Optional[String[1]], + }]]], }] ``` @@ -2306,39 +2306,39 @@ Alias of ```puppet Struct[{ - address => Optional[String[1]], - netmask => Optional[String[1]], - prefix => Optional[String[1]], - family => Optional[String[1]], - localPtr => Optional[String[1]], - tftp => Optional[Array[Struct[{ - root => String[1], + address => Optional[String[1]], + netmask => Optional[String[1]], + prefix => Optional[String[1]], + family => Optional[String[1]], + localPtr => Optional[String[1]], + tftp => Optional[Array[Struct[{ + root => String[1], + }]]], + dhcp => Optional[Struct[{ + range => Optional[Array[Struct[{ + start => String[1], + end => String[1], + lease => Optional[Array[Struct[{ + expiry => Integer, + unit => Optional[Enum['seconds', 'minutes', 'hours']], + }]]], + unit => Optional[String[1]], }]]], - dhcp => Optional[Struct[{ - range => Optional[Array[Struct[{ - start => String[1], - end => String[1], - lease => Optional[Array[Struct[{ - expiry => Integer, - unit => Optional[Enum['seconds', 'minutes', 'hours']], - }]]], - unit => Optional[String[1]], - }]]], - host => Optional[Array[Struct[{ - mac => Optional[String[1]], - id => Optional[String[1]], - name => Optional[String[1]], - ip => String[1], - lease => Optional[Array[Struct[{ - expiry => Integer, - unit => Optional[Enum['seconds', 'minutes', 'hours']], - }]]], - }]]], - bootp => Optional[Struct[{ - file => Optional[String[1]], - server => Optional[String[1]], - }]], + host => Optional[Array[Struct[{ + mac => Optional[String[1]], + id => Optional[String[1]], + name => Optional[String[1]], + ip => String[1], + lease => Optional[Array[Struct[{ + expiry => Integer, + unit => Optional[Enum['seconds', 'minutes', 'hours']], + }]]], + }]]], + bootp => Optional[Struct[{ + file => Optional[String[1]], + server => Optional[String[1]], }]], + }]], }] ``` @@ -2350,8 +2350,8 @@ Alias of ```puppet Struct[{ - ipv6 => Optional[Enum['yes','no']], - trustGuestRxFilters => Optional[Enum['yes','no']], + ipv6 => Optional[Enum['yes','no']], + trustGuestRxFilters => Optional[Enum['yes','no']], }] ``` @@ -2363,7 +2363,7 @@ Alias of ```puppet Struct[{ - isolated => Optional[Enum['yes', 'no']], + isolated => Optional[Enum['yes', 'no']], }] ``` @@ -2375,14 +2375,14 @@ Alias of ```puppet Struct[{ - name => String[1], - trunk => Optional[Boolean], # for simple template only - vlan_tag => Optional[Variant[String[1],Array[String[1]]]], # for simple template only - vlan => Optional[Libvirt::Net::Vlan], - bandwith => Optional[Libvirt::Net::Bandwith], - virtualport => Optional[Libvirt::Net::Virtualport], - 'default' => Optional[Enum['yes']], - trustGuestRxFilters => Optional[Enum['yes', 'no']], + name => String[1], + trunk => Optional[Boolean], # for simple template only + vlan_tag => Optional[Variant[String[1],Array[String[1]]]], # for simple template only + vlan => Optional[Libvirt::Net::Vlan], + bandwith => Optional[Libvirt::Net::Bandwith], + virtualport => Optional[Libvirt::Net::Virtualport], + 'default' => Optional[Enum['yes']], + trustGuestRxFilters => Optional[Enum['yes', 'no']], }] ``` @@ -2395,12 +2395,12 @@ Alias of ```puppet Struct[{ - family => Optional[Enum['ipv6']], - address => String[1], - gateway => String[1], - netmask => Optional[String[1]], - prefix => Optional[String[1]], - metric => Optional[Integer], + family => Optional[Enum['ipv6']], + address => String[1], + gateway => String[1], + netmask => Optional[String[1]], + prefix => Optional[String[1]], + metric => Optional[Integer], }] ``` @@ -2412,15 +2412,15 @@ Alias of ```puppet Struct[{ - type => Optional[Enum['802.1Qbg', 'openvswitch']], - parameters => Optional[Array[Struct[{ - interfaceid => Optional[String[1]], - managerid => Optional[Integer], - typeid => Optional[Integer], - typeidversion => Optional[Integer], - instanceid => Optional[String[1]], - profileid => Optional[String[1]], - }]]], + type => Optional[Enum['802.1Qbg', 'openvswitch']], + parameters => Optional[Array[Struct[{ + interfaceid => Optional[String[1]], + managerid => Optional[Integer], + typeid => Optional[Integer], + typeidversion => Optional[Integer], + instanceid => Optional[String[1]], + profileid => Optional[String[1]], + }]]], }] ``` @@ -2432,11 +2432,11 @@ Alias of ```puppet Struct[{ - trunk => Optional[Enum['yes']], - tag => Array[Struct[{ - id => Integer, - nativeMode => Optional[Enum['untagged', 'tagged']], - }]], + trunk => Optional[Enum['yes']], + tag => Array[Struct[{ + id => Integer, + nativeMode => Optional[Enum['untagged', 'tagged']], + }]], }] ``` @@ -2466,35 +2466,35 @@ Alias of ```puppet Struct[{ - id => Enum['arp', 'rarp'], - match => Optional[Enum['no','yes']], - srcmacaddr => Optional[String[1]], - srcmacmask => Optional[String[1]], - dstmacaddr => Optional[String[1]], - dstmacmask => Optional[String[1]], - hwtype => Optional[Integer[0,256]], - protocoltype => Optional[Integer[0,256]], - opcode => Optional[Variant[ - Integer[0,256], - Enum['Request', - 'Reply', - 'Request_Reverse', - 'Reply_Reverse', - 'DRARP_Request', - 'DRARP_Reply', - 'DRARP_Error', - 'InARP_Request', - 'ARP_NAK'], - ]], - arpsrcmacaddr => Optional[String[1]], - arpdstmacaddr => Optional[String[1]], - arpsrcipaddr => Optional[String[1]], - arpsrcipmask => Optional[String[1]], - arpdstipaddr => Optional[String[1]], - arpdstipmask => Optional[String[1]], - gratuitous => Optional[Boolean], - comment => Optional[String[1,256]], - connlimit-above => Optional[Integer], + id => Enum['arp', 'rarp'], + match => Optional[Enum['no','yes']], + srcmacaddr => Optional[String[1]], + srcmacmask => Optional[String[1]], + dstmacaddr => Optional[String[1]], + dstmacmask => Optional[String[1]], + hwtype => Optional[Integer[0,256]], + protocoltype => Optional[Integer[0,256]], + opcode => Optional[Variant[ + Integer[0,256], + Enum['Request', + 'Reply', + 'Request_Reverse', + 'Reply_Reverse', + 'DRARP_Request', + 'DRARP_Reply', + 'DRARP_Error', + 'InARP_Request', + 'ARP_NAK'], + ]], + arpsrcmacaddr => Optional[String[1]], + arpdstmacaddr => Optional[String[1]], + arpsrcipaddr => Optional[String[1]], + arpsrcipmask => Optional[String[1]], + arpdstipaddr => Optional[String[1]], + arpdstipmask => Optional[String[1]], + gratuitous => Optional[Boolean], + comment => Optional[String[1,256]], + connlimit-above => Optional[Integer], }] ``` @@ -2506,23 +2506,23 @@ Alias of ```puppet Struct[{ - id => Enum['esp-ipv6', 'ah-ipv6', 'udplite-ipv6', 'all-ipv6'], - match => Optional[Enum['no','yes']], - srcmacaddr => Optional[String[1]], - srcipaddr => Optional[String[1]], - srcipmask => Optional[String[1]], - dstipaddr => Optional[String[1]], - dstipmask => Optional[String[1]], - srcipfrom => Optional[String[1]], - srcipto => Optional[String[1]], - dstipfrom => Optional[String[1]], - dstipto => Optional[String[1]], - dscp => Optional[Integer[0,256]], - comment => Optional[String[1,256]], - state => Optional[String[1]], - ipset => Optional[String[1]], - ipsetflags => Optional[String[1]], - connlimit-above => Optional[Integer], + id => Enum['esp-ipv6', 'ah-ipv6', 'udplite-ipv6', 'all-ipv6'], + match => Optional[Enum['no','yes']], + srcmacaddr => Optional[String[1]], + srcipaddr => Optional[String[1]], + srcipmask => Optional[String[1]], + dstipaddr => Optional[String[1]], + dstipmask => Optional[String[1]], + srcipfrom => Optional[String[1]], + srcipto => Optional[String[1]], + dstipfrom => Optional[String[1]], + dstipto => Optional[String[1]], + dscp => Optional[Integer[0,256]], + comment => Optional[String[1,256]], + state => Optional[String[1]], + ipset => Optional[String[1]], + ipsetflags => Optional[String[1]], + connlimit-above => Optional[Integer], }] ``` @@ -2534,28 +2534,28 @@ Alias of ```puppet Struct[{ - id => Enum['icmp'], - match => Optional[Enum['no','yes']], - srcmacaddr => Optional[String[1]], - srcmacmask => Optional[Stdlib::MAC], - dstmacaddr => Optional[String[1]], - dstmacmask => Optional[Stdlib::MAC], - srcipaddr => Optional[String[1]], - srcipmask => Optional[String[1]], - dstipaddr => Optional[String[1]], - dstipmask => Optional[String[1]], - srcipfrom => Optional[String[1]], - srcipto => Optional[String[1]], - dstipfrom => Optional[String[1]], - dstipto => Optional[String[1]], - type => Optional[Integer[0,65535]], - code => Optional[Integer[0,65535]], - dscp => Optional[Integer[0,256]], - comment => Optional[String[1,256]], - state => Optional[String[1]], - ipset => Optional[String[1]], - ipsetflags => Optional[String[1]], - connlimit-above => Optional[Integer], + id => Enum['icmp'], + match => Optional[Enum['no','yes']], + srcmacaddr => Optional[String[1]], + srcmacmask => Optional[Stdlib::MAC], + dstmacaddr => Optional[String[1]], + dstmacmask => Optional[Stdlib::MAC], + srcipaddr => Optional[String[1]], + srcipmask => Optional[String[1]], + dstipaddr => Optional[String[1]], + dstipmask => Optional[String[1]], + srcipfrom => Optional[String[1]], + srcipto => Optional[String[1]], + dstipfrom => Optional[String[1]], + dstipto => Optional[String[1]], + type => Optional[Integer[0,65535]], + code => Optional[Integer[0,65535]], + dscp => Optional[Integer[0,256]], + comment => Optional[String[1,256]], + state => Optional[String[1]], + ipset => Optional[String[1]], + ipsetflags => Optional[String[1]], + connlimit-above => Optional[Integer], }] ``` @@ -2567,25 +2567,25 @@ Alias of ```puppet Struct[{ - id => Enum['icmpv6'], - match => Optional[Enum['no','yes']], - srcmacaddr => Optional[String[1]], - srcipaddr => Optional[String[1]], - srcipmask => Optional[String[1]], - dstipaddr => Optional[String[1]], - dstipmask => Optional[String[1]], - srcipfrom => Optional[String[1]], - srcipto => Optional[String[1]], - dstipfrom => Optional[String[1]], - dstipto => Optional[String[1]], - type => Optional[Integer[0,65535]], - code => Optional[Integer[0,65535]], - dscp => Optional[Integer[0,256]], - comment => Optional[String[1,256]], - state => Optional[String[1]], - ipset => Optional[String[1]], - ipsetflags => Optional[String[1]], - connlimit-above => Optional[Integer], + id => Enum['icmpv6'], + match => Optional[Enum['no','yes']], + srcmacaddr => Optional[String[1]], + srcipaddr => Optional[String[1]], + srcipmask => Optional[String[1]], + dstipaddr => Optional[String[1]], + dstipmask => Optional[String[1]], + srcipfrom => Optional[String[1]], + srcipto => Optional[String[1]], + dstipfrom => Optional[String[1]], + dstipto => Optional[String[1]], + type => Optional[Integer[0,65535]], + code => Optional[Integer[0,65535]], + dscp => Optional[Integer[0,256]], + comment => Optional[String[1,256]], + state => Optional[String[1]], + ipset => Optional[String[1]], + ipsetflags => Optional[String[1]], + connlimit-above => Optional[Integer], }] ``` @@ -2597,26 +2597,26 @@ Alias of ```puppet Struct[{ - id => Enum['igmp', 'esp', 'ah', 'udplite', 'all'], - match => Optional[Enum['no','yes']], - srcmacaddr => Optional[String[1]], - srcmacmask => Optional[String[1]], - dstmacaddr => Optional[String[1]], - dstmacmask => Optional[String[1]], - srcipaddr => Optional[String[1]], - srcipmask => Optional[String[1]], - dstipaddr => Optional[String[1]], - dstipmask => Optional[String[1]], - srcipfrom => Optional[String[1]], - srcipto => Optional[String[1]], - dstipfrom => Optional[String[1]], - dstipto => Optional[String[1]], - dscp => Optional[Integer[0,256]], - comment => Optional[String[1,256]], - state => Optional[String[1]], - ipset => Optional[String[1]], - ipsetflags => Optional[String[1]], - connlimit-above => Optional[Integer], + id => Enum['igmp', 'esp', 'ah', 'udplite', 'all'], + match => Optional[Enum['no','yes']], + srcmacaddr => Optional[String[1]], + srcmacmask => Optional[String[1]], + dstmacaddr => Optional[String[1]], + dstmacmask => Optional[String[1]], + srcipaddr => Optional[String[1]], + srcipmask => Optional[String[1]], + dstipaddr => Optional[String[1]], + dstipmask => Optional[String[1]], + srcipfrom => Optional[String[1]], + srcipto => Optional[String[1]], + dstipfrom => Optional[String[1]], + dstipto => Optional[String[1]], + dscp => Optional[Integer[0,256]], + comment => Optional[String[1,256]], + state => Optional[String[1]], + ipset => Optional[String[1]], + ipsetflags => Optional[String[1]], + connlimit-above => Optional[Integer], }] ``` @@ -2628,28 +2628,28 @@ Alias of ```puppet Struct[{ - id => Enum['ip'], - match => Optional[Enum['no','yes']], - srcmacaddr => Optional[String[1]], - srcmacmask => Optional[String[1]], - dstmacaddr => Optional[String[1]], - dstmacmask => Optional[String[1]], - srcipaddr => Optional[String[1]], - srcipmask => Optional[String[1]], - dstipaddr => Optional[String[1]], - dstipmask => Optional[String[1]], - protocol => Optional[Variant[ - Integer[0,256], - Enum['tcp', 'udp', 'udplite', 'esp', 'ah', 'icmp', 'igmp', 'sctp'], - ]], - srcportstart => Variant[Integer[0,65535],Libvirt::Nwfilter::Param, Undef], - srcportend => Variant[Integer[0,65535],Libvirt::Nwfilter::Param, Undef], - dstportstart => Variant[Integer[0,65535],Libvirt::Nwfilter::Param, Undef], - dstportend => Variant[Integer[0,65535],Libvirt::Nwfilter::Param, Undef], - dscp => Variant[Integer[0,256],Libvirt::Nwfilter::Param, Undef], - protocolid => Variant[Integer[0,65535],Libvirt::Nwfilter::Param, Undef], - comment => Optional[String[1,256]], - connlimit-above => Variant[Integer,Libvirt::Nwfilter::Param, Undef], + id => Enum['ip'], + match => Optional[Enum['no','yes']], + srcmacaddr => Optional[String[1]], + srcmacmask => Optional[String[1]], + dstmacaddr => Optional[String[1]], + dstmacmask => Optional[String[1]], + srcipaddr => Optional[String[1]], + srcipmask => Optional[String[1]], + dstipaddr => Optional[String[1]], + dstipmask => Optional[String[1]], + protocol => Optional[Variant[ + Integer[0,256], + Enum['tcp', 'udp', 'udplite', 'esp', 'ah', 'icmp', 'igmp', 'sctp'], + ]], + srcportstart => Variant[Integer[0,65535],Libvirt::Nwfilter::Param, Undef], + srcportend => Variant[Integer[0,65535],Libvirt::Nwfilter::Param, Undef], + dstportstart => Variant[Integer[0,65535],Libvirt::Nwfilter::Param, Undef], + dstportend => Variant[Integer[0,65535],Libvirt::Nwfilter::Param, Undef], + dscp => Variant[Integer[0,256],Libvirt::Nwfilter::Param, Undef], + protocolid => Variant[Integer[0,65535],Libvirt::Nwfilter::Param, Undef], + comment => Optional[String[1,256]], + connlimit-above => Variant[Integer,Libvirt::Nwfilter::Param, Undef], }] ``` @@ -2661,29 +2661,29 @@ Alias of ```puppet Struct[{ - id => Enum['ipv6'], - match => Optional[Enum['no','yes']], - srcmacaddr => Optional[String[1]], - srcmacmask => Optional[String[1]], - dstmacaddr => Optional[String[1]], - dstmacmask => Optional[String[1]], - srcipaddr => Optional[String[1]], - srcipmask => Optional[String[1]], - dstipaddr => Optional[String[1]], - dstipmask => Optional[String[1]], - protocol => Optional[Variant[ - Integer[0,256], - Enum['tcp', 'udp', 'udplite', 'esp', 'ah', 'icmpv6', 'sctp'], - ]], - srcportstart => Variant[Integer[0,65535],Libvirt::Nwfilter::Param, Undef], - srcportend => Variant[Integer[0,65535],Libvirt::Nwfilter::Param, Undef], - dstportstart => Variant[Integer[0,65535],Libvirt::Nwfilter::Param, Undef], - dstportend => Variant[Integer[0,65535],Libvirt::Nwfilter::Param, Undef], - type => Variant[Integer[0,246],Libvirt::Nwfilter::Param, Undef], - typeend => Variant[Integer[0,246],Libvirt::Nwfilter::Param, Undef], - code => Variant[Integer[0,246],Libvirt::Nwfilter::Param, Undef], - comment => Optional[String[1,256]], - connlimit-above => Optional[Integer], + id => Enum['ipv6'], + match => Optional[Enum['no','yes']], + srcmacaddr => Optional[String[1]], + srcmacmask => Optional[String[1]], + dstmacaddr => Optional[String[1]], + dstmacmask => Optional[String[1]], + srcipaddr => Optional[String[1]], + srcipmask => Optional[String[1]], + dstipaddr => Optional[String[1]], + dstipmask => Optional[String[1]], + protocol => Optional[Variant[ + Integer[0,256], + Enum['tcp', 'udp', 'udplite', 'esp', 'ah', 'icmpv6', 'sctp'], + ]], + srcportstart => Variant[Integer[0,65535],Libvirt::Nwfilter::Param, Undef], + srcportend => Variant[Integer[0,65535],Libvirt::Nwfilter::Param, Undef], + dstportstart => Variant[Integer[0,65535],Libvirt::Nwfilter::Param, Undef], + dstportend => Variant[Integer[0,65535],Libvirt::Nwfilter::Param, Undef], + type => Variant[Integer[0,246],Libvirt::Nwfilter::Param, Undef], + typeend => Variant[Integer[0,246],Libvirt::Nwfilter::Param, Undef], + code => Variant[Integer[0,246],Libvirt::Nwfilter::Param, Undef], + comment => Optional[String[1,256]], + connlimit-above => Optional[Integer], }] ``` @@ -2695,18 +2695,18 @@ Alias of ```puppet Struct[{ - id => Enum['mac'], - match => Optional[Enum['no','yes']], - srcmacaddr => Optional[String[1]], - srcmacmask => Optional[String[1]], - dstmacaddr => Optional[String[1]], - dstmacmask => Optional[String[1]], - protocolid => Optional[Variant[ - Enum['arp', 'rarp', 'ipv4', 'ipv6'], - Pattern[/\A0x[0-9]{1,4}\Z/], - ]], - comment => Optional[String[1,256]], - connlimit-above => Optional[Integer], + id => Enum['mac'], + match => Optional[Enum['no','yes']], + srcmacaddr => Optional[String[1]], + srcmacmask => Optional[String[1]], + dstmacaddr => Optional[String[1]], + dstmacmask => Optional[String[1]], + protocolid => Optional[Variant[ + Enum['arp', 'rarp', 'ipv4', 'ipv6'], + Pattern[/\A0x[0-9]{1,4}\Z/], + ]], + comment => Optional[String[1,256]], + connlimit-above => Optional[Integer], }] ``` @@ -2718,34 +2718,34 @@ Alias of ```puppet Struct[{ - id => Enum['stp'], - match => Optional[Enum['no','yes']], - srcmacaddr => Optional[String[1]], - srcmacmask => Optional[String[1]], - type => Optional[Integer[0,256]], - flags => Optional[Integer[0,256]], - root-priority => Optional[Integer[0,65535]], - root-priority-hi => Optional[Integer[0,65535]], - root-address => Optional[String[1]], - root-address-mask => Optional[String[1]], - root-cost => Optional[Integer[0,2147483647]], - root-cost-hi => Optional[Integer[0,2147483647]], - sender-priority => Optional[Integer[0,65535]], - sender-priority-hi => Optional[Integer[0,65535]], - sender-address => Optional[String[1]], - sender-address-mask => Optional[String[1]], - port => Optional[Integer[0,65535]], - port-hi => Optional[Integer[0,65535]], - msg-age => Optional[Integer[0,65535]], - msg-age-hi => Optional[Integer[0,65535]], - max-age => Optional[Integer[0,65535]], - max-age-hi => Optional[Integer[0,65535]], - hello-time => Optional[Integer[0,65535]], - hello-time-hi => Optional[Integer[0,65535]], - forward-delay => Optional[Integer[0,65535]], - forward-delay-hi => Optional[Integer[0,65535]], - comment => Optional[String[1,256]], - connlimit-above => Optional[Integer], + id => Enum['stp'], + match => Optional[Enum['no','yes']], + srcmacaddr => Optional[String[1]], + srcmacmask => Optional[String[1]], + type => Optional[Integer[0,256]], + flags => Optional[Integer[0,256]], + root-priority => Optional[Integer[0,65535]], + root-priority-hi => Optional[Integer[0,65535]], + root-address => Optional[String[1]], + root-address-mask => Optional[String[1]], + root-cost => Optional[Integer[0,2147483647]], + root-cost-hi => Optional[Integer[0,2147483647]], + sender-priority => Optional[Integer[0,65535]], + sender-priority-hi => Optional[Integer[0,65535]], + sender-address => Optional[String[1]], + sender-address-mask => Optional[String[1]], + port => Optional[Integer[0,65535]], + port-hi => Optional[Integer[0,65535]], + msg-age => Optional[Integer[0,65535]], + msg-age-hi => Optional[Integer[0,65535]], + max-age => Optional[Integer[0,65535]], + max-age-hi => Optional[Integer[0,65535]], + hello-time => Optional[Integer[0,65535]], + hello-time-hi => Optional[Integer[0,65535]], + forward-delay => Optional[Integer[0,65535]], + forward-delay-hi => Optional[Integer[0,65535]], + comment => Optional[String[1,256]], + connlimit-above => Optional[Integer], }] ``` @@ -2757,26 +2757,26 @@ Alias of ```puppet Struct[{ - id => Enum['tcp', 'udp', 'sctp'], - match => Optional[Enum['no','yes']], - srcmacaddr => Optional[String[1]], - srcipaddr => Optional[String[1]], - srcipmask => Optional[String[1]], - dstipaddr => Optional[String[1]], - dstipmask => Optional[String[1]], - srcipfrom => Optional[String[1]], - srcipto => Optional[String[1]], - srcportstart => Optional[Integer[0,65535]], - srcportend => Optional[Integer[0,65535]], - dstportstart => Optional[Integer[0,65535]], - dstportend => Optional[Integer[0,65535]], - dscp => Optional[Integer[0,256]], - comment => Optional[String[1,256]], - state => Optional[String[1]], - flags => Optional[String[1]], - ipset => Optional[String[1]], - ipsetflags => Optional[String[1]], - connlimit-above => Optional[Integer], + id => Enum['tcp', 'udp', 'sctp'], + match => Optional[Enum['no','yes']], + srcmacaddr => Optional[String[1]], + srcipaddr => Optional[String[1]], + srcipmask => Optional[String[1]], + dstipaddr => Optional[String[1]], + dstipmask => Optional[String[1]], + srcipfrom => Optional[String[1]], + srcipto => Optional[String[1]], + srcportstart => Optional[Integer[0,65535]], + srcportend => Optional[Integer[0,65535]], + dstportstart => Optional[Integer[0,65535]], + dstportend => Optional[Integer[0,65535]], + dscp => Optional[Integer[0,256]], + comment => Optional[String[1,256]], + state => Optional[String[1]], + flags => Optional[String[1]], + ipset => Optional[String[1]], + ipsetflags => Optional[String[1]], + connlimit-above => Optional[Integer], }] ``` @@ -2788,28 +2788,28 @@ Alias of ```puppet Struct[{ - id => Enum['tcp-ipv6', 'udp-ipv6', 'sctp-ipv6'], - match => Optional[Enum['no','yes']], - srcmacaddr => Optional[String[1]], - srcipaddr => Optional[String[1]], - srcipmask => Optional[String[1]], - dstipaddr => Optional[String[1]], - dstipmask => Optional[String[1]], - srcipfrom => Optional[String[1]], - srcipto => Optional[String[1]], - dstipfrom => Optional[String[1]], - dstipto => Optional[String[1]], - srcportstart => Optional[Integer[0,65535]], - srcportend => Optional[Integer[0,65535]], - dstportstart => Optional[Integer[0,65535]], - dstportend => Optional[Integer[0,65535]], - dscp => Optional[Integer[0,256]], - comment => Optional[String[1,256]], - state => Optional[String[1]], - flags => Optional[String[1]], - ipset => Optional[String[1]], - ipsetflags => Optional[String[1]], - connlimit-above => Optional[Integer], + id => Enum['tcp-ipv6', 'udp-ipv6', 'sctp-ipv6'], + match => Optional[Enum['no','yes']], + srcmacaddr => Optional[String[1]], + srcipaddr => Optional[String[1]], + srcipmask => Optional[String[1]], + dstipaddr => Optional[String[1]], + dstipmask => Optional[String[1]], + srcipfrom => Optional[String[1]], + srcipto => Optional[String[1]], + dstipfrom => Optional[String[1]], + dstipto => Optional[String[1]], + srcportstart => Optional[Integer[0,65535]], + srcportend => Optional[Integer[0,65535]], + dstportstart => Optional[Integer[0,65535]], + dstportend => Optional[Integer[0,65535]], + dscp => Optional[Integer[0,256]], + comment => Optional[String[1,256]], + state => Optional[String[1]], + flags => Optional[String[1]], + ipset => Optional[String[1]], + ipsetflags => Optional[String[1]], + connlimit-above => Optional[Integer], }] ``` @@ -2821,19 +2821,19 @@ Alias of ```puppet Struct[{ - id => Enum['vlan'], - match => Optional[Enum['no','yes']], - srcmacaddr => Optional[String[1]], - srcmacmask => Optional[String[1]], - dstmacaddr => Optional[String[1]], - dstmacmask => Optional[String[1]], - vlanid => Optional[Integer[0,4095]], - encap_protocol => Optional[Variant[ - Enum['arp','ipv4','ipv6'], - Integer[0,65535] - ]], - comment => Optional[String[1,256]], - connlimit-above => Optional[Integer], + id => Enum['vlan'], + match => Optional[Enum['no','yes']], + srcmacaddr => Optional[String[1]], + srcmacmask => Optional[String[1]], + dstmacaddr => Optional[String[1]], + dstmacmask => Optional[String[1]], + vlanid => Optional[Integer[0,4095]], + encap_protocol => Optional[Variant[ + Enum['arp','ipv4','ipv6'], + Integer[0,65535] + ]], + comment => Optional[String[1,256]], + connlimit-above => Optional[Integer], }] ``` @@ -2845,24 +2845,24 @@ Alias of ```puppet Struct[{ - action => Enum['drop','reject','accept','return','continue'], - direction => Enum['in','out','inout'], - priority => Optional[Libvirt::Nwfilter::Priority], - statematch => Optional[Enum['0','false','1','true']], - protocols => Optional[Array[Optional[Variant[ - Libvirt::Nwfilter::Protocol::Mac, - Libvirt::Nwfilter::Protocol::Vlan, - Libvirt::Nwfilter::Protocol::Stp, - Libvirt::Nwfilter::Protocol::Arp_rarp, - Libvirt::Nwfilter::Protocol::Ipv4, - Libvirt::Nwfilter::Protocol::Ipv6, - Libvirt::Nwfilter::Protocol::Tcp_udp_sctp, - Libvirt::Nwfilter::Protocol::Icmp, - Libvirt::Nwfilter::Protocol::Igmp_esp_ah_udplite_all, - Libvirt::Nwfilter::Protocol::Tcpipv6_udpipv6_sctpipv6, - Libvirt::Nwfilter::Protocol::Icmpv6, - Libvirt::Nwfilter::Protocol::Espipv6_ahipv6_udpliteipv6_allipv6, - ]]]] + action => Enum['drop','reject','accept','return','continue'], + direction => Enum['in','out','inout'], + priority => Optional[Libvirt::Nwfilter::Priority], + statematch => Optional[Enum['0','false','1','true']], + protocols => Optional[Array[Optional[Variant[ + Libvirt::Nwfilter::Protocol::Mac, + Libvirt::Nwfilter::Protocol::Vlan, + Libvirt::Nwfilter::Protocol::Stp, + Libvirt::Nwfilter::Protocol::Arp_rarp, + Libvirt::Nwfilter::Protocol::Ipv4, + Libvirt::Nwfilter::Protocol::Ipv6, + Libvirt::Nwfilter::Protocol::Tcp_udp_sctp, + Libvirt::Nwfilter::Protocol::Icmp, + Libvirt::Nwfilter::Protocol::Igmp_esp_ah_udplite_all, + Libvirt::Nwfilter::Protocol::Tcpipv6_udpipv6_sctpipv6, + Libvirt::Nwfilter::Protocol::Icmpv6, + Libvirt::Nwfilter::Protocol::Espipv6_ahipv6_udpliteipv6_allipv6, + ]]]] }] ``` @@ -2881,7 +2881,7 @@ Alias of ```puppet Hash[String[1], Variant[ Struct[{ - 'profileconfig' => Optional[Struct[{ 'base' => Optional[String[1]] }]], + 'profileconfig' => Optional[Struct[{ 'base' => Optional[String[1]] }]], }], Libvirt::Domain::Device, ]] diff --git a/data/AlmaLinux/default.yaml b/data/AlmaLinux/default.yaml index 5cacb75..97a0509 100644 --- a/data/AlmaLinux/default.yaml +++ b/data/AlmaLinux/default.yaml @@ -2,8 +2,8 @@ # Defaults for AlmaLinux libvirt::qemu_hook_packages: - drbd: - - 'xmlstarlet' - - 'python3-libvirt' + drbd: + - 'xmlstarlet' + - 'python3-libvirt' libvirt::install::manage_domain_file: 'puppet:///modules/libvirt/scripts/manage-domains.python3' diff --git a/data/RedHat-family.yaml b/data/RedHat-family.yaml index fda2145..7ef097e 100644 --- a/data/RedHat-family.yaml +++ b/data/RedHat-family.yaml @@ -1,11 +1,11 @@ --- # Defaults for RedHat family -libvirt::libvirt_package_names: +libvirt::libvirt_package_names: - 'libvirt' - 'qemu-kvm' libvirt::qemu_hook_packages: - drbd: - - 'xmlstarlet' - - 'libvirt-python' + drbd: + - 'xmlstarlet' + - 'libvirt-python' diff --git a/data/common.yaml b/data/common.yaml index da663c3..4f33983 100644 --- a/data/common.yaml +++ b/data/common.yaml @@ -13,7 +13,7 @@ lookup_options: merge: 'hash' # default filtering chain priorities -# as descibed in +# as descibed in # https://libvirt.org/formatnwfilter.html#filtering-chain-priorities libvirt::filter_default_prio: stp: -810 @@ -25,12 +25,12 @@ libvirt::filter_default_prio: rarp: -400 # this tree is a hash of all elements in the xml, ordered in a tree -# every value that is not in there is handled as a attribute in the +# every value that is not in there is handled as a attribute in the # generic template. libvirt::tree_network: metadata: {} - bridge: {} - domain: {} + bridge: {} + domain: {} forward: nat: address: {} @@ -40,8 +40,8 @@ libvirt::tree_network: driver: {} address: {} bandwith: - inbound: {} - outbound: {} + inbound: {} + outbound: {} vlan: tag: {} port: {} diff --git a/data/profiles/default_ignore.yaml b/data/profiles/default_ignore.yaml index 69b4e3b..6e76ceb 100644 --- a/data/profiles/default_ignore.yaml +++ b/data/profiles/default_ignore.yaml @@ -5,7 +5,7 @@ # the libvirt XML autput with the puppet XML generated. # libvirt::profiles::ignore: - default: + default: - '/domain/currentMemory' - '/domain/devices/disk/address' - '/domain/devices/emulator' diff --git a/data/profiles/nwfilter_default_v7.yaml b/data/profiles/nwfilter_default_v7.yaml index 85a6595..e9a6c1f 100644 --- a/data/profiles/nwfilter_default_v7.yaml +++ b/data/profiles/nwfilter_default_v7.yaml @@ -330,7 +330,7 @@ libvirt::default_nwfilters: filterref: - filter: 'qemu-announce-self-rarp' - filter: 'no-other-rarp-traffic' - + fil_no-arp-mac-spoofing: chain: 'arp-mac' priority: -520 diff --git a/manifests/init.pp b/manifests/init.pp index 8fad9e0..7a89482 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -255,7 +255,7 @@ $load_nwfilter_set.each | String[1] $i| { create_resources('libvirt::nwfilter', $default_nwfilters[$i], { - 'template' => 'generic', + 'template' => 'generic', }) } diff --git a/manifests/network.pp b/manifests/network.pp index f50816b..379496f 100644 --- a/manifests/network.pp +++ b/manifests/network.pp @@ -134,22 +134,22 @@ if ($ensure != 'absent') { if $template == 'generic' { $content = libvirt::normalxml(epp('libvirt/network/generic.xml.epp', { - 'networkname' => $title, - 'tree' => $libvirt::tree_network, - 'metadata' => $metadata, - 'mtu' => $mtu, - 'bridge' => $bridge, - 'domain' => $domain, - 'forward' => $forward, - 'bandwith' => $bandwith, - 'vlan' => $vlan, - 'port' => $port, - 'portgroups' => $portgroups, - 'ips' => $ips, - 'routes' => $routes, - 'dns' => $dns, - 'dnsmasq_options' => $dnsmasq_options, - 'virtualport' => $virtualport, + 'networkname' => $title, + 'tree' => $libvirt::tree_network, + 'metadata' => $metadata, + 'mtu' => $mtu, + 'bridge' => $bridge, + 'domain' => $domain, + 'forward' => $forward, + 'bandwith' => $bandwith, + 'vlan' => $vlan, + 'port' => $port, + 'portgroups' => $portgroups, + 'ips' => $ips, + 'routes' => $routes, + 'dns' => $dns, + 'dnsmasq_options' => $dnsmasq_options, + 'virtualport' => $virtualport, })) } else { if ! ($bridge =~ Undef or $bridge =~ String) { diff --git a/manifests/nwfilter.pp b/manifests/nwfilter.pp index 08cbb13..96ff549 100644 --- a/manifests/nwfilter.pp +++ b/manifests/nwfilter.pp @@ -83,11 +83,11 @@ $content = libvirt::normalxml(template('libvirt/nwfilter/simple.xml.erb')) } else { $content = libvirt::normalxml(epp('libvirt/nwfilter/generic.xml.epp', { - filtername => $title, - chain => $chain, - priority => pick($priority, $libvirt::filter_default_prio[$chain], 500), - rules => $rules, - filterref => $filterref, + filtername => $title, + chain => $chain, + priority => pick($priority, $libvirt::filter_default_prio[$chain], 500), + rules => $rules, + filterref => $filterref, })) } } diff --git a/manifests/service.pp b/manifests/service.pp index cce9c6e..e55e621 100644 --- a/manifests/service.pp +++ b/manifests/service.pp @@ -44,10 +44,10 @@ Libvirtd_conf <| |> ~> Service<| tag=='libvirt-libvirtd-conf' |> pick($modular_services, { 'libvirtd' => { - 'ensure' => $service_ensure, - 'name' => $service_name, - 'enable' => $service_enable, - 'tag' => 'libvirt-libvirtd-conf', + 'ensure' => $service_ensure, + 'name' => $service_name, + 'enable' => $service_enable, + 'tag' => 'libvirt-libvirtd-conf', } }).each |$key, $value| { service { $key: * => $value, diff --git a/types/domain/device.pp b/types/domain/device.pp index ce5f99f..351bd60 100644 --- a/types/domain/device.pp +++ b/types/domain/device.pp @@ -4,8 +4,8 @@ String[1], Integer, Struct[{ - values => Optional[Variant[Hash, String[1],Integer, Libvirt::Domain::Device]], - attrs => Optional[Variant[String[1], Integer, Hash]], + values => Optional[Variant[Hash, String[1],Integer, Libvirt::Domain::Device]], + attrs => Optional[Variant[String[1], Integer, Hash]], }], Hash[String[1], Libvirt::Domain::Device], ] diff --git a/types/domain/disk.pp b/types/domain/disk.pp index 3a8c81f..bfcef13 100644 --- a/types/domain/disk.pp +++ b/types/domain/disk.pp @@ -1,9 +1,9 @@ # A disk of a Domain type Libvirt::Domain::Disk = Struct[{ - type => Enum['file', 'block', 'network', 'volume'], - device => Enum['floppy', 'disk', 'cdrom', 'lun'], - bus => String[1], - driver => Optional[Hash[String[1],String[1]]], - boot_order => Optional[Integer], - source => Optional[Hash[String[1], String[1]]], + type => Enum['file', 'block', 'network', 'volume'], + device => Enum['floppy', 'disk', 'cdrom', 'lun'], + bus => String[1], + driver => Optional[Hash[String[1],String[1]]], + boot_order => Optional[Integer], + source => Optional[Hash[String[1], String[1]]], }] diff --git a/types/domain/interface.pp b/types/domain/interface.pp index bb704b2..5f092a5 100644 --- a/types/domain/interface.pp +++ b/types/domain/interface.pp @@ -1,21 +1,21 @@ # A interface of a Domain type Libvirt::Domain::Interface = Struct[{ - type => Optional[String[1]], - interface_type => Optional[Enum['network','bridge', 'vdpa', 'mcast', 'server', 'client', 'null', 'vds']], - network => Optional[String[1]], # deprecated, do not use - source => Optional[Hash[String[1],String[1]]], - portgroup => Optional[String[1]], # deprecated, do not use, use source hash instead - address => Optional[Hash[String[1],String[1]]], - mac => Optional[String[1]], - filter => Optional[Variant[ + type => Optional[String[1]], + interface_type => Optional[Enum['network','bridge', 'vdpa', 'mcast', 'server', 'client', 'null', 'vds']], + network => Optional[String[1]], # deprecated, do not use + source => Optional[Hash[String[1],String[1]]], + portgroup => Optional[String[1]], # deprecated, do not use, use source hash instead + address => Optional[Hash[String[1],String[1]]], + mac => Optional[String[1]], + filter => Optional[Variant[ + String[1], + Struct[{ + filterref => String[1], + parameters => Optional[Hash[ String[1], - Struct[{ - filterref => String[1], - parameters => Optional[Hash[ - String[1], - Variant[String[1],Array[String[1]]] - ]], - }], - ]], - boot_order => Optional[Integer], + Variant[String[1],Array[String[1]]] + ]], + }], + ]], + boot_order => Optional[Integer], }] diff --git a/types/filterref.pp b/types/filterref.pp index 0b9f300..b291879 100644 --- a/types/filterref.pp +++ b/types/filterref.pp @@ -1,14 +1,14 @@ # an array for nwfilter references type Libvirt::Filterref = Array[Optional[ - Struct[{ - filter => String[1], - parameters => Optional[ - Array[ - Hash[ - Pattern[/\A[A-Z]/], - Variant[String[1],Integer], - ] - ] + Struct[{ + filter => String[1], + parameters => Optional[ + Array[ + Hash[ + Pattern[/\A[A-Z]/], + Variant[String[1],Integer], ] - }] + ] + ] + }] ]] diff --git a/types/net/bandwith.pp b/types/net/bandwith.pp index e53e7c2..4c116e4 100644 --- a/types/net/bandwith.pp +++ b/types/net/bandwith.pp @@ -1,14 +1,14 @@ # network metadata type Libvirt::Net::Bandwith = Struct[{ - inbound => Optional[Struct[{ - average => Optional[Integer], - peak => Optional[Integer], - burst => Optional[Integer], - floot => Optional[Integer], - }]], - outbound => Optional[Struct[{ - average => Optional[Integer], - peak => Optional[Integer], - burst => Optional[Integer], - }]], + inbound => Optional[Struct[{ + average => Optional[Integer], + peak => Optional[Integer], + burst => Optional[Integer], + floot => Optional[Integer], + }]], + outbound => Optional[Struct[{ + average => Optional[Integer], + peak => Optional[Integer], + burst => Optional[Integer], + }]], }] diff --git a/types/net/bridge.pp b/types/net/bridge.pp index b84d51e..3518cb8 100644 --- a/types/net/bridge.pp +++ b/types/net/bridge.pp @@ -2,10 +2,10 @@ type Libvirt::Net::Bridge = Variant[ String[1], Struct[{ - name => String[1], - stp => Optional[Enum['on','off']], - delay => Optional[Integer], - macTableManager => Optional[Enum['kernel','libvirt']], - zone => Optional[String[1]], + name => String[1], + stp => Optional[Enum['on','off']], + delay => Optional[Integer], + macTableManager => Optional[Enum['kernel','libvirt']], + zone => Optional[String[1]], }] ] diff --git a/types/net/dns.pp b/types/net/dns.pp index b4d7970..c52f0bc 100644 --- a/types/net/dns.pp +++ b/types/net/dns.pp @@ -1,26 +1,26 @@ # network dns type Libvirt::Net::Dns = Struct[{ - enable => Optional[Enum['yes','no']], - forwardPlainNames => Optional[Enum['yes','no']], - forwarder => Optional[Array[Struct[{ - addr => Optional[String[1]], - domain => Optional[String[1]], - }]]], - txt => Optional[Array[Struct[{ - name => Optional[String[1]], - value => Optional[String[1]], - }]]], - srv => Optional[Array[Struct[{ - service => String[1], - protocol => String[1], - domain => Optional[String[1]], - target => Optional[String[1]], - port => Optional[Integer], - priority => Optional[Integer], - weight => Optional[Integer], - }]]], - host => Optional[Array[Struct[{ - ip => String[1], - hostname => Array[String[1]], - }]]], + enable => Optional[Enum['yes','no']], + forwardPlainNames => Optional[Enum['yes','no']], + forwarder => Optional[Array[Struct[{ + addr => Optional[String[1]], + domain => Optional[String[1]], + }]]], + txt => Optional[Array[Struct[{ + name => Optional[String[1]], + value => Optional[String[1]], + }]]], + srv => Optional[Array[Struct[{ + service => String[1], + protocol => String[1], + domain => Optional[String[1]], + target => Optional[String[1]], + port => Optional[Integer], + priority => Optional[Integer], + weight => Optional[Integer], + }]]], + host => Optional[Array[Struct[{ + ip => String[1], + hostname => Array[String[1]], + }]]], }] diff --git a/types/net/dnsmasq_options.pp b/types/net/dnsmasq_options.pp index 16d2652..35548a6 100644 --- a/types/net/dnsmasq_options.pp +++ b/types/net/dnsmasq_options.pp @@ -1,6 +1,6 @@ # network dnsmasq_options type Libvirt::Net::Dnsmasq_options = Array[Struct[{ - 'dnsmasq:option' => Struct[{ - value => String[1], - }], + 'dnsmasq:option' => Struct[{ + value => String[1], + }], }]] diff --git a/types/net/domain.pp b/types/net/domain.pp index 04199e5..714f5d5 100644 --- a/types/net/domain.pp +++ b/types/net/domain.pp @@ -1,5 +1,5 @@ # network domain type Libvirt::Net::Domain = Struct[{ - name => String[1], - localOnly => Optional[Enum['yes','no']], + name => String[1], + localOnly => Optional[Enum['yes','no']], }] diff --git a/types/net/forward.pp b/types/net/forward.pp index d15be34..3990c82 100644 --- a/types/net/forward.pp +++ b/types/net/forward.pp @@ -1,33 +1,33 @@ # network forward type Libvirt::Net::Forward = Struct[{ - mode => Enum['nat','route','open','bridge','private','vepa','passthrough','hostdev'], - managed => Optional[Enum['yes','no']], - dev => Optional[String[1]], - nat => Optional[Struct[{ - addresses => Optional[Array[Struct[{ - start => String[1], - end => String[1], - }]]], - port => Optional[Struct[{ - start => Integer, - end => Integer, - }]], - ipv6 => Optional[Enum['yes']], - }]], - interface => Optional[Array[Struct[{ - dev => String[1], + mode => Enum['nat','route','open','bridge','private','vepa','passthrough','hostdev'], + managed => Optional[Enum['yes','no']], + dev => Optional[String[1]], + nat => Optional[Struct[{ + addresses => Optional[Array[Struct[{ + start => String[1], + end => String[1], }]]], - pf => Optional[Struct[{ - dev => String[1], - }]], - driver => Optional[Struct[{ - name => Enum['vfio','kvm'], + port => Optional[Struct[{ + start => Integer, + end => Integer, }]], - address => Optional[Array[Struct[{ - type => Optional[String[1]], - domain => Optional[String[1]], - bus => Optional[String[1]], - slot => Optional[String[1]], - function => Optional[String[1]], - }]]], + ipv6 => Optional[Enum['yes']], + }]], + interface => Optional[Array[Struct[{ + dev => String[1], + }]]], + pf => Optional[Struct[{ + dev => String[1], + }]], + driver => Optional[Struct[{ + name => Enum['vfio','kvm'], + }]], + address => Optional[Array[Struct[{ + type => Optional[String[1]], + domain => Optional[String[1]], + bus => Optional[String[1]], + slot => Optional[String[1]], + function => Optional[String[1]], + }]]], }] diff --git a/types/net/ip.pp b/types/net/ip.pp index fcfd174..e610969 100644 --- a/types/net/ip.pp +++ b/types/net/ip.pp @@ -1,37 +1,37 @@ # network ip: # The IP element sets up NAT'ing and an optional DHCP server local to the host. type Libvirt::Net::IP = Struct[{ - address => Optional[String[1]], - netmask => Optional[String[1]], - prefix => Optional[String[1]], - family => Optional[String[1]], - localPtr => Optional[String[1]], - tftp => Optional[Array[Struct[{ - root => String[1], + address => Optional[String[1]], + netmask => Optional[String[1]], + prefix => Optional[String[1]], + family => Optional[String[1]], + localPtr => Optional[String[1]], + tftp => Optional[Array[Struct[{ + root => String[1], + }]]], + dhcp => Optional[Struct[{ + range => Optional[Array[Struct[{ + start => String[1], + end => String[1], + lease => Optional[Array[Struct[{ + expiry => Integer, + unit => Optional[Enum['seconds', 'minutes', 'hours']], + }]]], + unit => Optional[String[1]], }]]], - dhcp => Optional[Struct[{ - range => Optional[Array[Struct[{ - start => String[1], - end => String[1], - lease => Optional[Array[Struct[{ - expiry => Integer, - unit => Optional[Enum['seconds', 'minutes', 'hours']], - }]]], - unit => Optional[String[1]], - }]]], - host => Optional[Array[Struct[{ - mac => Optional[String[1]], - id => Optional[String[1]], - name => Optional[String[1]], - ip => String[1], - lease => Optional[Array[Struct[{ - expiry => Integer, - unit => Optional[Enum['seconds', 'minutes', 'hours']], - }]]], - }]]], - bootp => Optional[Struct[{ - file => Optional[String[1]], - server => Optional[String[1]], - }]], + host => Optional[Array[Struct[{ + mac => Optional[String[1]], + id => Optional[String[1]], + name => Optional[String[1]], + ip => String[1], + lease => Optional[Array[Struct[{ + expiry => Integer, + unit => Optional[Enum['seconds', 'minutes', 'hours']], + }]]], + }]]], + bootp => Optional[Struct[{ + file => Optional[String[1]], + server => Optional[String[1]], }]], + }]], }] diff --git a/types/net/metadata.pp b/types/net/metadata.pp index cecec51..bb90440 100644 --- a/types/net/metadata.pp +++ b/types/net/metadata.pp @@ -1,5 +1,5 @@ # network metadata type Libvirt::Net::Metadata = Struct[{ - ipv6 => Optional[Enum['yes','no']], - trustGuestRxFilters => Optional[Enum['yes','no']], + ipv6 => Optional[Enum['yes','no']], + trustGuestRxFilters => Optional[Enum['yes','no']], }] diff --git a/types/net/port.pp b/types/net/port.pp index 3eb1f74..bab6330 100644 --- a/types/net/port.pp +++ b/types/net/port.pp @@ -1,4 +1,4 @@ # network port type Libvirt::Net::Port = Struct[{ - isolated => Optional[Enum['yes', 'no']], + isolated => Optional[Enum['yes', 'no']], }] diff --git a/types/net/portgroup.pp b/types/net/portgroup.pp index 51ffb2c..4197a69 100644 --- a/types/net/portgroup.pp +++ b/types/net/portgroup.pp @@ -1,11 +1,11 @@ # network portgroup type Libvirt::Net::Portgroup = Struct[{ - name => String[1], - trunk => Optional[Boolean], # for simple template only - vlan_tag => Optional[Variant[String[1],Array[String[1]]]], # for simple template only - vlan => Optional[Libvirt::Net::Vlan], - bandwith => Optional[Libvirt::Net::Bandwith], - virtualport => Optional[Libvirt::Net::Virtualport], - 'default' => Optional[Enum['yes']], - trustGuestRxFilters => Optional[Enum['yes', 'no']], + name => String[1], + trunk => Optional[Boolean], # for simple template only + vlan_tag => Optional[Variant[String[1],Array[String[1]]]], # for simple template only + vlan => Optional[Libvirt::Net::Vlan], + bandwith => Optional[Libvirt::Net::Bandwith], + virtualport => Optional[Libvirt::Net::Virtualport], + 'default' => Optional[Enum['yes']], + trustGuestRxFilters => Optional[Enum['yes', 'no']], }] diff --git a/types/net/route.pp b/types/net/route.pp index cc69d9a..cd95629 100644 --- a/types/net/route.pp +++ b/types/net/route.pp @@ -1,10 +1,10 @@ # network route: # static routes type Libvirt::Net::Route = Struct[{ - family => Optional[Enum['ipv6']], - address => String[1], - gateway => String[1], - netmask => Optional[String[1]], - prefix => Optional[String[1]], - metric => Optional[Integer], + family => Optional[Enum['ipv6']], + address => String[1], + gateway => String[1], + netmask => Optional[String[1]], + prefix => Optional[String[1]], + metric => Optional[Integer], }] diff --git a/types/net/virtualport.pp b/types/net/virtualport.pp index 121f650..e9ff46a 100644 --- a/types/net/virtualport.pp +++ b/types/net/virtualport.pp @@ -1,12 +1,12 @@ # network virtualport type Libvirt::Net::Virtualport = Struct[{ - type => Optional[Enum['802.1Qbg', 'openvswitch']], - parameters => Optional[Array[Struct[{ - interfaceid => Optional[String[1]], - managerid => Optional[Integer], - typeid => Optional[Integer], - typeidversion => Optional[Integer], - instanceid => Optional[String[1]], - profileid => Optional[String[1]], - }]]], + type => Optional[Enum['802.1Qbg', 'openvswitch']], + parameters => Optional[Array[Struct[{ + interfaceid => Optional[String[1]], + managerid => Optional[Integer], + typeid => Optional[Integer], + typeidversion => Optional[Integer], + instanceid => Optional[String[1]], + profileid => Optional[String[1]], + }]]], }] diff --git a/types/net/vlan.pp b/types/net/vlan.pp index 232b4f0..19fe3a8 100644 --- a/types/net/vlan.pp +++ b/types/net/vlan.pp @@ -1,8 +1,8 @@ # network vlan type Libvirt::Net::Vlan = Struct[{ - trunk => Optional[Enum['yes']], - tag => Array[Struct[{ - id => Integer, - nativeMode => Optional[Enum['untagged', 'tagged']], - }]], + trunk => Optional[Enum['yes']], + tag => Array[Struct[{ + id => Integer, + nativeMode => Optional[Enum['untagged', 'tagged']], + }]], }] diff --git a/types/nwfilter/protocol/arp_rarp.pp b/types/nwfilter/protocol/arp_rarp.pp index aa9d5f3..baddbab 100644 --- a/types/nwfilter/protocol/arp_rarp.pp +++ b/types/nwfilter/protocol/arp_rarp.pp @@ -1,32 +1,32 @@ # nwfilter rule protocol of ARP/RARP type Libvirt::Nwfilter::Protocol::Arp_rarp = Struct[{ - id => Enum['arp', 'rarp'], - match => Optional[Enum['no','yes']], - srcmacaddr => Optional[String[1]], - srcmacmask => Optional[String[1]], - dstmacaddr => Optional[String[1]], - dstmacmask => Optional[String[1]], - hwtype => Optional[Integer[0,256]], - protocoltype => Optional[Integer[0,256]], - opcode => Optional[Variant[ - Integer[0,256], - Enum['Request', - 'Reply', - 'Request_Reverse', - 'Reply_Reverse', - 'DRARP_Request', - 'DRARP_Reply', - 'DRARP_Error', - 'InARP_Request', - 'ARP_NAK'], - ]], - arpsrcmacaddr => Optional[String[1]], - arpdstmacaddr => Optional[String[1]], - arpsrcipaddr => Optional[String[1]], - arpsrcipmask => Optional[String[1]], - arpdstipaddr => Optional[String[1]], - arpdstipmask => Optional[String[1]], - gratuitous => Optional[Boolean], - comment => Optional[String[1,256]], - connlimit-above => Optional[Integer], + id => Enum['arp', 'rarp'], + match => Optional[Enum['no','yes']], + srcmacaddr => Optional[String[1]], + srcmacmask => Optional[String[1]], + dstmacaddr => Optional[String[1]], + dstmacmask => Optional[String[1]], + hwtype => Optional[Integer[0,256]], + protocoltype => Optional[Integer[0,256]], + opcode => Optional[Variant[ + Integer[0,256], + Enum['Request', + 'Reply', + 'Request_Reverse', + 'Reply_Reverse', + 'DRARP_Request', + 'DRARP_Reply', + 'DRARP_Error', + 'InARP_Request', + 'ARP_NAK'], + ]], + arpsrcmacaddr => Optional[String[1]], + arpdstmacaddr => Optional[String[1]], + arpsrcipaddr => Optional[String[1]], + arpsrcipmask => Optional[String[1]], + arpdstipaddr => Optional[String[1]], + arpdstipmask => Optional[String[1]], + gratuitous => Optional[Boolean], + comment => Optional[String[1,256]], + connlimit-above => Optional[Integer], }] diff --git a/types/nwfilter/protocol/espipv6_ahipv6_udpliteipv6_allipv6.pp b/types/nwfilter/protocol/espipv6_ahipv6_udpliteipv6_allipv6.pp index 13dca3c..7c1422f 100644 --- a/types/nwfilter/protocol/espipv6_ahipv6_udpliteipv6_allipv6.pp +++ b/types/nwfilter/protocol/espipv6_ahipv6_udpliteipv6_allipv6.pp @@ -1,20 +1,20 @@ # nwfilter rule protocol of ESP, AH, UDPLITE, ALL over IPv6 type Libvirt::Nwfilter::Protocol::Espipv6_ahipv6_udpliteipv6_allipv6 = Struct[{ - id => Enum['esp-ipv6', 'ah-ipv6', 'udplite-ipv6', 'all-ipv6'], - match => Optional[Enum['no','yes']], - srcmacaddr => Optional[String[1]], - srcipaddr => Optional[String[1]], - srcipmask => Optional[String[1]], - dstipaddr => Optional[String[1]], - dstipmask => Optional[String[1]], - srcipfrom => Optional[String[1]], - srcipto => Optional[String[1]], - dstipfrom => Optional[String[1]], - dstipto => Optional[String[1]], - dscp => Optional[Integer[0,256]], - comment => Optional[String[1,256]], - state => Optional[String[1]], - ipset => Optional[String[1]], - ipsetflags => Optional[String[1]], - connlimit-above => Optional[Integer], + id => Enum['esp-ipv6', 'ah-ipv6', 'udplite-ipv6', 'all-ipv6'], + match => Optional[Enum['no','yes']], + srcmacaddr => Optional[String[1]], + srcipaddr => Optional[String[1]], + srcipmask => Optional[String[1]], + dstipaddr => Optional[String[1]], + dstipmask => Optional[String[1]], + srcipfrom => Optional[String[1]], + srcipto => Optional[String[1]], + dstipfrom => Optional[String[1]], + dstipto => Optional[String[1]], + dscp => Optional[Integer[0,256]], + comment => Optional[String[1,256]], + state => Optional[String[1]], + ipset => Optional[String[1]], + ipsetflags => Optional[String[1]], + connlimit-above => Optional[Integer], }] diff --git a/types/nwfilter/protocol/icmp.pp b/types/nwfilter/protocol/icmp.pp index 492af70..8e93bba 100644 --- a/types/nwfilter/protocol/icmp.pp +++ b/types/nwfilter/protocol/icmp.pp @@ -1,25 +1,25 @@ # nwfilter rule protocol of icmp type Libvirt::Nwfilter::Protocol::Icmp = Struct[{ - id => Enum['icmp'], - match => Optional[Enum['no','yes']], - srcmacaddr => Optional[String[1]], - srcmacmask => Optional[Stdlib::MAC], - dstmacaddr => Optional[String[1]], - dstmacmask => Optional[Stdlib::MAC], - srcipaddr => Optional[String[1]], - srcipmask => Optional[String[1]], - dstipaddr => Optional[String[1]], - dstipmask => Optional[String[1]], - srcipfrom => Optional[String[1]], - srcipto => Optional[String[1]], - dstipfrom => Optional[String[1]], - dstipto => Optional[String[1]], - type => Optional[Integer[0,65535]], - code => Optional[Integer[0,65535]], - dscp => Optional[Integer[0,256]], - comment => Optional[String[1,256]], - state => Optional[String[1]], - ipset => Optional[String[1]], - ipsetflags => Optional[String[1]], - connlimit-above => Optional[Integer], + id => Enum['icmp'], + match => Optional[Enum['no','yes']], + srcmacaddr => Optional[String[1]], + srcmacmask => Optional[Stdlib::MAC], + dstmacaddr => Optional[String[1]], + dstmacmask => Optional[Stdlib::MAC], + srcipaddr => Optional[String[1]], + srcipmask => Optional[String[1]], + dstipaddr => Optional[String[1]], + dstipmask => Optional[String[1]], + srcipfrom => Optional[String[1]], + srcipto => Optional[String[1]], + dstipfrom => Optional[String[1]], + dstipto => Optional[String[1]], + type => Optional[Integer[0,65535]], + code => Optional[Integer[0,65535]], + dscp => Optional[Integer[0,256]], + comment => Optional[String[1,256]], + state => Optional[String[1]], + ipset => Optional[String[1]], + ipsetflags => Optional[String[1]], + connlimit-above => Optional[Integer], }] diff --git a/types/nwfilter/protocol/icmpv6.pp b/types/nwfilter/protocol/icmpv6.pp index c455e34..c7f8eb7 100644 --- a/types/nwfilter/protocol/icmpv6.pp +++ b/types/nwfilter/protocol/icmpv6.pp @@ -1,22 +1,22 @@ # nwfilter rule protocol of icmpv6 type Libvirt::Nwfilter::Protocol::Icmpv6 = Struct[{ - id => Enum['icmpv6'], - match => Optional[Enum['no','yes']], - srcmacaddr => Optional[String[1]], - srcipaddr => Optional[String[1]], - srcipmask => Optional[String[1]], - dstipaddr => Optional[String[1]], - dstipmask => Optional[String[1]], - srcipfrom => Optional[String[1]], - srcipto => Optional[String[1]], - dstipfrom => Optional[String[1]], - dstipto => Optional[String[1]], - type => Optional[Integer[0,65535]], - code => Optional[Integer[0,65535]], - dscp => Optional[Integer[0,256]], - comment => Optional[String[1,256]], - state => Optional[String[1]], - ipset => Optional[String[1]], - ipsetflags => Optional[String[1]], - connlimit-above => Optional[Integer], + id => Enum['icmpv6'], + match => Optional[Enum['no','yes']], + srcmacaddr => Optional[String[1]], + srcipaddr => Optional[String[1]], + srcipmask => Optional[String[1]], + dstipaddr => Optional[String[1]], + dstipmask => Optional[String[1]], + srcipfrom => Optional[String[1]], + srcipto => Optional[String[1]], + dstipfrom => Optional[String[1]], + dstipto => Optional[String[1]], + type => Optional[Integer[0,65535]], + code => Optional[Integer[0,65535]], + dscp => Optional[Integer[0,256]], + comment => Optional[String[1,256]], + state => Optional[String[1]], + ipset => Optional[String[1]], + ipsetflags => Optional[String[1]], + connlimit-above => Optional[Integer], }] diff --git a/types/nwfilter/protocol/igmp_esp_ah_udplite_all.pp b/types/nwfilter/protocol/igmp_esp_ah_udplite_all.pp index ccbb3ec..1be2b91 100644 --- a/types/nwfilter/protocol/igmp_esp_ah_udplite_all.pp +++ b/types/nwfilter/protocol/igmp_esp_ah_udplite_all.pp @@ -1,23 +1,23 @@ # nwfilter rule protocol of IGMP, ESP, AH, UDPLITE, ALL type Libvirt::Nwfilter::Protocol::Igmp_esp_ah_udplite_all = Struct[{ - id => Enum['igmp', 'esp', 'ah', 'udplite', 'all'], - match => Optional[Enum['no','yes']], - srcmacaddr => Optional[String[1]], - srcmacmask => Optional[String[1]], - dstmacaddr => Optional[String[1]], - dstmacmask => Optional[String[1]], - srcipaddr => Optional[String[1]], - srcipmask => Optional[String[1]], - dstipaddr => Optional[String[1]], - dstipmask => Optional[String[1]], - srcipfrom => Optional[String[1]], - srcipto => Optional[String[1]], - dstipfrom => Optional[String[1]], - dstipto => Optional[String[1]], - dscp => Optional[Integer[0,256]], - comment => Optional[String[1,256]], - state => Optional[String[1]], - ipset => Optional[String[1]], - ipsetflags => Optional[String[1]], - connlimit-above => Optional[Integer], + id => Enum['igmp', 'esp', 'ah', 'udplite', 'all'], + match => Optional[Enum['no','yes']], + srcmacaddr => Optional[String[1]], + srcmacmask => Optional[String[1]], + dstmacaddr => Optional[String[1]], + dstmacmask => Optional[String[1]], + srcipaddr => Optional[String[1]], + srcipmask => Optional[String[1]], + dstipaddr => Optional[String[1]], + dstipmask => Optional[String[1]], + srcipfrom => Optional[String[1]], + srcipto => Optional[String[1]], + dstipfrom => Optional[String[1]], + dstipto => Optional[String[1]], + dscp => Optional[Integer[0,256]], + comment => Optional[String[1,256]], + state => Optional[String[1]], + ipset => Optional[String[1]], + ipsetflags => Optional[String[1]], + connlimit-above => Optional[Integer], }] diff --git a/types/nwfilter/protocol/ipv4.pp b/types/nwfilter/protocol/ipv4.pp index 7f3b865..d5f67bc 100644 --- a/types/nwfilter/protocol/ipv4.pp +++ b/types/nwfilter/protocol/ipv4.pp @@ -1,25 +1,25 @@ # nwfilter rule protocol of ipv4 type Libvirt::Nwfilter::Protocol::Ipv4 = Struct[{ - id => Enum['ip'], - match => Optional[Enum['no','yes']], - srcmacaddr => Optional[String[1]], - srcmacmask => Optional[String[1]], - dstmacaddr => Optional[String[1]], - dstmacmask => Optional[String[1]], - srcipaddr => Optional[String[1]], - srcipmask => Optional[String[1]], - dstipaddr => Optional[String[1]], - dstipmask => Optional[String[1]], - protocol => Optional[Variant[ - Integer[0,256], - Enum['tcp', 'udp', 'udplite', 'esp', 'ah', 'icmp', 'igmp', 'sctp'], - ]], - srcportstart => Variant[Integer[0,65535],Libvirt::Nwfilter::Param, Undef], - srcportend => Variant[Integer[0,65535],Libvirt::Nwfilter::Param, Undef], - dstportstart => Variant[Integer[0,65535],Libvirt::Nwfilter::Param, Undef], - dstportend => Variant[Integer[0,65535],Libvirt::Nwfilter::Param, Undef], - dscp => Variant[Integer[0,256],Libvirt::Nwfilter::Param, Undef], - protocolid => Variant[Integer[0,65535],Libvirt::Nwfilter::Param, Undef], - comment => Optional[String[1,256]], - connlimit-above => Variant[Integer,Libvirt::Nwfilter::Param, Undef], + id => Enum['ip'], + match => Optional[Enum['no','yes']], + srcmacaddr => Optional[String[1]], + srcmacmask => Optional[String[1]], + dstmacaddr => Optional[String[1]], + dstmacmask => Optional[String[1]], + srcipaddr => Optional[String[1]], + srcipmask => Optional[String[1]], + dstipaddr => Optional[String[1]], + dstipmask => Optional[String[1]], + protocol => Optional[Variant[ + Integer[0,256], + Enum['tcp', 'udp', 'udplite', 'esp', 'ah', 'icmp', 'igmp', 'sctp'], + ]], + srcportstart => Variant[Integer[0,65535],Libvirt::Nwfilter::Param, Undef], + srcportend => Variant[Integer[0,65535],Libvirt::Nwfilter::Param, Undef], + dstportstart => Variant[Integer[0,65535],Libvirt::Nwfilter::Param, Undef], + dstportend => Variant[Integer[0,65535],Libvirt::Nwfilter::Param, Undef], + dscp => Variant[Integer[0,256],Libvirt::Nwfilter::Param, Undef], + protocolid => Variant[Integer[0,65535],Libvirt::Nwfilter::Param, Undef], + comment => Optional[String[1,256]], + connlimit-above => Variant[Integer,Libvirt::Nwfilter::Param, Undef], }] diff --git a/types/nwfilter/protocol/ipv6.pp b/types/nwfilter/protocol/ipv6.pp index ccdcede..3be43d6 100644 --- a/types/nwfilter/protocol/ipv6.pp +++ b/types/nwfilter/protocol/ipv6.pp @@ -1,26 +1,26 @@ # nwfilter rule protocol of ipv6 type Libvirt::Nwfilter::Protocol::Ipv6 = Struct[{ - id => Enum['ipv6'], - match => Optional[Enum['no','yes']], - srcmacaddr => Optional[String[1]], - srcmacmask => Optional[String[1]], - dstmacaddr => Optional[String[1]], - dstmacmask => Optional[String[1]], - srcipaddr => Optional[String[1]], - srcipmask => Optional[String[1]], - dstipaddr => Optional[String[1]], - dstipmask => Optional[String[1]], - protocol => Optional[Variant[ - Integer[0,256], - Enum['tcp', 'udp', 'udplite', 'esp', 'ah', 'icmpv6', 'sctp'], - ]], - srcportstart => Variant[Integer[0,65535],Libvirt::Nwfilter::Param, Undef], - srcportend => Variant[Integer[0,65535],Libvirt::Nwfilter::Param, Undef], - dstportstart => Variant[Integer[0,65535],Libvirt::Nwfilter::Param, Undef], - dstportend => Variant[Integer[0,65535],Libvirt::Nwfilter::Param, Undef], - type => Variant[Integer[0,246],Libvirt::Nwfilter::Param, Undef], - typeend => Variant[Integer[0,246],Libvirt::Nwfilter::Param, Undef], - code => Variant[Integer[0,246],Libvirt::Nwfilter::Param, Undef], - comment => Optional[String[1,256]], - connlimit-above => Optional[Integer], + id => Enum['ipv6'], + match => Optional[Enum['no','yes']], + srcmacaddr => Optional[String[1]], + srcmacmask => Optional[String[1]], + dstmacaddr => Optional[String[1]], + dstmacmask => Optional[String[1]], + srcipaddr => Optional[String[1]], + srcipmask => Optional[String[1]], + dstipaddr => Optional[String[1]], + dstipmask => Optional[String[1]], + protocol => Optional[Variant[ + Integer[0,256], + Enum['tcp', 'udp', 'udplite', 'esp', 'ah', 'icmpv6', 'sctp'], + ]], + srcportstart => Variant[Integer[0,65535],Libvirt::Nwfilter::Param, Undef], + srcportend => Variant[Integer[0,65535],Libvirt::Nwfilter::Param, Undef], + dstportstart => Variant[Integer[0,65535],Libvirt::Nwfilter::Param, Undef], + dstportend => Variant[Integer[0,65535],Libvirt::Nwfilter::Param, Undef], + type => Variant[Integer[0,246],Libvirt::Nwfilter::Param, Undef], + typeend => Variant[Integer[0,246],Libvirt::Nwfilter::Param, Undef], + code => Variant[Integer[0,246],Libvirt::Nwfilter::Param, Undef], + comment => Optional[String[1,256]], + connlimit-above => Optional[Integer], }] diff --git a/types/nwfilter/protocol/mac.pp b/types/nwfilter/protocol/mac.pp index e6e001b..fced7ca 100644 --- a/types/nwfilter/protocol/mac.pp +++ b/types/nwfilter/protocol/mac.pp @@ -1,15 +1,15 @@ # nwfilter rule protocol of mac type Libvirt::Nwfilter::Protocol::Mac = Struct[{ - id => Enum['mac'], - match => Optional[Enum['no','yes']], - srcmacaddr => Optional[String[1]], - srcmacmask => Optional[String[1]], - dstmacaddr => Optional[String[1]], - dstmacmask => Optional[String[1]], - protocolid => Optional[Variant[ - Enum['arp', 'rarp', 'ipv4', 'ipv6'], - Pattern[/\A0x[0-9]{1,4}\Z/], - ]], - comment => Optional[String[1,256]], - connlimit-above => Optional[Integer], + id => Enum['mac'], + match => Optional[Enum['no','yes']], + srcmacaddr => Optional[String[1]], + srcmacmask => Optional[String[1]], + dstmacaddr => Optional[String[1]], + dstmacmask => Optional[String[1]], + protocolid => Optional[Variant[ + Enum['arp', 'rarp', 'ipv4', 'ipv6'], + Pattern[/\A0x[0-9]{1,4}\Z/], + ]], + comment => Optional[String[1,256]], + connlimit-above => Optional[Integer], }] diff --git a/types/nwfilter/protocol/stp.pp b/types/nwfilter/protocol/stp.pp index 80e1f7a..d55dcc1 100644 --- a/types/nwfilter/protocol/stp.pp +++ b/types/nwfilter/protocol/stp.pp @@ -1,31 +1,31 @@ # nwfilter rule protocol of stp type Libvirt::Nwfilter::Protocol::Stp = Struct[{ - id => Enum['stp'], - match => Optional[Enum['no','yes']], - srcmacaddr => Optional[String[1]], - srcmacmask => Optional[String[1]], - type => Optional[Integer[0,256]], - flags => Optional[Integer[0,256]], - root-priority => Optional[Integer[0,65535]], - root-priority-hi => Optional[Integer[0,65535]], - root-address => Optional[String[1]], - root-address-mask => Optional[String[1]], - root-cost => Optional[Integer[0,2147483647]], - root-cost-hi => Optional[Integer[0,2147483647]], - sender-priority => Optional[Integer[0,65535]], - sender-priority-hi => Optional[Integer[0,65535]], - sender-address => Optional[String[1]], - sender-address-mask => Optional[String[1]], - port => Optional[Integer[0,65535]], - port-hi => Optional[Integer[0,65535]], - msg-age => Optional[Integer[0,65535]], - msg-age-hi => Optional[Integer[0,65535]], - max-age => Optional[Integer[0,65535]], - max-age-hi => Optional[Integer[0,65535]], - hello-time => Optional[Integer[0,65535]], - hello-time-hi => Optional[Integer[0,65535]], - forward-delay => Optional[Integer[0,65535]], - forward-delay-hi => Optional[Integer[0,65535]], - comment => Optional[String[1,256]], - connlimit-above => Optional[Integer], + id => Enum['stp'], + match => Optional[Enum['no','yes']], + srcmacaddr => Optional[String[1]], + srcmacmask => Optional[String[1]], + type => Optional[Integer[0,256]], + flags => Optional[Integer[0,256]], + root-priority => Optional[Integer[0,65535]], + root-priority-hi => Optional[Integer[0,65535]], + root-address => Optional[String[1]], + root-address-mask => Optional[String[1]], + root-cost => Optional[Integer[0,2147483647]], + root-cost-hi => Optional[Integer[0,2147483647]], + sender-priority => Optional[Integer[0,65535]], + sender-priority-hi => Optional[Integer[0,65535]], + sender-address => Optional[String[1]], + sender-address-mask => Optional[String[1]], + port => Optional[Integer[0,65535]], + port-hi => Optional[Integer[0,65535]], + msg-age => Optional[Integer[0,65535]], + msg-age-hi => Optional[Integer[0,65535]], + max-age => Optional[Integer[0,65535]], + max-age-hi => Optional[Integer[0,65535]], + hello-time => Optional[Integer[0,65535]], + hello-time-hi => Optional[Integer[0,65535]], + forward-delay => Optional[Integer[0,65535]], + forward-delay-hi => Optional[Integer[0,65535]], + comment => Optional[String[1,256]], + connlimit-above => Optional[Integer], }] diff --git a/types/nwfilter/protocol/tcp_udp_sctp.pp b/types/nwfilter/protocol/tcp_udp_sctp.pp index ea72e20..2043dc0 100644 --- a/types/nwfilter/protocol/tcp_udp_sctp.pp +++ b/types/nwfilter/protocol/tcp_udp_sctp.pp @@ -1,23 +1,23 @@ # nwfilter rule protocol of TCP/UDP/SCTP type Libvirt::Nwfilter::Protocol::Tcp_udp_sctp = Struct[{ - id => Enum['tcp', 'udp', 'sctp'], - match => Optional[Enum['no','yes']], - srcmacaddr => Optional[String[1]], - srcipaddr => Optional[String[1]], - srcipmask => Optional[String[1]], - dstipaddr => Optional[String[1]], - dstipmask => Optional[String[1]], - srcipfrom => Optional[String[1]], - srcipto => Optional[String[1]], - srcportstart => Optional[Integer[0,65535]], - srcportend => Optional[Integer[0,65535]], - dstportstart => Optional[Integer[0,65535]], - dstportend => Optional[Integer[0,65535]], - dscp => Optional[Integer[0,256]], - comment => Optional[String[1,256]], - state => Optional[String[1]], - flags => Optional[String[1]], - ipset => Optional[String[1]], - ipsetflags => Optional[String[1]], - connlimit-above => Optional[Integer], + id => Enum['tcp', 'udp', 'sctp'], + match => Optional[Enum['no','yes']], + srcmacaddr => Optional[String[1]], + srcipaddr => Optional[String[1]], + srcipmask => Optional[String[1]], + dstipaddr => Optional[String[1]], + dstipmask => Optional[String[1]], + srcipfrom => Optional[String[1]], + srcipto => Optional[String[1]], + srcportstart => Optional[Integer[0,65535]], + srcportend => Optional[Integer[0,65535]], + dstportstart => Optional[Integer[0,65535]], + dstportend => Optional[Integer[0,65535]], + dscp => Optional[Integer[0,256]], + comment => Optional[String[1,256]], + state => Optional[String[1]], + flags => Optional[String[1]], + ipset => Optional[String[1]], + ipsetflags => Optional[String[1]], + connlimit-above => Optional[Integer], }] diff --git a/types/nwfilter/protocol/tcpipv6_udpipv6_sctpipv6.pp b/types/nwfilter/protocol/tcpipv6_udpipv6_sctpipv6.pp index 1f7b986..b2823da 100644 --- a/types/nwfilter/protocol/tcpipv6_udpipv6_sctpipv6.pp +++ b/types/nwfilter/protocol/tcpipv6_udpipv6_sctpipv6.pp @@ -1,25 +1,25 @@ # nwfilter rule protocol of TCP/UDP/SCTP over IPV6 type Libvirt::Nwfilter::Protocol::Tcpipv6_udpipv6_sctpipv6 = Struct[{ - id => Enum['tcp-ipv6', 'udp-ipv6', 'sctp-ipv6'], - match => Optional[Enum['no','yes']], - srcmacaddr => Optional[String[1]], - srcipaddr => Optional[String[1]], - srcipmask => Optional[String[1]], - dstipaddr => Optional[String[1]], - dstipmask => Optional[String[1]], - srcipfrom => Optional[String[1]], - srcipto => Optional[String[1]], - dstipfrom => Optional[String[1]], - dstipto => Optional[String[1]], - srcportstart => Optional[Integer[0,65535]], - srcportend => Optional[Integer[0,65535]], - dstportstart => Optional[Integer[0,65535]], - dstportend => Optional[Integer[0,65535]], - dscp => Optional[Integer[0,256]], - comment => Optional[String[1,256]], - state => Optional[String[1]], - flags => Optional[String[1]], - ipset => Optional[String[1]], - ipsetflags => Optional[String[1]], - connlimit-above => Optional[Integer], + id => Enum['tcp-ipv6', 'udp-ipv6', 'sctp-ipv6'], + match => Optional[Enum['no','yes']], + srcmacaddr => Optional[String[1]], + srcipaddr => Optional[String[1]], + srcipmask => Optional[String[1]], + dstipaddr => Optional[String[1]], + dstipmask => Optional[String[1]], + srcipfrom => Optional[String[1]], + srcipto => Optional[String[1]], + dstipfrom => Optional[String[1]], + dstipto => Optional[String[1]], + srcportstart => Optional[Integer[0,65535]], + srcportend => Optional[Integer[0,65535]], + dstportstart => Optional[Integer[0,65535]], + dstportend => Optional[Integer[0,65535]], + dscp => Optional[Integer[0,256]], + comment => Optional[String[1,256]], + state => Optional[String[1]], + flags => Optional[String[1]], + ipset => Optional[String[1]], + ipsetflags => Optional[String[1]], + connlimit-above => Optional[Integer], }] diff --git a/types/nwfilter/protocol/vlan.pp b/types/nwfilter/protocol/vlan.pp index b5fe3b1..fb52b38 100644 --- a/types/nwfilter/protocol/vlan.pp +++ b/types/nwfilter/protocol/vlan.pp @@ -1,16 +1,16 @@ # nwfilter rule protocol of VLAN type Libvirt::Nwfilter::Protocol::Vlan = Struct[{ - id => Enum['vlan'], - match => Optional[Enum['no','yes']], - srcmacaddr => Optional[String[1]], - srcmacmask => Optional[String[1]], - dstmacaddr => Optional[String[1]], - dstmacmask => Optional[String[1]], - vlanid => Optional[Integer[0,4095]], - encap_protocol => Optional[Variant[ - Enum['arp','ipv4','ipv6'], - Integer[0,65535] - ]], - comment => Optional[String[1,256]], - connlimit-above => Optional[Integer], + id => Enum['vlan'], + match => Optional[Enum['no','yes']], + srcmacaddr => Optional[String[1]], + srcmacmask => Optional[String[1]], + dstmacaddr => Optional[String[1]], + dstmacmask => Optional[String[1]], + vlanid => Optional[Integer[0,4095]], + encap_protocol => Optional[Variant[ + Enum['arp','ipv4','ipv6'], + Integer[0,65535] + ]], + comment => Optional[String[1,256]], + connlimit-above => Optional[Integer], }] diff --git a/types/nwfilter/rule.pp b/types/nwfilter/rule.pp index a9b13e0..38711c5 100644 --- a/types/nwfilter/rule.pp +++ b/types/nwfilter/rule.pp @@ -1,21 +1,21 @@ # a single nwfilter rule type Libvirt::Nwfilter::Rule = Struct[{ - action => Enum['drop','reject','accept','return','continue'], - direction => Enum['in','out','inout'], - priority => Optional[Libvirt::Nwfilter::Priority], - statematch => Optional[Enum['0','false','1','true']], - protocols => Optional[Array[Optional[Variant[ - Libvirt::Nwfilter::Protocol::Mac, - Libvirt::Nwfilter::Protocol::Vlan, - Libvirt::Nwfilter::Protocol::Stp, - Libvirt::Nwfilter::Protocol::Arp_rarp, - Libvirt::Nwfilter::Protocol::Ipv4, - Libvirt::Nwfilter::Protocol::Ipv6, - Libvirt::Nwfilter::Protocol::Tcp_udp_sctp, - Libvirt::Nwfilter::Protocol::Icmp, - Libvirt::Nwfilter::Protocol::Igmp_esp_ah_udplite_all, - Libvirt::Nwfilter::Protocol::Tcpipv6_udpipv6_sctpipv6, - Libvirt::Nwfilter::Protocol::Icmpv6, - Libvirt::Nwfilter::Protocol::Espipv6_ahipv6_udpliteipv6_allipv6, - ]]]] + action => Enum['drop','reject','accept','return','continue'], + direction => Enum['in','out','inout'], + priority => Optional[Libvirt::Nwfilter::Priority], + statematch => Optional[Enum['0','false','1','true']], + protocols => Optional[Array[Optional[Variant[ + Libvirt::Nwfilter::Protocol::Mac, + Libvirt::Nwfilter::Protocol::Vlan, + Libvirt::Nwfilter::Protocol::Stp, + Libvirt::Nwfilter::Protocol::Arp_rarp, + Libvirt::Nwfilter::Protocol::Ipv4, + Libvirt::Nwfilter::Protocol::Ipv6, + Libvirt::Nwfilter::Protocol::Tcp_udp_sctp, + Libvirt::Nwfilter::Protocol::Icmp, + Libvirt::Nwfilter::Protocol::Igmp_esp_ah_udplite_all, + Libvirt::Nwfilter::Protocol::Tcpipv6_udpipv6_sctpipv6, + Libvirt::Nwfilter::Protocol::Icmpv6, + Libvirt::Nwfilter::Protocol::Espipv6_ahipv6_udpliteipv6_allipv6, + ]]]] }] diff --git a/types/profiles/devices.pp b/types/profiles/devices.pp index b61fd6f..28302b6 100644 --- a/types/profiles/devices.pp +++ b/types/profiles/devices.pp @@ -3,7 +3,7 @@ String[1], # profile name Variant[ Struct[{ - 'profileconfig' => Optional[Struct[{ 'base' => Optional[String[1]] }]], + 'profileconfig' => Optional[Struct[{ 'base' => Optional[String[1]] }]], }], Libvirt::Domain::Device, ] From e4aca77ee4738c84b0f4d4e8bd19692ab6dd71c3 Mon Sep 17 00:00:00 2001 From: Benedikt Trefzer Date: Thu, 4 Dec 2025 14:35:52 +0100 Subject: [PATCH 2/4] make rubocop happy on spec tests --- spec/classes/config_spec.rb | 9 +++--- spec/classes/install_spec.rb | 10 ++++--- spec/classes/libvirt_spec.rb | 24 +++++++++------- spec/classes/manage_domains_config_spec.rb | 1 + spec/classes/profiles_spec.rb | 1 + spec/classes/service_spec.rb | 8 ++++-- spec/defines/domain_spec.rb | 7 +++-- spec/defines/network_spec.rb | 9 ++++-- spec/defines/nwfilter_spec.rb | 9 +++--- .../libvirt_generate_mac_addresses_spec.rb | 1 + spec/functions/libvirt_generate_mac_spec.rb | 1 + spec/functions/libvirt_generate_uuid_spec.rb | 1 + .../libvirt_get_merged_profile_spec.rb | 1 + spec/type_aliases/filterref_spec.rb | 4 ++- spec/type_aliases/net/bandwith_spec.rb | 2 ++ spec/type_aliases/net/bridge_spec.rb | 2 ++ spec/type_aliases/net/dns_spec.rb | 2 ++ spec/type_aliases/net/dnsmasq_options_spec.rb | 2 ++ spec/type_aliases/net/domain_spec.rb | 2 ++ spec/type_aliases/net/forward_spec.rb | 2 ++ spec/type_aliases/net/ip_spec.rb | 2 ++ spec/type_aliases/net/metadata_spec.rb | 2 ++ spec/type_aliases/net/port_spec.rb | 2 ++ spec/type_aliases/net/portgroup_spec.rb | 6 ++-- spec/type_aliases/net/route_spec.rb | 2 ++ spec/type_aliases/net/virtualport_spec.rb | 2 ++ spec/type_aliases/net/vlan_spec.rb | 2 ++ spec/type_aliases/nwfilter/arp_rarp_spec.rb | 2 ++ spec/type_aliases/nwfilter/chain_spec.rb | 28 ++++++++++--------- ...espipv6_ahipv6_udpliteipv6_allipv6_spec.rb | 2 ++ spec/type_aliases/nwfilter/icmp_spec.rb | 2 ++ spec/type_aliases/nwfilter/icmpv6_spec.rb | 2 ++ .../nwfilter/igmp_esp_ah_udplite_all_spec.rb | 2 ++ spec/type_aliases/nwfilter/ipv4_spec.rb | 2 ++ spec/type_aliases/nwfilter/ipv6_spec.rb | 2 ++ spec/type_aliases/nwfilter/mac_spec.rb | 2 ++ spec/type_aliases/nwfilter/param_spec.rb | 2 ++ spec/type_aliases/nwfilter/priority_spec.rb | 2 ++ spec/type_aliases/nwfilter/rule_spec.rb | 2 ++ spec/type_aliases/nwfilter/stp_spec.rb | 2 ++ .../nwfilter/tcp_udp_sctp_spec.rb | 2 ++ .../nwfilter/tcpipv6_udpipv6_sctpipv6_spec.rb | 2 ++ spec/type_aliases/nwfilter/vlan_spec.rb | 2 ++ spec/type_aliases/nwrules_spec.rb | 2 ++ spec/types/libvirt_domain_spec.rb | 2 ++ spec/types/libvirt_network_spec.rb | 2 ++ spec/types/libvirt_nwfilter_spec.rb | 2 ++ spec/types/libvirt_pool_spec.rb | 2 ++ spec/types/libvirtd_conf_spec.rb | 2 ++ spec/types/libvirtd_default_spec.rb | 2 ++ 50 files changed, 141 insertions(+), 47 deletions(-) diff --git a/spec/classes/config_spec.rb b/spec/classes/config_spec.rb index db299a4..672cfdd 100644 --- a/spec/classes/config_spec.rb +++ b/spec/classes/config_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require 'spec_helper' @@ -31,7 +32,7 @@ context 'with qemu_hook' do let :params do default_params.merge( - qemu_hook: 'drbd', + qemu_hook: 'drbd' ) end @@ -47,7 +48,7 @@ context 'with qemu.conf' do let :params do default_params.merge( - qemu_conf: { 'string' => 'test', 'integer' => 2, 'array' => ['A', 'B'] }, + qemu_conf: { 'string' => 'test', 'integer' => 2, 'array' => %w[A B] } ) end @@ -66,7 +67,7 @@ context 'with uri_aliases' do let :params do default_params.merge( - uri_aliases: ['te=qemu:///system', 'hail=qemu+ssh://root@hail.cloud.example.com/system'], + uri_aliases: ['te=qemu:///system', 'hail=qemu+ssh://root@hail.cloud.example.com/system'] ) end @@ -82,7 +83,7 @@ context 'with uri_default' do let :params do default_params.merge( - uri_default: 'qemu:///system', + uri_default: 'qemu:///system' ) end diff --git a/spec/classes/install_spec.rb b/spec/classes/install_spec.rb index 44dd842..7fd3f14 100644 --- a/spec/classes/install_spec.rb +++ b/spec/classes/install_spec.rb @@ -1,17 +1,19 @@ +# frozen_string_literal: true require 'spec_helper' describe 'libvirt::install' do let :default_params do { - packages: ['qemu', 'libvirt-daemon-system', 'libvirt-bin'], - qemu_hook_packages: { drbd: ['xmlstarlet', 'python-libvirt'] }, + packages: %w[qemu libvirt-daemon-system libvirt-bin], + qemu_hook_packages: { drbd: %w[xmlstarlet python-libvirt] }, package_ensure: 'installed', } end shared_examples 'libvirt::install shared examples' do it { is_expected.to compile.with_all_deps } + it { params[:packages].each do |package| is_expected.to contain_package(package) @@ -41,7 +43,7 @@ let :params do default_params.merge( package_ensure: 'actual', - packages: [ 'libvirt-clients', 'libvirt', 'qemu-kvm', 'qemu-system-x86'], + packages: %w[libvirt-clients libvirt qemu-kvm qemu-system-x86] ) end @@ -53,7 +55,7 @@ let :params do default_params.merge( qemu_hook: 'drbd', - manage_domain_file: 'puppet:///modules/libvirt/dummy', + manage_domain_file: 'puppet:///modules/libvirt/dummy' ) end diff --git a/spec/classes/libvirt_spec.rb b/spec/classes/libvirt_spec.rb index 91f97c3..ffa12eb 100644 --- a/spec/classes/libvirt_spec.rb +++ b/spec/classes/libvirt_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require 'spec_helper' @@ -5,9 +6,9 @@ let :default_params do { service_name: 'libvirtd', manage_service: true, - libvirt_package_names: ['libvirt-daemon-system', 'qemu'], + libvirt_package_names: %w[libvirt-daemon-system qemu], qemu_conf: {}, - qemu_hook_packages: { 'drbd' => ['xmlstarlet', 'python-libvirt'] }, + qemu_hook_packages: { 'drbd' => %w[xmlstarlet python-libvirt] }, create_networks: {}, create_domains: {}, evacuation: 'migrate', @@ -41,7 +42,7 @@ context 'with drbd qemu_hook' do let :params do default_params.merge( - qemu_hook: 'drbd', + qemu_hook: 'drbd' ) end @@ -53,7 +54,7 @@ context 'with create_pools' do let :params do default_params.merge( - create_pools: { 'mypool' => {} }, + create_pools: { 'mypool' => {} } ) end @@ -67,7 +68,7 @@ context 'with create_networks' do let :params do default_params.merge( - create_networks: { 'mynetwork' => { 'bridge' => 'test' } }, + create_networks: { 'mynetwork' => { 'bridge' => 'test' } } ) end @@ -84,7 +85,7 @@ let :params do default_params.merge( load_nwfilter_set: ['test'], - default_nwfilters: { 'test' => { 'filter' => {} } }, + default_nwfilters: { 'test' => { 'filter' => {} } } ) end @@ -97,7 +98,7 @@ context 'with create_domain' do let :params do default_params.merge( - create_domains: { 'mydom' => { 'devices_profile' => 'myprofile' } }, + create_domains: { 'mydom' => { 'devices_profile' => 'myprofile' } } ) end @@ -113,7 +114,7 @@ context 'with drop_default_net true' do let :params do default_params.merge( - drop_default_net: true, + drop_default_net: true ) end @@ -128,7 +129,7 @@ context 'with manage_service false' do let :params do default_params.merge( - manage_service: false, + manage_service: false ) end @@ -139,7 +140,7 @@ context 'with diff_dir' do let :params do default_params.merge( - diff_dir: '/tmp/test', + diff_dir: '/tmp/test' ) end @@ -150,18 +151,21 @@ .with_purge(true) .with_recurse(true) } + it { is_expected.to contain_file('/tmp/test/domains') .with_ensure('directory') .with_purge(true) .with_recurse(true) } + it { is_expected.to contain_file('/tmp/test/networks') .with_ensure('directory') .with_purge(true) .with_recurse(true) } + it { is_expected.to contain_file('/tmp/test/nwfilters') .with_ensure('directory') diff --git a/spec/classes/manage_domains_config_spec.rb b/spec/classes/manage_domains_config_spec.rb index e01571c..cc01711 100644 --- a/spec/classes/manage_domains_config_spec.rb +++ b/spec/classes/manage_domains_config_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require 'spec_helper' diff --git a/spec/classes/profiles_spec.rb b/spec/classes/profiles_spec.rb index e4e161d..b3f8442 100644 --- a/spec/classes/profiles_spec.rb +++ b/spec/classes/profiles_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require 'spec_helper' diff --git a/spec/classes/service_spec.rb b/spec/classes/service_spec.rb index 4667ca2..cb25d9a 100644 --- a/spec/classes/service_spec.rb +++ b/spec/classes/service_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require 'spec_helper' @@ -37,7 +38,7 @@ default_params.merge( service_ensure: 'stopped', service_enable: false, - service_name: 'dtrivbil', + service_name: 'dtrivbil' ) end @@ -47,7 +48,7 @@ context 'without managing service' do let :params do default_params.merge( - manage_service: false, + manage_service: false ) end @@ -59,13 +60,14 @@ context 'with modular services' do let :params do default_params.merge( - modular_services: { 'virtqemud' => { 'ensure' => 'running', 'enable' => true } }, + modular_services: { 'virtqemud' => { 'ensure' => 'running', 'enable' => true } } ) end it { is_expected.not_to contain_service('libvirtd') } + it { is_expected.to contain_service('virtqemud') .with_ensure('running') diff --git a/spec/defines/domain_spec.rb b/spec/defines/domain_spec.rb index debf206..2d64626 100644 --- a/spec/defines/domain_spec.rb +++ b/spec/defines/domain_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require 'spec_helper' @@ -39,7 +40,7 @@ let(:title) { 'mytitle' } let :params do default_params.merge( - autostart: true, + autostart: true ) end @@ -55,7 +56,7 @@ autostart: false, active: true, ignore: ['//domain/devices/controller'], - replace: true, + replace: true ) end @@ -67,7 +68,7 @@ let :params do default_params.merge( - ensure: 'absent', + ensure: 'absent' ) end diff --git a/spec/defines/network_spec.rb b/spec/defines/network_spec.rb index 3a1ba23..8ce87c8 100644 --- a/spec/defines/network_spec.rb +++ b/spec/defines/network_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require 'spec_helper' @@ -15,12 +16,14 @@ shared_examples 'libvirt::network shared examples' do it { is_expected.to compile.with_all_deps } + it { is_expected.to contain_libvirt_network(title) .with_ensure(params[:ensure]) .with_uuid(params[:uuid]) .with_show_diff(params[:show_diff]) } + it { is_expected.to contain_class('libvirt') } end @@ -32,7 +35,7 @@ let(:title) { 'mytitle' } let :params do default_params.merge( - bridge: 'test', + bridge: 'test' ) end @@ -45,7 +48,7 @@ let :params do default_params.merge( bridge: 'test', - autostart: false, + autostart: false ) end @@ -57,7 +60,7 @@ let :params do default_params.merge( - ensure: 'absent', + ensure: 'absent' ) end diff --git a/spec/defines/nwfilter_spec.rb b/spec/defines/nwfilter_spec.rb index a0d4295..c8a9534 100644 --- a/spec/defines/nwfilter_spec.rb +++ b/spec/defines/nwfilter_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require 'spec_helper' @@ -38,7 +39,7 @@ let(:title) { 'mytitle' } let :params do default_params.merge( - ip: '123.123.123.123', + ip: '123.123.123.123' ) end @@ -50,7 +51,7 @@ let :params do default_params.merge( filterref: [{ 'filter' => 'blah' }], - template: 'generic', + template: 'generic' ) end @@ -61,8 +62,8 @@ let(:title) { 'mytitle' } let :params do default_params.merge( - filterref: [{ 'filter' => 'blah', 'parameters' => [ { 'PORT' => '22' }, { 'PORT' => '80' } ] }], - template: 'generic', + filterref: [{ 'filter' => 'blah', 'parameters' => [{ 'PORT' => '22' }, { 'PORT' => '80' }] }], + template: 'generic' ) end diff --git a/spec/functions/libvirt_generate_mac_addresses_spec.rb b/spec/functions/libvirt_generate_mac_addresses_spec.rb index e28dfde..e1045b8 100644 --- a/spec/functions/libvirt_generate_mac_addresses_spec.rb +++ b/spec/functions/libvirt_generate_mac_addresses_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require 'spec_helper' diff --git a/spec/functions/libvirt_generate_mac_spec.rb b/spec/functions/libvirt_generate_mac_spec.rb index 7631b98..d888eb9 100644 --- a/spec/functions/libvirt_generate_mac_spec.rb +++ b/spec/functions/libvirt_generate_mac_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require 'spec_helper' diff --git a/spec/functions/libvirt_generate_uuid_spec.rb b/spec/functions/libvirt_generate_uuid_spec.rb index 9b74f0c..3fbcf80 100644 --- a/spec/functions/libvirt_generate_uuid_spec.rb +++ b/spec/functions/libvirt_generate_uuid_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require 'spec_helper' diff --git a/spec/functions/libvirt_get_merged_profile_spec.rb b/spec/functions/libvirt_get_merged_profile_spec.rb index bd10c21..82d9f2a 100644 --- a/spec/functions/libvirt_get_merged_profile_spec.rb +++ b/spec/functions/libvirt_get_merged_profile_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require 'spec_helper' diff --git a/spec/type_aliases/filterref_spec.rb b/spec/type_aliases/filterref_spec.rb index adc47fe..3285d36 100644 --- a/spec/type_aliases/filterref_spec.rb +++ b/spec/type_aliases/filterref_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'Libvirt::Filterref' do @@ -5,7 +7,7 @@ context 'with valid types' do [ [{ 'filter' => 'blah' }], - [{ 'filter' => 'blah', parameters: [ { 'TEST' => '1' }] }], + [{ 'filter' => 'blah', parameters: [{ 'TEST' => '1' }] }], ].each do |value| describe value.inspect do it { is_expected.to allow_value(value) } diff --git a/spec/type_aliases/net/bandwith_spec.rb b/spec/type_aliases/net/bandwith_spec.rb index be0307a..111e323 100644 --- a/spec/type_aliases/net/bandwith_spec.rb +++ b/spec/type_aliases/net/bandwith_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'Libvirt::Net::Bandwith' do diff --git a/spec/type_aliases/net/bridge_spec.rb b/spec/type_aliases/net/bridge_spec.rb index 19ae522..156e41a 100644 --- a/spec/type_aliases/net/bridge_spec.rb +++ b/spec/type_aliases/net/bridge_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'Libvirt::Net::Bridge' do diff --git a/spec/type_aliases/net/dns_spec.rb b/spec/type_aliases/net/dns_spec.rb index 5e20218..23551ad 100644 --- a/spec/type_aliases/net/dns_spec.rb +++ b/spec/type_aliases/net/dns_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'Libvirt::Net::Dns' do diff --git a/spec/type_aliases/net/dnsmasq_options_spec.rb b/spec/type_aliases/net/dnsmasq_options_spec.rb index 1a819ef..f75d463 100644 --- a/spec/type_aliases/net/dnsmasq_options_spec.rb +++ b/spec/type_aliases/net/dnsmasq_options_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'Libvirt::Net::Dnsmasq_options' do diff --git a/spec/type_aliases/net/domain_spec.rb b/spec/type_aliases/net/domain_spec.rb index 05dccaa..c657a96 100644 --- a/spec/type_aliases/net/domain_spec.rb +++ b/spec/type_aliases/net/domain_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'Libvirt::Net::Domain' do diff --git a/spec/type_aliases/net/forward_spec.rb b/spec/type_aliases/net/forward_spec.rb index 63ed99a..f506791 100644 --- a/spec/type_aliases/net/forward_spec.rb +++ b/spec/type_aliases/net/forward_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'Libvirt::Net::Forward' do diff --git a/spec/type_aliases/net/ip_spec.rb b/spec/type_aliases/net/ip_spec.rb index b25aaa3..c1bf8f4 100644 --- a/spec/type_aliases/net/ip_spec.rb +++ b/spec/type_aliases/net/ip_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'Libvirt::Net::Ip' do diff --git a/spec/type_aliases/net/metadata_spec.rb b/spec/type_aliases/net/metadata_spec.rb index aa01939..fc8e230 100644 --- a/spec/type_aliases/net/metadata_spec.rb +++ b/spec/type_aliases/net/metadata_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'Libvirt::Net::Metadata' do diff --git a/spec/type_aliases/net/port_spec.rb b/spec/type_aliases/net/port_spec.rb index 76c019d..a4502db 100644 --- a/spec/type_aliases/net/port_spec.rb +++ b/spec/type_aliases/net/port_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'Libvirt::Net::Port' do diff --git a/spec/type_aliases/net/portgroup_spec.rb b/spec/type_aliases/net/portgroup_spec.rb index 93dab09..5b9ea94 100644 --- a/spec/type_aliases/net/portgroup_spec.rb +++ b/spec/type_aliases/net/portgroup_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'Libvirt::Net::Portgroup' do @@ -6,8 +8,8 @@ [ { 'name' => 'blah' }, { 'name' => 'blah', 'default' => 'yes' }, - { 'name' => 'blah', 'vlan_tag' => '1', 'trunk' => false }, # for simple template - { 'name' => 'blah', 'vlan_tag' => ['1', '2'], 'trunk' => true }, # for simple template + { 'name' => 'blah', 'vlan_tag' => '1', 'trunk' => false }, # for simple template + { 'name' => 'blah', 'vlan_tag' => %w[1 2], 'trunk' => true }, # for simple template ].each do |value| describe value.inspect do it { is_expected.to allow_value(value) } diff --git a/spec/type_aliases/net/route_spec.rb b/spec/type_aliases/net/route_spec.rb index d3d93ed..8c6dacd 100644 --- a/spec/type_aliases/net/route_spec.rb +++ b/spec/type_aliases/net/route_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'Libvirt::Net::Route' do diff --git a/spec/type_aliases/net/virtualport_spec.rb b/spec/type_aliases/net/virtualport_spec.rb index 576b7b6..35c011e 100644 --- a/spec/type_aliases/net/virtualport_spec.rb +++ b/spec/type_aliases/net/virtualport_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'Libvirt::Net::Virtualport' do diff --git a/spec/type_aliases/net/vlan_spec.rb b/spec/type_aliases/net/vlan_spec.rb index 45d480c..5bc420a 100644 --- a/spec/type_aliases/net/vlan_spec.rb +++ b/spec/type_aliases/net/vlan_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'Libvirt::Net::Vlan' do diff --git a/spec/type_aliases/nwfilter/arp_rarp_spec.rb b/spec/type_aliases/nwfilter/arp_rarp_spec.rb index fb991d0..4904a8b 100644 --- a/spec/type_aliases/nwfilter/arp_rarp_spec.rb +++ b/spec/type_aliases/nwfilter/arp_rarp_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'Libvirt::Nwfilter::Protocol::Arp_rarp' do diff --git a/spec/type_aliases/nwfilter/chain_spec.rb b/spec/type_aliases/nwfilter/chain_spec.rb index 717d2c8..511c496 100644 --- a/spec/type_aliases/nwfilter/chain_spec.rb +++ b/spec/type_aliases/nwfilter/chain_spec.rb @@ -1,21 +1,23 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'Libvirt::Nwfilter::Chain' do describe 'valid types' do context 'with valid types' do - [ - 'mac', - 'stp', - 'vlan', - 'arp', - 'arp-test', - 'rarp', - 'ipv4', - 'ipv6', - 'ipv4-xy', - 'ipv6-xy', - 'arp-xy', - 'rarp-xy', + %w[ + mac + stp + vlan + arp + arp-test + rarp + ipv4 + ipv6 + ipv4-xy + ipv6-xy + arp-xy + rarp-xy ].each do |value| describe value.inspect do it { is_expected.to allow_value(value) } diff --git a/spec/type_aliases/nwfilter/espipv6_ahipv6_udpliteipv6_allipv6_spec.rb b/spec/type_aliases/nwfilter/espipv6_ahipv6_udpliteipv6_allipv6_spec.rb index 9d38ba3..40d3689 100644 --- a/spec/type_aliases/nwfilter/espipv6_ahipv6_udpliteipv6_allipv6_spec.rb +++ b/spec/type_aliases/nwfilter/espipv6_ahipv6_udpliteipv6_allipv6_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'Libvirt::Nwfilter::Protocol::Espipv6_ahipv6_udpliteipv6_allipv6' do diff --git a/spec/type_aliases/nwfilter/icmp_spec.rb b/spec/type_aliases/nwfilter/icmp_spec.rb index dfd4ecf..99c539c 100644 --- a/spec/type_aliases/nwfilter/icmp_spec.rb +++ b/spec/type_aliases/nwfilter/icmp_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'Libvirt::Nwfilter::Protocol::Icmp' do diff --git a/spec/type_aliases/nwfilter/icmpv6_spec.rb b/spec/type_aliases/nwfilter/icmpv6_spec.rb index 0f15783..46bb684 100644 --- a/spec/type_aliases/nwfilter/icmpv6_spec.rb +++ b/spec/type_aliases/nwfilter/icmpv6_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'Libvirt::Nwfilter::Protocol::Icmpv6' do diff --git a/spec/type_aliases/nwfilter/igmp_esp_ah_udplite_all_spec.rb b/spec/type_aliases/nwfilter/igmp_esp_ah_udplite_all_spec.rb index d813e29..e102f75 100644 --- a/spec/type_aliases/nwfilter/igmp_esp_ah_udplite_all_spec.rb +++ b/spec/type_aliases/nwfilter/igmp_esp_ah_udplite_all_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'Libvirt::Nwfilter::Protocol::Igmp_esp_ah_udplite_all' do diff --git a/spec/type_aliases/nwfilter/ipv4_spec.rb b/spec/type_aliases/nwfilter/ipv4_spec.rb index 71fddcf..0fa1c58 100644 --- a/spec/type_aliases/nwfilter/ipv4_spec.rb +++ b/spec/type_aliases/nwfilter/ipv4_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'Libvirt::Nwfilter::Protocol::Ipv4' do diff --git a/spec/type_aliases/nwfilter/ipv6_spec.rb b/spec/type_aliases/nwfilter/ipv6_spec.rb index d578f49..7609287 100644 --- a/spec/type_aliases/nwfilter/ipv6_spec.rb +++ b/spec/type_aliases/nwfilter/ipv6_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'Libvirt::Nwfilter::Protocol::Ipv6' do diff --git a/spec/type_aliases/nwfilter/mac_spec.rb b/spec/type_aliases/nwfilter/mac_spec.rb index 3eb1c3f..83f1771 100644 --- a/spec/type_aliases/nwfilter/mac_spec.rb +++ b/spec/type_aliases/nwfilter/mac_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'Libvirt::Nwfilter::Protocol::Mac' do diff --git a/spec/type_aliases/nwfilter/param_spec.rb b/spec/type_aliases/nwfilter/param_spec.rb index 6dd9ca4..1c19f22 100644 --- a/spec/type_aliases/nwfilter/param_spec.rb +++ b/spec/type_aliases/nwfilter/param_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'Libvirt::Nwfilter::Param' do diff --git a/spec/type_aliases/nwfilter/priority_spec.rb b/spec/type_aliases/nwfilter/priority_spec.rb index 6a746c4..70521ef 100644 --- a/spec/type_aliases/nwfilter/priority_spec.rb +++ b/spec/type_aliases/nwfilter/priority_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'Libvirt::Nwfilter::Priority' do diff --git a/spec/type_aliases/nwfilter/rule_spec.rb b/spec/type_aliases/nwfilter/rule_spec.rb index c86a17c..1dfed51 100644 --- a/spec/type_aliases/nwfilter/rule_spec.rb +++ b/spec/type_aliases/nwfilter/rule_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'Libvirt::Nwfilter::Rule' do diff --git a/spec/type_aliases/nwfilter/stp_spec.rb b/spec/type_aliases/nwfilter/stp_spec.rb index 0ef3a29..1f3312b 100644 --- a/spec/type_aliases/nwfilter/stp_spec.rb +++ b/spec/type_aliases/nwfilter/stp_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'Libvirt::Nwfilter::Protocol::Stp' do diff --git a/spec/type_aliases/nwfilter/tcp_udp_sctp_spec.rb b/spec/type_aliases/nwfilter/tcp_udp_sctp_spec.rb index 0d5a986..b2f8a72 100644 --- a/spec/type_aliases/nwfilter/tcp_udp_sctp_spec.rb +++ b/spec/type_aliases/nwfilter/tcp_udp_sctp_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'Libvirt::Nwfilter::Protocol::Tcp_udp_sctp' do diff --git a/spec/type_aliases/nwfilter/tcpipv6_udpipv6_sctpipv6_spec.rb b/spec/type_aliases/nwfilter/tcpipv6_udpipv6_sctpipv6_spec.rb index ed908b5..2f0cd10 100644 --- a/spec/type_aliases/nwfilter/tcpipv6_udpipv6_sctpipv6_spec.rb +++ b/spec/type_aliases/nwfilter/tcpipv6_udpipv6_sctpipv6_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'Libvirt::Nwfilter::Protocol::Tcpipv6_udpipv6_sctpipv6' do diff --git a/spec/type_aliases/nwfilter/vlan_spec.rb b/spec/type_aliases/nwfilter/vlan_spec.rb index df19451..cf236d1 100644 --- a/spec/type_aliases/nwfilter/vlan_spec.rb +++ b/spec/type_aliases/nwfilter/vlan_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'Libvirt::Nwfilter::Protocol::Vlan' do diff --git a/spec/type_aliases/nwrules_spec.rb b/spec/type_aliases/nwrules_spec.rb index c6a7151..8c473b6 100644 --- a/spec/type_aliases/nwrules_spec.rb +++ b/spec/type_aliases/nwrules_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'Libvirt::Nwrules' do diff --git a/spec/types/libvirt_domain_spec.rb b/spec/types/libvirt_domain_spec.rb index 0a25d5e..676e4be 100644 --- a/spec/types/libvirt_domain_spec.rb +++ b/spec/types/libvirt_domain_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'libvirt_domain' do diff --git a/spec/types/libvirt_network_spec.rb b/spec/types/libvirt_network_spec.rb index 484805d..56cb7ee 100644 --- a/spec/types/libvirt_network_spec.rb +++ b/spec/types/libvirt_network_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'libvirt_network' do diff --git a/spec/types/libvirt_nwfilter_spec.rb b/spec/types/libvirt_nwfilter_spec.rb index 3af36fe..12a1f87 100644 --- a/spec/types/libvirt_nwfilter_spec.rb +++ b/spec/types/libvirt_nwfilter_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'libvirt_nwfilter' do diff --git a/spec/types/libvirt_pool_spec.rb b/spec/types/libvirt_pool_spec.rb index 1cb276c..b1e6bce 100644 --- a/spec/types/libvirt_pool_spec.rb +++ b/spec/types/libvirt_pool_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'libvirt_pool' do diff --git a/spec/types/libvirtd_conf_spec.rb b/spec/types/libvirtd_conf_spec.rb index 07a0dc4..8a5c3f4 100644 --- a/spec/types/libvirtd_conf_spec.rb +++ b/spec/types/libvirtd_conf_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'libvirtd_conf' do diff --git a/spec/types/libvirtd_default_spec.rb b/spec/types/libvirtd_default_spec.rb index b18e6f3..b619b18 100644 --- a/spec/types/libvirtd_default_spec.rb +++ b/spec/types/libvirtd_default_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'libvirtd_default' do From e03f78a84a8003a1868151b189ca8d42735de73b Mon Sep 17 00:00:00 2001 From: Benedikt Trefzer Date: Thu, 4 Dec 2025 14:36:17 +0100 Subject: [PATCH 3/4] make rubocop happy on code --- .rubocop.yml | 1 - REFERENCE.md | 6 ++--- lib/puppet/functions/libvirt/normalxml.rb | 10 ++++---- .../parser/functions/libvirt_generate_mac.rb | 11 +++++---- .../libvirt_generate_mac_addresses.rb | 16 +++++++++---- .../parser/functions/libvirt_generate_uuid.rb | 9 ++++---- lib/puppet/provider/libvirt_domain/virsh.rb | 21 +++++++++-------- lib/puppet/provider/libvirt_network/virsh.rb | 23 ++++++++++--------- lib/puppet/provider/libvirt_nwfilter/virsh.rb | 17 +++++++------- lib/puppet/provider/libvirt_pool/virsh.rb | 16 ++++++------- .../provider/libvirtd_conf/ini_setting.rb | 4 +++- .../provider/libvirtd_default/ini_setting.rb | 4 +++- .../libvirtd_default/ini_setting_redhat.rb | 4 +++- lib/puppet/type/libvirt_domain.rb | 10 ++++---- lib/puppet/type/libvirt_network.rb | 2 +- lib/puppet/type/libvirt_nwfilter.rb | 10 ++++---- lib/puppet/type/libvirt_pool.rb | 16 ++++++------- lib/puppet/type/libvirtd_conf.rb | 14 +++++++---- lib/puppet/type/libvirtd_default.rb | 3 ++- .../libvirt/rexml_sorted_attributes.rb | 8 ++++++- lib/puppet_x/libvirt/sort_elements.rb | 10 ++++---- 21 files changed, 119 insertions(+), 96 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index 74669e1..c39fbc7 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -3,5 +3,4 @@ inherit_gem: voxpupuli-test: rubocop.yml Layout/DotPosition: - # blah: dsfsf EnforcedStyle: leading diff --git a/REFERENCE.md b/REFERENCE.md index 347f94c..8d72878 100644 --- a/REFERENCE.md +++ b/REFERENCE.md @@ -1799,7 +1799,7 @@ usually discover the appropriate provider for your platform. ##### `sourcedev` -Valid values: `%r{(\/)?(\w)}` +Valid values: `%r{(/)?(\w)}` The source device. @@ -1823,13 +1823,13 @@ The source name. ##### `sourcepath` -Valid values: `%r{(\/)?(\w)}` +Valid values: `%r{(/)?(\w)}` The source path. ##### `target` -Valid values: `%r{(\/)?(\w)}` +Valid values: `%r{(/)?(\w)}` The target. diff --git a/lib/puppet/functions/libvirt/normalxml.rb b/lib/puppet/functions/libvirt/normalxml.rb index a0d8358..7ccdde8 100644 --- a/lib/puppet/functions/libvirt/normalxml.rb +++ b/lib/puppet/functions/libvirt/normalxml.rb @@ -3,8 +3,8 @@ File.expand_path('../../..', File.dirname(__FILE__)).tap { |dir| $LOAD_PATH.unshift(dir) unless $LOAD_PATH.include?(dir) } # require_relative '../../../puppet_x/libvirt/rexml_sorted_attributes.rb' -require 'puppet_x/libvirt/rexml_sorted_attributes.rb' -require 'puppet_x/libvirt/sort_elements.rb' +require 'puppet_x/libvirt/rexml_sorted_attributes' +require 'puppet_x/libvirt/sort_elements' # @summary # normalize a xml string @@ -13,7 +13,7 @@ # this function does the same for the input as it is done with the # output of the dumpxml in the provider. (see resource libvirt_nwfilter) # -Puppet::Functions.create_function(:"libvirt::normalxml") do +Puppet::Functions.create_function(:'libvirt::normalxml') do # @param value # the xml string # @@ -32,8 +32,8 @@ def normalxml(value) begin xml = REXML::Document.new(value) - rescue REXML::ParseException => msg - raise Puppet::ParseError, "libvirt::normalxml: cannot parse xml: #{msg}" + rescue REXML::ParseException => e + raise Puppet::ParseError, "libvirt::normalxml: cannot parse xml: #{e}" end formatter = REXML::Formatters::Pretty.new(2) diff --git a/lib/puppet/parser/functions/libvirt_generate_mac.rb b/lib/puppet/parser/functions/libvirt_generate_mac.rb index 5e5fa04..393947a 100644 --- a/lib/puppet/parser/functions/libvirt_generate_mac.rb +++ b/lib/puppet/parser/functions/libvirt_generate_mac.rb @@ -1,6 +1,7 @@ -# +# frozen_string_literal: true + module Puppet::Parser::Functions - newfunction(:libvirt_generate_mac, type: :rvalue, doc: <<-'ENDHEREDOC') do |args| + newfunction(:libvirt_generate_mac, type: :rvalue, doc: <<-ENDHEREDOC) do |args| Returns a MAC address in the QEMU/KVM MAC OID (52:54:00:...). It computes a sha1 hash of all keys concatenated, the first 6 @@ -8,11 +9,11 @@ module Puppet::Parser::Functions @return a mac address in the QEMU/KVM MAC OID (52:54:00:...) - ENDHEREDOC + ENDHEREDOC - sha1 = Digest::SHA1.hexdigest(args.join('')) + sha1 = Digest::SHA1.hexdigest(args.join) # generate address in the QEMU/KVM MAC OID - '52:54:00:' + "#{sha1[0..1]}:#{sha1[2..3]}:#{sha1[4..5]}" + "52:54:00:#{sha1[0..1]}:#{sha1[2..3]}:#{sha1[4..5]}" end end diff --git a/lib/puppet/parser/functions/libvirt_generate_mac_addresses.rb b/lib/puppet/parser/functions/libvirt_generate_mac_addresses.rb index 39b27e2..a8660ff 100644 --- a/lib/puppet/parser/functions/libvirt_generate_mac_addresses.rb +++ b/lib/puppet/parser/functions/libvirt_generate_mac_addresses.rb @@ -1,5 +1,7 @@ +# frozen_string_literal: true + module Puppet::Parser::Functions - newfunction(:libvirt_generate_mac_addresses, type: :rvalue, doc: <<-'ENDHEREDOC') do |args| + newfunction(:libvirt_generate_mac_addresses, type: :rvalue, doc: <<-ENDHEREDOC) do |args| Generates MAC addresses for all interfaces in the array which do not yet have an address specified. The MAC addresses are based on the domain name, network and portgroup. The function libvirt_generate_mac is used to generate a single mac address. @@ -7,7 +9,7 @@ module Puppet::Parser::Functions hash of interfaces @return the interfacess with mac address - ENDHEREDOC + ENDHEREDOC Puppet::Parser::Functions.function('generate_mac') @@ -15,9 +17,13 @@ module Puppet::Parser::Functions domain_name = args[1] ifaces.each do |iface| - unless iface.key?('mac') - iface['mac'] = function_libvirt_generate_mac([domain_name, iface['network'], iface['portgroup']]) - end + next if iface.key?('mac') + + iface['mac'] = if iface['network'] + function_libvirt_generate_mac([domain_name, iface['network'], iface['portgroup']]) + else + function_libvirt_generate_mac(['blah']) + end end end end diff --git a/lib/puppet/parser/functions/libvirt_generate_uuid.rb b/lib/puppet/parser/functions/libvirt_generate_uuid.rb index 4037d84..ae8bdf8 100644 --- a/lib/puppet/parser/functions/libvirt_generate_uuid.rb +++ b/lib/puppet/parser/functions/libvirt_generate_uuid.rb @@ -1,15 +1,16 @@ -# +# frozen_string_literal: true + module Puppet::Parser::Functions - newfunction(:libvirt_generate_uuid, type: :rvalue, doc: <<-'ENDHEREDOC') do |args| + newfunction(:libvirt_generate_uuid, type: :rvalue, doc: <<-ENDHEREDOC) do |args| Return a uuid generated from an sha1 hash of all keys concatenated @summary compute sha1 hash of all keys concatenated @return [String] the computed uuid - ENDHEREDOC + ENDHEREDOC - sha1 = Digest::SHA1.hexdigest(args.join('')) + sha1 = Digest::SHA1.hexdigest(args.join) # generate a QEMU/KVM UUID "#{sha1[0..7]}-#{sha1[8..11]}-#{sha1[12..15]}-#{sha1[16..19]}-#{sha1[20..31]}" diff --git a/lib/puppet/provider/libvirt_domain/virsh.rb b/lib/puppet/provider/libvirt_domain/virsh.rb index 70a0787..5f576e4 100644 --- a/lib/puppet/provider/libvirt_domain/virsh.rb +++ b/lib/puppet/provider/libvirt_domain/virsh.rb @@ -4,8 +4,8 @@ # This file contains a provider for the resource type `libvirt_domain`, # require 'tempfile' -require_relative '../../../puppet_x/libvirt/rexml_sorted_attributes.rb' -require_relative '../../../puppet_x/libvirt/sort_elements.rb' +require_relative '../../../puppet_x/libvirt/rexml_sorted_attributes' +require_relative '../../../puppet_x/libvirt/sort_elements' Puppet::Type.type(:libvirt_domain).provide(:virsh) do desc "@summary provider for the resource type `libvirt_domain`, @@ -16,9 +16,7 @@ def virsh_define(content) xml = REXML::Document.new(content) - if @property_hash[:uuid] - xml.root.add_element('uuid').add_text(@property_hash[:uuid]) - end + xml.root.add_element('uuid').add_text(@property_hash[:uuid]) if @property_hash[:uuid] tmpfile = Tempfile.new(@resource[:name]) tmpfile.write(xml.to_s) tmpfile.rewind @@ -39,11 +37,12 @@ def self.instances virshlines << virsh('--quiet', '--readonly', 'list', '--table', '--all', '--persistent', '--autostart').gsub("\n", " autostart\n") virshlines.split("\n").map do |line| raise Puppet::Error, "Cannot parse invalid network line: #{line}" unless line =~ %r{^\s*(\S+)\s+(\S+)\s+(\w.*)\s+(\S+)$} + new( ensure: :present, name: Regexp.last_match(2), - active: (Regexp.last_match(1) == '-') ? :false : :true, # only active domains have a number - autostart: (Regexp.last_match(4) == 'autostart') ? :true : :false, + active: Regexp.last_match(1) == '-' ? :false : :true, # only active domains have a number + autostart: Regexp.last_match(4) == 'autostart' ? :true : :false ) end end @@ -71,7 +70,7 @@ def create def destroy begin virsh('--quiet', 'destroy', @resource[:name]) - rescue + rescue StandardError # do nothing end @@ -86,10 +85,11 @@ def content=(_content) def content return '' unless @property_hash[:ensure] == :present return @resource[:content] unless @resource[:replace] + begin xml = REXML::Document.new(virsh('--quiet', '--readonly', 'dumpxml', @resource[:name])) - rescue REXML::ParseException => msg - raise Puppet::ParseError, "libvirt_domain: cannot parse xml: #{msg}" + rescue REXML::ParseException => e + raise Puppet::ParseError, "libvirt_domain: cannot parse xml: #{e}" end # remove the elements to ignore @resource[:ignore].each do |rem| @@ -137,6 +137,7 @@ def exists? def flush return if @property_flush.empty? + content = @property_flush[:content] || @resource[:content] virsh_define(content) @property_flush.clear diff --git a/lib/puppet/provider/libvirt_network/virsh.rb b/lib/puppet/provider/libvirt_network/virsh.rb index 957865a..d1c88ea 100644 --- a/lib/puppet/provider/libvirt_network/virsh.rb +++ b/lib/puppet/provider/libvirt_network/virsh.rb @@ -4,8 +4,8 @@ # This file contains a provider for the resource type `libvirt_network`, # require 'tempfile' -require_relative '../../../puppet_x/libvirt/rexml_sorted_attributes.rb' -require_relative '../../../puppet_x/libvirt/sort_elements.rb' +require_relative '../../../puppet_x/libvirt/rexml_sorted_attributes' +require_relative '../../../puppet_x/libvirt/sort_elements' Puppet::Type.type(:libvirt_network).provide(:virsh) do desc "@summary provider for the resource type `libvirt_network`, @@ -16,9 +16,7 @@ def virsh_define(content) xml = REXML::Document.new(content) - if @property_hash[:uuid] - xml.root.add_element('uuid').add_text(@property_hash[:uuid]) - end + xml.root.add_element('uuid').add_text(@property_hash[:uuid]) if @property_hash[:uuid] tmpfile = Tempfile.new(@resource[:name]) tmpfile.write(xml.to_s) tmpfile.rewind @@ -36,12 +34,13 @@ def initialize(value = {}) def self.instances virsh('--quiet', '--readonly', 'net-list', '--table', '--all', '--persistent').split("\n").map do |line| raise Puppet::Error, "Cannot parse invalid network line: #{line}" unless line =~ %r{^\s*(\S+)\s+(\S+)\s+(\S+)\s+(\S+)$} + new( ensure: :present, name: Regexp.last_match(1), - active: (Regexp.last_match(2) == 'active') ? :true : :false, - autostart: (Regexp.last_match(3) == 'yes') ? :true : :false, - uuid: virsh('--quiet', '--readonly', 'net-uuid', '--network', Regexp.last_match(1)), + active: Regexp.last_match(2) == 'active' ? :true : :false, + autostart: Regexp.last_match(3) == 'yes' ? :true : :false, + uuid: virsh('--quiet', '--readonly', 'net-uuid', '--network', Regexp.last_match(1)) ) end end @@ -69,7 +68,7 @@ def create def destroy begin virsh('--quiet', 'net-destroy', @resource[:name]) - rescue + rescue StandardError # do nothing end virsh('--quiet', 'net-undefine', @resource[:name]) @@ -82,10 +81,11 @@ def content=(_content) def content return '' unless @property_hash[:ensure] == :present + begin xml = REXML::Document.new(virsh('--quiet', '--readonly', 'net-dumpxml', @resource[:name])) - rescue REXML::ParseException => msg - raise Puppet::ParseError, "libvirt_network: cannot parse xml: #{msg}" + rescue REXML::ParseException => e + raise Puppet::ParseError, "libvirt_network: cannot parse xml: #{e}" end # remove the uuid xml.root.elements.delete('//uuid') @@ -137,6 +137,7 @@ def exists? def flush return if @property_flush.empty? + content = @property_flush[:content] || @resource[:content] virsh_define(content) @property_flush.clear diff --git a/lib/puppet/provider/libvirt_nwfilter/virsh.rb b/lib/puppet/provider/libvirt_nwfilter/virsh.rb index 4e9fa60..3354e02 100644 --- a/lib/puppet/provider/libvirt_nwfilter/virsh.rb +++ b/lib/puppet/provider/libvirt_nwfilter/virsh.rb @@ -4,8 +4,8 @@ # This file contains a provider for the resource type `libvirt_nwfilter`, # require 'tempfile' -require_relative '../../../puppet_x/libvirt/rexml_sorted_attributes.rb' -require_relative '../../../puppet_x/libvirt/sort_elements.rb' +require_relative '../../../puppet_x/libvirt/rexml_sorted_attributes' +require_relative '../../../puppet_x/libvirt/sort_elements' Puppet::Type.type(:libvirt_nwfilter).provide(:virsh) do desc "@summary provider for the resource type `libvirt_nwfilter`, @@ -16,9 +16,7 @@ def virsh_define(content) xml = REXML::Document.new(content) - if @property_hash[:uuid] - xml.root.add_element('uuid').add_text(@property_hash[:uuid]) - end + xml.root.add_element('uuid').add_text(@property_hash[:uuid]) if @property_hash[:uuid] tmpfile = Tempfile.new(@resource[:name]) tmpfile.write(xml.to_s) tmpfile.rewind @@ -36,10 +34,11 @@ def initialize(value = {}) def self.instances virsh('--quiet', '--readonly', 'nwfilter-list').split("\n").map do |line| raise Puppet::Error, "Cannot parse invalid nwfilter line: #{line}" unless line =~ %r{^\s*(\S+)\s+(\S+)$} + new( ensure: :present, name: Regexp.last_match(2), - uuid: Regexp.last_match(1), + uuid: Regexp.last_match(1) ) end end @@ -69,10 +68,11 @@ def content=(_content) def content return '' unless @property_hash[:ensure] == :present + begin xml = REXML::Document.new(virsh('--quiet', '--readonly', 'nwfilter-dumpxml', @resource[:name])) - rescue REXML::ParseException => msg - raise Puppet::ParseError, "libvirt_nwfilter: cannot parse xml: #{msg}" + rescue REXML::ParseException => e + raise Puppet::ParseError, "libvirt_nwfilter: cannot parse xml: #{e}" end # remove the uuid xml.root.elements.delete('//uuid') @@ -89,6 +89,7 @@ def exists? def flush return if @property_flush.empty? + content = @property_flush[:content] || @resource[:content] virsh_define(content) @property_flush.clear diff --git a/lib/puppet/provider/libvirt_pool/virsh.rb b/lib/puppet/provider/libvirt_pool/virsh.rb index d19d61b..49f7514 100644 --- a/lib/puppet/provider/libvirt_pool/virsh.rb +++ b/lib/puppet/provider/libvirt_pool/virsh.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Most of the code of this file comes from https://github.com/thias/puppet-libvirt/blob/master/lib/puppet/provider/libvirt_pool/virsh.rb # Kudos to Thias for it :) # @@ -13,24 +15,22 @@ def self.instances list = virsh('-q', 'pool-list', '--all') - list.split(%r{\n})[0..-1].map do |line| + list.split(%r{\n})[0..].map do |line| values = line.strip.split(%r{ +}) new( name: values[0], active: %r{^act}.match?(values[1]) ? :true : :false, autostart: values[2].include?('no') ? :false : :true, - provider: name, + provider: name ) end end def status list = virsh('-q', 'pool-list', '--all') - list.split(%r{\n})[0..-1].find do |line| + list.split(%r{\n})[0..].find do |line| fields = line.strip.split(%r{ +}) - if %r{^#{resource[:name]}$}.match?(fields[0]) - return :present - end + return :present if %r{^#{resource[:name]}$}.match?(fields[0]) end :absent end @@ -86,7 +86,7 @@ def definepool def buildpool virsh('pool-build', '--pool', resource[:name]) - rescue + rescue StandardError # Unable to build the pool maybe because # it is already defined (it this case we should consider # to continue execution) @@ -198,5 +198,5 @@ def buildpoolxml(resource) end root.to_s - end # buildpoolxml + end end diff --git a/lib/puppet/provider/libvirtd_conf/ini_setting.rb b/lib/puppet/provider/libvirtd_conf/ini_setting.rb index 8802c1e..2adff0e 100644 --- a/lib/puppet/provider/libvirtd_conf/ini_setting.rb +++ b/lib/puppet/provider/libvirtd_conf/ini_setting.rb @@ -1,6 +1,8 @@ +# frozen_string_literal: true + Puppet::Type.type(:libvirtd_conf).provide( :ini_setting, - parent: Puppet::Type.type(:ini_setting).provider(:ruby), + parent: Puppet::Type.type(:ini_setting).provider(:ruby) ) do desc ' @summary add config to /etc/libvirt/libvirtd.conf diff --git a/lib/puppet/provider/libvirtd_default/ini_setting.rb b/lib/puppet/provider/libvirtd_default/ini_setting.rb index 65997aa..ac7501f 100644 --- a/lib/puppet/provider/libvirtd_default/ini_setting.rb +++ b/lib/puppet/provider/libvirtd_default/ini_setting.rb @@ -1,6 +1,8 @@ +# frozen_string_literal: true + Puppet::Type.type(:libvirtd_default).provide( :ini_setting, - parent: Puppet::Type.type(:ini_setting).provider(:ruby), + parent: Puppet::Type.type(:ini_setting).provider(:ruby) ) do desc ' @summary add config to /etc/default/libvirtd diff --git a/lib/puppet/provider/libvirtd_default/ini_setting_redhat.rb b/lib/puppet/provider/libvirtd_default/ini_setting_redhat.rb index 85f5940..38c2196 100644 --- a/lib/puppet/provider/libvirtd_default/ini_setting_redhat.rb +++ b/lib/puppet/provider/libvirtd_default/ini_setting_redhat.rb @@ -1,6 +1,8 @@ +# frozen_string_literal: true + Puppet::Type.type(:libvirtd_default).provide( :redhat, - parent: Puppet::Type.type(:libvirtd_default).provider(:ini_setting), + parent: Puppet::Type.type(:libvirtd_default).provider(:ini_setting) ) do desc ' @summary add config to /etc/sysconfig/libvirtd (for redhat family) diff --git a/lib/puppet/type/libvirt_domain.rb b/lib/puppet/type/libvirt_domain.rb index aa151ea..90f3595 100644 --- a/lib/puppet/type/libvirt_domain.rb +++ b/lib/puppet/type/libvirt_domain.rb @@ -62,17 +62,17 @@ def should_to_s(value) if @resource[:show_diff] - ":\n" + value + "\n" + ":\n#{value}\n" else - '{md5}' + Digest::MD5.hexdigest(value.to_s) + "{md5}#{Digest::MD5.hexdigest(value.to_s)}" end end - def is_to_s(value) # rubocop:disable Naming/PredicateName + def is_to_s(value) if @resource[:show_diff] - ":\n" + value + "\n" + ":\n#{value}\n" else - '{md5}' + Digest::MD5.hexdigest(value.to_s) + "{md5}#{Digest::MD5.hexdigest(value.to_s)}" end end end diff --git a/lib/puppet/type/libvirt_network.rb b/lib/puppet/type/libvirt_network.rb index 14f264e..4a32128 100644 --- a/lib/puppet/type/libvirt_network.rb +++ b/lib/puppet/type/libvirt_network.rb @@ -58,7 +58,7 @@ def change_to_s(current, desire) desire_path = desire_exp.path system "diff -u #{current_path} #{desire_path}" else - '{md5}' + Digest::MD5.hexdigest(current.to_s) + ' to: ' + '{md5}' + Digest::MD5.hexdigest(desire.to_s) + "{md5}#{Digest::MD5.hexdigest(current.to_s)} to: {md5}#{Digest::MD5.hexdigest(desire.to_s)}" end end end diff --git a/lib/puppet/type/libvirt_nwfilter.rb b/lib/puppet/type/libvirt_nwfilter.rb index 21a4e46..1109c4a 100644 --- a/lib/puppet/type/libvirt_nwfilter.rb +++ b/lib/puppet/type/libvirt_nwfilter.rb @@ -34,17 +34,17 @@ def should_to_s(value) if @resource[:show_diff] - ":\n" + value + "\n" + ":\n#{value}\n" else - '{md5}' + Digest::MD5.hexdigest(value.to_s) + "{md5}#{Digest::MD5.hexdigest(value.to_s)}" end end - def is_to_s(value) # rubocop:disable Naming/PredicateName + def is_to_s(value) if @resource[:show_diff] - ":\n" + value + "\n" + ":\n#{value}\n" else - '{md5}' + Digest::MD5.hexdigest(value.to_s) + "{md5}#{Digest::MD5.hexdigest(value.to_s)}" end end end diff --git a/lib/puppet/type/libvirt_pool.rb b/lib/puppet/type/libvirt_pool.rb index 3b1815d..170dc93 100644 --- a/lib/puppet/type/libvirt_pool.rb +++ b/lib/puppet/type/libvirt_pool.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Most of the code of this file comes from https://github.com/thias/puppet-libvirt/blob/master/lib/puppet/type/libvirt_pool.rb # Kudos to Thias for it :) # @@ -49,9 +51,7 @@ end newvalue(:absent) do - if provider.exists? - provider.destroy - end + provider.destroy if provider.exists? end def retrieve @@ -76,12 +76,12 @@ def retrieve newparam(:sourcepath) do desc 'The source path.' - newvalues(%r{(\/)?(\w)}) + newvalues(%r{(/)?(\w)}) end newparam(:sourcedev) do desc 'The source device.' - newvalues(%r{(\/)?(\w)}) + newvalues(%r{(/)?(\w)}) end newparam(:sourcename) do @@ -96,7 +96,7 @@ def retrieve newparam(:target) do desc 'The target.' - newvalues(%r{(\/)?(\w)}) + newvalues(%r{(/)?(\w)}) end newparam(:target_owner) do @@ -130,8 +130,6 @@ def retrieve validate do # https://libvirt.org/formatstorage.html#StoragePoolTarget - if (self[:target_owner] || self[:target_group] || self[:target_mode]) && ![:fs, :dir].include?(self[:type]) - Puppet.warning('target_(owner|group|mode) is currently only useful for directory or filesystem based pools') - end + Puppet.warning('target_(owner|group|mode) is currently only useful for directory or filesystem based pools') if (self[:target_owner] || self[:target_group] || self[:target_mode]) && !%i[fs dir].include?(self[:type]) end end diff --git a/lib/puppet/type/libvirtd_conf.rb b/lib/puppet/type/libvirtd_conf.rb index 87f8816..4098609 100644 --- a/lib/puppet/type/libvirtd_conf.rb +++ b/lib/puppet/type/libvirtd_conf.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true Puppet::Type.newtype(:libvirtd_conf) do ensurable @@ -10,20 +11,23 @@ newproperty(:value) do desc 'The value of the setting to be defined.' + # rubocop:disable Lint/DuplicateBranch munge do |value| - value = if value.is_a?(Integer) + value = case value + when Integer value.to_s.strip - elsif %r{^\[.*\]$}.match?(value) + when %r{^\[.*\]$} value.to_s.strip - elsif value.is_a?(String) - '"' + value + '"' + when String + "\"#{value}\"" else value.to_s.strip end value end + # rubocop:enable Lint/DuplicateBranch - def is_to_s(currentvalue) # rubocop:disable Style/PredicateName + def is_to_s(currentvalue) if resource.secret? '[old secret redacted]' else diff --git a/lib/puppet/type/libvirtd_default.rb b/lib/puppet/type/libvirtd_default.rb index 0ce9f39..072a87d 100644 --- a/lib/puppet/type/libvirtd_default.rb +++ b/lib/puppet/type/libvirtd_default.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true Puppet::Type.newtype(:libvirtd_default) do ensurable @@ -14,7 +15,7 @@ value end - def is_to_s(currentvalue) # rubocop:disable Style/PredicateName + def is_to_s(currentvalue) if resource.secret? '[old secret redacted]' else diff --git a/lib/puppet_x/libvirt/rexml_sorted_attributes.rb b/lib/puppet_x/libvirt/rexml_sorted_attributes.rb index 25057fe..3f3a300 100644 --- a/lib/puppet_x/libvirt/rexml_sorted_attributes.rb +++ b/lib/puppet_x/libvirt/rexml_sorted_attributes.rb @@ -1,11 +1,17 @@ +# frozen_string_literal: true + # REXML module with sorted attributes so we have a deterministic output # require 'rexml/document' +# rubocop:disable Lint/ToEnumArguments +# rubocop:disable Naming/MethodParameterName # replace each_attribute with a sorted version class REXML::Attributes alias xx_each_attribute each_attribute def each_attribute(&b) - to_enum(:xx_each_attribute).sort_by { |x| x.name }.each(&b) + to_enum(:xx_each_attribute).sort_by(&:name).each(&b) end end +# rubocop:enable Lint/ToEnumArguments +# rubocop:enable Naming/MethodParameterName diff --git a/lib/puppet_x/libvirt/sort_elements.rb b/lib/puppet_x/libvirt/sort_elements.rb index aef147e..eb07da8 100644 --- a/lib/puppet_x/libvirt/sort_elements.rb +++ b/lib/puppet_x/libvirt/sort_elements.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # # @summary function which recursivly sorts # the elements by name of an XML tree. @@ -11,13 +13,9 @@ def recursive_sort(elements) # remove text with only space elements.elements.delete(element) element.each do |child| - if (child.class == REXML::Text) && %r{^\s*$}.match?(child.to_s) - element.delete(child) - end - end - if %r{^\s*$}.match?(element.text) - element.delete element.get_text + element.delete(child) if child.instance_of?(REXML::Text) && %r{^\s*$}.match?(child.to_s) end + element.delete element.get_text if %r{^\s*$}.match?(element.text) elements.elements.add(recursive_sort(element)) end end From ee7db42366ab2c4b17741c2bafbdc67936b5125f Mon Sep 17 00:00:00 2001 From: Benedikt Trefzer Date: Wed, 10 Dec 2025 18:51:01 +0100 Subject: [PATCH 4/4] add missing comma in examples --- examples/network/default.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/network/default.pp b/examples/network/default.pp index 4ef189f..b6b0cb4 100644 --- a/examples/network/default.pp +++ b/examples/network/default.pp @@ -36,7 +36,7 @@ 'family' => 'ipv6', 'address' => '2001:db8:ca2:2::1', 'prefix' => '64', - } + }, ], }