Skip to content

Commit ede2f0c

Browse files
fix!: change BINDZone refresh, retry, expire and minimum fields to StringFields #653
1 parent 95940c7 commit ede2f0c

File tree

2 files changed

+24
-20
lines changed

2 files changed

+24
-20
lines changed

pfSense-pkg-RESTAPI/files/usr/local/pkg/RESTAPI/Models/BINDZone.inc

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@ class BINDZone extends Model {
3535
public StringField $nameserver;
3636
public StringField $mail;
3737
public IntegerField $serial;
38-
public IntegerField $refresh;
39-
public IntegerField $retry;
40-
public IntegerField $expire;
41-
public IntegerField $minimum;
38+
public StringField $refresh;
39+
public StringField $retry;
40+
public StringField $expire;
41+
public StringField $minimum;
4242
public BooleanField $enable_updatepolicy;
4343
public StringField $updatepolicy;
4444
public ForeignModelField $allowupdate;
@@ -161,30 +161,34 @@ class BINDZone extends Model {
161161
conditions: ['type' => ['master', 'redirect']],
162162
help_text: 'The SOA serial number for this zone.',
163163
);
164-
$this->refresh = new IntegerField(
164+
$this->refresh = new StringField(
165165
default: null,
166166
allow_null: true,
167167
conditions: ['type' => ['master', 'redirect']],
168-
help_text: 'The SOA refresh interval (in seconds) for this zone.',
168+
help_text: 'The SOA refresh interval for this zone. TTL-style time-unit suffixes are ' .
169+
'supported (e.g. 1h, 1d, 1w), otherwise time in seconds is assumed.',
169170
);
170-
$this->retry = new IntegerField(
171+
$this->retry = new StringField(
171172
default: null,
172173
allow_null: true,
173174
conditions: ['type' => ['master', 'redirect']],
174-
help_text: 'The SOA retry interval (in seconds) for this zone.',
175+
help_text: 'The SOA retry interval for this zone. TTL-style time-unit suffixes are ' .
176+
'supported (e.g. 1h, 1d, 1w), otherwise time in seconds is assumed.',
175177
);
176-
$this->expire = new IntegerField(
178+
$this->expire = new StringField(
177179
default: null,
178180
allow_null: true,
179181
conditions: ['type' => ['master', 'redirect']],
180-
help_text: 'The SOA expiry interval (in seconds) for this zone.',
182+
help_text: 'The SOA expiry interval for this zone. TTL-style time-unit suffixes are ' .
183+
'supported (e.g. 1h, 1d, 1w), otherwise time in seconds is assumed.',
181184
);
182-
$this->minimum = new IntegerField(
185+
$this->minimum = new StringField(
183186
default: null,
184187
allow_null: true,
185188
conditions: ['type' => ['master', 'redirect']],
186189
help_text: 'The SOA minimum TTL interval (in seconds) for this zone. This is also referred to as the ' .
187-
'negative TTL.',
190+
'negative TTL. TTL-style time-unit suffixes are supported (e.g. 1h, 1d, 1w), otherwise time in ' .
191+
'seconds is assumed.',
188192
);
189193
$this->enable_updatepolicy = new BooleanField(
190194
default: false,

pfSense-pkg-RESTAPI/files/usr/local/pkg/RESTAPI/Tests/APIModelsBINDZoneTestCase.inc

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,10 @@ class APIModelsBINDZoneTestCase extends TestCase {
4949
nameserver: 'ns1.example.com',
5050
mail: 'admin.example.com',
5151
serial: 123456,
52-
refresh: 3605,
53-
retry: 605,
54-
expire: 86405,
55-
minimum: 2605,
52+
refresh: '3605',
53+
retry: '605',
54+
expire: '86405',
55+
minimum: '2605',
5656
records: [
5757
['name' => 'a.example.com.', 'type' => 'A', 'rdata' => '4.3.2.1'],
5858
['name' => 'mx.example.com.', 'type' => 'MX', 'rdata' => 'mail.example.com.', 'priority' => 5],
@@ -92,10 +92,10 @@ class APIModelsBINDZoneTestCase extends TestCase {
9292
$zone->nameserver->value = 'ns2.example.com';
9393
$zone->mail->value = 'admin2.example.com';
9494
$zone->serial->value = 654321;
95-
$zone->refresh->value = 3606;
96-
$zone->retry->value = 606;
97-
$zone->expire->value = 86406;
98-
$zone->minimum->value = 2606;
95+
$zone->refresh->value = '3606';
96+
$zone->retry->value = '606';
97+
$zone->expire->value = '86406';
98+
$zone->minimum->value = '2606';
9999
$zone->records->value = [
100100
['name' => 'a2.example.com.', 'type' => 'A', 'rdata' => '5.5.5.5'],
101101
['name' => 'mx2.example.com.', 'type' => 'MX', 'rdata' => 'mail2.example.com.', 'priority' => 15],

0 commit comments

Comments
 (0)