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
F14059309: D7695.diff
Sun, Nov 17, 6:57 PM
F14052724: D7695.diff
Fri, Nov 15, 10:06 AM
F14052566: D7695.id17390.diff
Fri, Nov 15, 9:33 AM
F14052565: D7695.id17388.diff
Fri, Nov 15, 9:33 AM
F14052563: D7695.id17378.diff
Fri, Nov 15, 9:33 AM
F14052562: D7695.id.diff
Fri, Nov 15, 9:33 AM
F14052561: D7695.diff
Fri, Nov 15, 9:33 AM
F14036296: D7695.diff
Sun, Nov 10, 9:35 AM

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