Projet

Général

Profil

Révision 6a4ffead

ID6a4ffeadf03a0e25d32963d12dcfa68a1a1595d0
Parent 2bcfc1aa
Enfant 8c00b818

Ajouté par Nacho Barrientos il y a plus de 4 ans

Align simplerule and rule rulename requirements

Voir les différences:

REFERENCE.md
1286 1286

  
1287 1287
##### `rulename`
1288 1288

  
1289
Data type: `Pattern[/^[-a-zA-Z0-9_]+$/]`
1289
Data type: `Pattern[/^[a-zA-Z0-9_]+(-\d+)?$/]`
1290 1290

  
1291 1291
The symbolic name for the rule to add. Defaults to the resource's title.
1292 1292

  
manifests/simplerule.pp
54 54
#   Enable traffic counters for the matched traffic.
55 55
define nftables::simplerule (
56 56
  Enum['present','absent'] $ensure = 'present',
57
  Pattern[/^[-a-zA-Z0-9_]+$/] $rulename = $title,
57
  Pattern[/^[a-zA-Z0-9_]+(-\d+)?$/] $rulename = $title,
58 58
  Pattern[/^\d\d$/] $order = '50',
59 59
  String $chain  = 'default_in',
60 60
  String $table = 'inet-filter',
spec/defines/simplerule_spec.rb
272 272
          )
273 273
        }
274 274
      end
275

  
276
      describe 'illegal rule name' do
277
        let(:title) { 'my_wrongrule-name' }
278

  
279
        it { is_expected.to compile.and_raise_error(%r{Error while evaluating a Resource Statement, Nftables::Simplerule}) }
280
      end
275 281
    end
276 282
  end
277 283
end

Formats disponibles : Unified diff