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
F19183056: D7695.id17378.diff
Tue, Dec 16, 3:42 AM
F19146769: D7695.diff
Wed, Dec 10, 3:39 PM
F19145658: D7695.diff
Wed, Dec 10, 3:14 PM
F19082591: D7695.id.diff
Tue, Dec 2, 11:43 AM
F19046890: D7695.diff
Thu, Nov 27, 11:52 AM
F18872568: D7695.diff
Nov 5 2025, 5:08 AM
F18870676: D7695.diff
Nov 4 2025, 6:24 PM
F18855120: D7695.id17390.diff
Nov 1 2025, 3:23 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