1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-11-21 22:32:41 +01:00

Make --conduit-token work without requiring .arcrc

Summary:
Ref T5955. This logic is a little cleaner than the previous version.

Don't require `~/.arcrc` to exist if the caller provides `--conduit-token`.

Test Plan:
  - Made calls with `--conduit-token` and no `~/.arcrc`.
  - Made calls with `--conduit-token` and a normal `~/.arcrc`.
  - Made calls with normal `arc`.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: mbishopim3, epriestley

Maniphest Tasks: T5955

Differential Revision: https://secure.phabricator.com/D12750
This commit is contained in:
epriestley 2015-05-07 11:09:58 -07:00
parent 3e36b3fc43
commit 6c5d12d839
2 changed files with 4 additions and 26 deletions

View file

@ -204,9 +204,6 @@ try {
if ($force_conduit_version) {
$workflow->forceConduitVersion($force_conduit_version);
}
if ($force_token) {
$workflow->forceConduitToken($force_token);
}
if ($conduit_timeout) {
$workflow->setConduitTimeout($conduit_timeout);
}
@ -316,6 +313,9 @@ try {
$user_name = idx($host_config, 'user');
$certificate = idx($host_config, 'cert');
$conduit_token = idx($host_config, 'token');
if ($force_token) {
$conduit_token = $force_token;
}
$description = implode(' ', $original_argv);
$credentials = array(

View file

@ -48,7 +48,6 @@ abstract class ArcanistWorkflow extends Phobject {
private $conduitCredentials;
private $conduitAuthenticated;
private $forcedConduitVersion;
private $forcedConduitToken;
private $conduitTimeout;
private $userPHID;
@ -252,21 +251,6 @@ abstract class ArcanistWorkflow extends Phobject {
}
/**
* Force use of a specific API token.
*
* Controlled by the --conduit-token flag.
*
* @param string API token to use.
* @return this
* @task conduit
*/
final public function forceConduitToken($token) {
$this->forcedConduitToken = $token;
return $this;
}
/**
* Get the protocol version the client should identify with.
*
@ -341,13 +325,7 @@ abstract class ArcanistWorkflow extends Phobject {
// If we have `token`, this server supports the simpler, new-style
// token-based authentication. Use that instead of all the certificate
// stuff.
$token = null;
if (isset($credentials['token'])) {
$token = $credentials['token'];
}
if ($this->forcedConduitToken) {
$token = $this->forcedConduitToken;
}
$token = idx($credentials, 'token');
if (strlen($token)) {
$conduit = $this->getConduit();