Page MenuHomePhabricator

Validate resource attributes for preallocated hosts before executing leases
ClosedPublic

Authored by hach-que on Dec 4 2013, 5:49 AM.
Tags
None
Referenced Files
F13148640: D7695.diff
Sat, May 4, 3:13 AM
Unknown Object (File)
Thu, May 2, 4:30 PM
Unknown Object (File)
Wed, May 1, 12:45 AM
Unknown Object (File)
Sat, Apr 27, 4:50 PM
Unknown Object (File)
Sat, Apr 27, 4:50 PM
Unknown Object (File)
Sat, Apr 27, 4:50 PM
Unknown Object (File)
Sat, Apr 27, 4:50 PM
Unknown Object (File)
Sat, Apr 27, 4:50 PM

Details

Summary

This prevents issues when the user hasn't provided the appropriate attributes for a preallocated host.

Test Plan

Attempted to lease against a resource with omitted attributes, got an exception thrown before any SSH commands occurred.

Diff Detail

Branch
preallocated-validate
Lint
Lint Passed
Unit
No Test Coverage

Event Timeline

Hmm, this might be a little cleaner and more powerful?

PhutilTypeSpec::checkMap(
  $this->getAttributes('platform', 'host', 'port', 'user', 'path'),
  array(
    'platform' => 'required string',
    'host' => 'required string',
    'port' => 'required int',
    'user' => 'required string',
    'path' => 'required string',
  ));

Then write getAttributes() as:

return array_select_keys($this->attributes, $attribute_names);
hach-que updated this revision to Unknown Object (????).Dec 4 2013, 9:08 PM

Update validation according to feedback