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
Unknown Object (File)
Fri, Apr 19, 3:29 AM
Unknown Object (File)
Fri, Apr 19, 3:29 AM
Unknown Object (File)
Fri, Apr 19, 3:29 AM
Unknown Object (File)
Fri, Apr 19, 3:29 AM
Unknown Object (File)
Wed, Apr 17, 11:03 AM
Unknown Object (File)
Thu, Apr 11, 4:40 AM
Unknown Object (File)
Tue, Apr 2, 4:02 PM
Unknown Object (File)
Tue, Apr 2, 10:55 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

Lint
Lint Skipped
Unit
Tests Skipped

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