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, Jun 6, 6:30 AM
Unknown Object (File)
Thu, Jun 5, 12:37 PM
Unknown Object (File)
Thu, May 29, 3:50 AM
Unknown Object (File)
Wed, May 28, 11:01 AM
Unknown Object (File)
Tue, May 27, 9:26 PM
Unknown Object (File)
May 10 2025, 2:59 AM
Unknown Object (File)
May 9 2025, 7:31 PM
Unknown Object (File)
May 1 2025, 10:03 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