@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

In "bin/drydock lease", take a JSON "--attributes" so we can accept complex values

Summary:
Depends on D19750. See T13210. The `bin/drydock lease` command makes it easier to request ad-hoc leases, but currently takes lease attributes in the form `--attributes x=y,a=b`.

This was okay for all leases at the time, but doesn't really work for modern WorkingCopy resources since they take a `repositories.map` which has a dictionary as a value. You can't specify that with `repositories.map=...`.

Instead, point `--attributes` at a JSON file or use `--attributes -` to read from stdin.

Test Plan: Used `--attributes` with a file and stdin to allocate working copy leases with repositories.

Reviewers: amckinley

Reviewed By: amckinley

Subscribers: PHID-OPKG-gm6ozazyms6q6i22gyam

Differential Revision: https://secure.phabricator.com/D19751

+19 -8
+19 -8
src/applications/drydock/management/DrydockManagementLeaseWorkflow.php
··· 20 20 'help' => pht('Set lease expiration time.'), 21 21 ), 22 22 array( 23 - 'name' => 'attributes', 24 - 'param' => 'name=value,...', 25 - 'help' => pht('Resource specification.'), 23 + 'name' => 'attributes', 24 + 'param' => 'file', 25 + 'help' => pht( 26 + 'JSON file with lease attributes. Use "-" to read attributes '. 27 + 'from stdin.'), 26 28 ), 27 29 )); 28 30 } ··· 49 51 } 50 52 } 51 53 52 - $attributes = $args->getArg('attributes'); 53 - if ($attributes) { 54 - $options = new PhutilSimpleOptions(); 55 - $options->setCaseSensitive(true); 56 - $attributes = $options->parse($attributes); 54 + $attributes_file = $args->getArg('attributes'); 55 + if (strlen($attributes_file)) { 56 + if ($attributes_file == '-') { 57 + echo tsprintf( 58 + "%s\n", 59 + 'Reading JSON attributes from stdin...'); 60 + $data = file_get_contents('php://stdin'); 61 + } else { 62 + $data = Filesystem::readFile($attributes_file); 63 + } 64 + 65 + $attributes = phutil_json_decode($data); 66 + } else { 67 + $attributes = array(); 57 68 } 58 69 59 70 $lease = id(new DrydockLease())