Fix bug in node update

This commit is contained in:
Dane Everitt 2017-02-16 15:57:02 -05:00
parent 59f9ab6e90
commit 73996d3154
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
2 changed files with 4 additions and 5 deletions

View file

@ -126,8 +126,7 @@ class NodesController extends Controller
'fqdn', 'scheme', 'memory', 'fqdn', 'scheme', 'memory',
'memory_overallocate', 'disk', 'memory_overallocate', 'disk',
'disk_overallocate', 'upload_size', 'disk_overallocate', 'upload_size',
'daemonBase', 'daemonSFTP', 'daemonSFTP', 'daemonListen', 'reset_secret',
'daemonListen', 'reset_secret',
])); ]));
Alert::success('Successfully update this node\'s information. If you changed any daemon settings you will need to restart it now.')->flash(); Alert::success('Successfully update this node\'s information. If you changed any daemon settings you will need to restart it now.')->flash();

View file

@ -100,10 +100,10 @@ class NodeRepository
'disk' => 'numeric|min:1', 'disk' => 'numeric|min:1',
'disk_overallocate' => 'numeric|min:-1', 'disk_overallocate' => 'numeric|min:-1',
'upload_size' => 'numeric|min:0', 'upload_size' => 'numeric|min:0',
'daemonBase' => 'regex:/^([\/][\d\w.\-\/]+)$/', 'daemonBase' => 'sometimes|regex:/^([\/][\d\w.\-\/]+)$/',
'daemonSFTP' => 'numeric|between:1,65535', 'daemonSFTP' => 'numeric|between:1,65535',
'daemonListen' => 'numeric|between:1,65535', 'daemonListen' => 'numeric|between:1,65535',
'reset_secret' => 'sometimes|accepted', 'reset_secret' => 'sometimes|nullable|accepted',
]); ]);
// Run validator, throw catchable and displayable exception if it fails. // Run validator, throw catchable and displayable exception if it fails.
@ -138,7 +138,7 @@ class NodeRepository
} }
// Set the Secret // Set the Secret
if (isset($data['reset_secret'])) { if (isset($data['reset_secret']) && ! is_null($data['reset_secret'])) {
$uuid = new UuidService; $uuid = new UuidService;
$data['daemonSecret'] = (string) $uuid->generate('nodes', 'daemonSecret'); $data['daemonSecret'] = (string) $uuid->generate('nodes', 'daemonSecret');
unset($data['reset_secret']); unset($data['reset_secret']);