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
F18773342: D7695.id17388.diff
Thu, Oct 9, 9:08 AM
F18766673: D7695.diff
Tue, Oct 7, 5:50 PM
F18753005: D7695.diff
Sat, Oct 4, 5:05 PM
F18722681: D7695.id17390.diff
Mon, Sep 29, 11:20 PM
F18642689: D7695.diff
Sep 19 2025, 12:31 AM
F18635429: D7695.id17390.diff
Sep 17 2025, 1:15 AM
F18622536: D7695.diff
Sep 15 2025, 12:13 PM
F18109056: D7695.id17378.diff
Aug 11 2025, 11:33 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