Hello community, here is the log from the commit of package platformsh-cli for openSUSE:Leap:15.2 checked in at 2020-04-17 13:39:08 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Leap:15.2/platformsh-cli (Old) and /work/SRC/openSUSE:Leap:15.2/.platformsh-cli.new.2738 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "platformsh-cli" Fri Apr 17 13:39:08 2020 rev:43 rq:794868 version:3.54.0 Changes: -------- --- /work/SRC/openSUSE:Leap:15.2/platformsh-cli/platformsh-cli.changes 2020-04-12 15:38:41.226025564 +0200 +++ /work/SRC/openSUSE:Leap:15.2/.platformsh-cli.new.2738/platformsh-cli.changes 2020-04-17 13:39:17.864299068 +0200 @@ -1,0 +2,12 @@ +Thu Apr 16 03:13:06 UTC 2020 - ji...@boombatower.com + +- Update to version 3.54.0: + * Release v3.54.0 + * Fix deleting httpaccess settings using a merge patch (#917) + * Update src/Command/Integration/IntegrationCommandBase.php + * Remove the unused --environment option for integration:activity commands + * Tweak help for browser login (#916) + * Automatically prompt for login when token refresh fails (#918) + * Remove default From address for health.email notifications + +------------------------------------------------------------------- Old: ---- platformsh-cli-3.53.1.tar.xz New: ---- platformsh-cli-3.54.0.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ platformsh-cli.spec ++++++ --- /var/tmp/diff_new_pack.vUHRzY/_old 2020-04-17 13:39:18.296299392 +0200 +++ /var/tmp/diff_new_pack.vUHRzY/_new 2020-04-17 13:39:18.300299396 +0200 @@ -17,7 +17,7 @@ Name: platformsh-cli -Version: 3.53.1 +Version: 3.54.0 Release: 0 Summary: Tool for managing Platform.sh services from the command line # See licenses.txt for dependency licenses. ++++++ _service ++++++ --- /var/tmp/diff_new_pack.vUHRzY/_old 2020-04-17 13:39:18.324299413 +0200 +++ /var/tmp/diff_new_pack.vUHRzY/_new 2020-04-17 13:39:18.324299413 +0200 @@ -2,7 +2,7 @@ <service name="tar_scm" mode="disabled"> <param name="versionformat">@PARENT_TAG@</param> <param name="versionrewrite-pattern">v(.*)</param> - <param name="revision">refs/tags/v3.53.1</param> + <param name="revision">refs/tags/v3.54.0</param> <param name="url">git://github.com/platformsh/platformsh-cli.git</param> <param name="scm">git</param> <param name="changesgenerate">enable</param> ++++++ _servicedata ++++++ --- /var/tmp/diff_new_pack.vUHRzY/_old 2020-04-17 13:39:18.344299429 +0200 +++ /var/tmp/diff_new_pack.vUHRzY/_new 2020-04-17 13:39:18.348299431 +0200 @@ -1,6 +1,6 @@ <servicedata> <service name="tar_scm"> <param name="url">git://github.com/platformsh/platformsh-cli.git</param> - <param name="changesrevision">698e5e4ea198ec4e5ef3130cd811c5f63c5b8730</param> + <param name="changesrevision">440efd66b1e61cbbb4f661f0a519d75e0f109b40</param> </service> </servicedata> ++++++ licenses.txt ++++++ --- /var/tmp/diff_new_pack.vUHRzY/_old 2020-04-17 13:39:18.384299459 +0200 +++ /var/tmp/diff_new_pack.vUHRzY/_new 2020-04-17 13:39:18.384299459 +0200 @@ -15,8 +15,8 @@ padraic/humbug_get_contents 1.1.2 BSD-3-Clause padraic/phar-updater v1.0.6 BSD-3-Clause paragonie/random_compat v2.0.18 MIT -pjcdawkins/guzzle-oauth2-plugin v2.2.0 MIT -platformsh/client v0.31.2 MIT +pjcdawkins/guzzle-oauth2-plugin v2.3.1 MIT +platformsh/client v0.32.2 MIT platformsh/console-form v0.0.24 MIT psr/container 1.0.0 MIT psr/log 1.1.2 MIT ++++++ platformsh-cli-3.53.1.tar.xz -> platformsh-cli-3.54.0.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.53.1/composer.json new/platformsh-cli-3.54.0/composer.json --- old/platformsh-cli-3.53.1/composer.json 2020-04-07 23:15:20.000000000 +0200 +++ new/platformsh-cli-3.54.0/composer.json 2020-04-15 13:54:14.000000000 +0200 @@ -8,7 +8,7 @@ "guzzlehttp/guzzle": "^5.3", "guzzlehttp/ringphp": "^1.1", "platformsh/console-form": ">=0.0.22 <2.0", - "platformsh/client": ">=0.31.0 <2.0", + "platformsh/client": ">=0.32.2 <2.0", "symfony/console": "^3.0 >=3.2", "symfony/yaml": "^3.0 || ^2.6", "symfony/finder": "^3.0", diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.53.1/composer.lock new/platformsh-cli-3.54.0/composer.lock --- old/platformsh-cli-3.53.1/composer.lock 2020-04-07 23:15:20.000000000 +0200 +++ new/platformsh-cli-3.54.0/composer.lock 2020-04-15 13:54:14.000000000 +0200 @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "e64662852f713a138ff535500cab4a5a", + "content-hash": "3e250e9c63b2b4eda20ebd937ab94d57", "packages": [ { "name": "cocur/slugify", @@ -620,16 +620,16 @@ }, { "name": "pjcdawkins/guzzle-oauth2-plugin", - "version": "v2.2.0", + "version": "v2.3.1", "source": { "type": "git", "url": "https://github.com/pjcdawkins/guzzle-oauth2-plugin.git", - "reference": "4bbb1261a18f419f5fe1f15cdf47d384cc94cfe0" + "reference": "f8139ff410824c68a6a341dcd88bf070e5908a9e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/pjcdawkins/guzzle-oauth2-plugin/zipball/4bbb1261a18f419f5fe1f15cdf47d384cc94cfe0", - "reference": "4bbb1261a18f419f5fe1f15cdf47d384cc94cfe0", + "url": "https://api.github.com/repos/pjcdawkins/guzzle-oauth2-plugin/zipball/f8139ff410824c68a6a341dcd88bf070e5908a9e", + "reference": "f8139ff410824c68a6a341dcd88bf070e5908a9e", "shasum": "" }, "require": { @@ -661,20 +661,20 @@ } ], "description": "An OAuth2 plugin (subscriber) for Guzzle (forked from commerceguys/guzzle-oauth2-plugin)", - "time": "2019-05-29T20:51:02+00:00" + "time": "2020-04-15T07:44:29+00:00" }, { "name": "platformsh/client", - "version": "v0.31.2", + "version": "v0.32.2", "source": { "type": "git", "url": "https://github.com/platformsh/platformsh-client-php.git", - "reference": "073a925c8524169675495234d68b72d77f411a12" + "reference": "f9672b6fd14c5450a8194c0abadef18a63956ba1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/platformsh/platformsh-client-php/zipball/073a925c8524169675495234d68b72d77f411a12", - "reference": "073a925c8524169675495234d68b72d77f411a12", + "url": "https://api.github.com/repos/platformsh/platformsh-client-php/zipball/f9672b6fd14c5450a8194c0abadef18a63956ba1", + "reference": "f9672b6fd14c5450a8194c0abadef18a63956ba1", "shasum": "" }, "require": { @@ -683,7 +683,7 @@ "guzzlehttp/cache-subscriber": "~0.1", "guzzlehttp/guzzle": "~5.3", "php": ">=5.5.9", - "pjcdawkins/guzzle-oauth2-plugin": "^2.2" + "pjcdawkins/guzzle-oauth2-plugin": ">=2.3.1 <=3.0" }, "require-dev": { "phpunit/phpunit": "~4.5" @@ -704,7 +704,7 @@ } ], "description": "Platform.sh API client", - "time": "2020-01-29T10:13:08+00:00" + "time": "2020-04-15T08:21:33+00:00" }, { "name": "platformsh/console-form", @@ -2119,6 +2119,7 @@ "email": "jakub.onde...@gmail.com" } ], + "abandoned": "php-parallel-lint/php-console-color", "time": "2018-09-29T17:23:10+00:00" }, { @@ -2165,6 +2166,7 @@ } ], "description": "Highlight PHP code in terminal", + "abandoned": "php-parallel-lint/php-console-highlighter", "time": "2018-09-29T18:48:56+00:00" }, { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.53.1/config.yaml new/platformsh-cli-3.54.0/config.yaml --- old/platformsh-cli-3.53.1/config.yaml 2020-04-07 23:15:20.000000000 +0200 +++ new/platformsh-cli-3.54.0/config.yaml 2020-04-15 13:54:14.000000000 +0200 @@ -75,7 +75,6 @@ docs_search_url: 'https://www.google.com/search?q=site%3Adocs.platform.sh%20{{ terms }}' accounts_url: 'https://accounts.platform.sh' pricing_url: 'https://platform.sh/pricing' - default_from_address: 'nore...@platform.sh' api_token_help_url: 'https://docs.platform.sh/gettingstarted/cli/api-tokens.html' available_regions: - eu-2.platform.sh diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.53.1/dist/manifest.json new/platformsh-cli-3.54.0/dist/manifest.json --- old/platformsh-cli-3.53.1/dist/manifest.json 2020-04-07 23:15:20.000000000 +0200 +++ new/platformsh-cli-3.54.0/dist/manifest.json 2020-04-15 13:54:14.000000000 +0200 @@ -17,10 +17,10 @@ }, { "name": "platform.phar", - "sha1": "273b81502850892cc1171a3b9ddf71dd012c2260", - "sha256": "a23d9da35d332748be790f8161fdff53a52eeca5bbb2fe2e88b7aab393b78fdf", - "url": "https://github.com/platformsh/platformsh-cli/releases/download/v3.53.1/platform.phar", - "version": "3.53.1", + "sha1": "1e90f764feb4203f79eb7b68158ffd76d9dd8da3", + "sha256": "06ca91da1ea38b26eedf72fbee2289a3372179accd50f148f32fcdb1c475fdf5", + "url": "https://github.com/platformsh/platformsh-cli/releases/download/v3.54.0/platform.phar", + "version": "3.54.0", "php": { "min": "5.5.9" }, @@ -253,6 +253,11 @@ "notes": "New features:\n\n * Use Docker credential helpers to store secrets.\n There are 3 Docker credential helpers available from:\n https://github.com/docker/docker-credential-helpers\n\n These allow storing secrets in a system appropriate way: Keychain on OS X,\n the libsecret keyring on Linux (the GNOME keyring), and the Credential\n Manager on Windows.\n\n This falls back to the previous file-based storage for systems incompatible with\n the credential helpers.\n\n * Add integration:activity commands:\n - integration:activity:get\n - integration:activity:list (i:act)\n - integration:activity:log\n\n * Add API token login command (auth:api-token-login).\n\n * Supply SSH options to mount:upload and mount:download commands.\n This allows specifying an SSH key with the --identity-file (-i) option to\n these commands.\n\nOther changes:\n\n * Remove password login help (the auth:password-login command is deprecated).\n * xdebug: change \"key\" to \"idekey\".\n * Prefer .zshrc rather than .zprofile for installation in ZSH.\n * Show the command output for failed processes to help debugging.", "show from": "3.52.0", "hide from": "3.53.0" + }, + { + "notes": "New features:\n\n* Automatically prompt for login when token refresh fails.\n\nOther changes:\n\n* Fix deleting httpaccess settings via the environment:httpaccess command.\n* Remove the unused --environment option for integration:activity commands\n This also stops the commands unnecessarily prompting for an environment.\n* Tweak help for browser login.\n* Remove default From address for health.email notifications\n The API now provides a sensible default.", + "show from": "3.53.0", + "hide from": "3.54.0" } ] } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.53.1/services.yaml new/platformsh-cli-3.54.0/services.yaml --- old/platformsh-cli-3.53.1/services.yaml 2020-04-07 23:15:20.000000000 +0200 +++ new/platformsh-cli-3.54.0/services.yaml 2020-04-15 13:54:14.000000000 +0200 @@ -26,7 +26,7 @@ api: class: '\Platformsh\Cli\Service\Api' - arguments: ['@config', '@cache', '@api_token_storage'] + arguments: ['@config', '@cache', '@output', '@api_token_storage'] api_token_storage: class: '\Platformsh\Cli\ApiToken\StorageInterface' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.53.1/src/Command/Auth/BrowserLoginCommand.php new/platformsh-cli-3.54.0/src/Command/Auth/BrowserLoginCommand.php --- old/platformsh-cli-3.53.1/src/Command/Auth/BrowserLoginCommand.php 2020-04-07 23:15:20.000000000 +0200 +++ new/platformsh-cli-3.54.0/src/Command/Auth/BrowserLoginCommand.php 2020-04-15 13:54:14.000000000 +0200 @@ -165,7 +165,8 @@ // Show some help. $this->stdErr->writeln(''); $this->stdErr->writeln('<options=bold>Help:</>'); - $this->stdErr->writeln(' Use Ctrl+C to quit this process.'); + $this->stdErr->writeln(' Leave this command running during login.'); + $this->stdErr->writeln(' If you need to quit, use Ctrl+C.'); $this->stdErr->writeln("\n" . preg_replace('/^/m', ' ', $this->getApiTokenHelp())); $this->stdErr->writeln(''); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.53.1/src/Command/CommandBase.php new/platformsh-cli-3.54.0/src/Command/CommandBase.php --- old/platformsh-cli-3.53.1/src/Command/CommandBase.php 2020-04-07 23:15:20.000000000 +0200 +++ new/platformsh-cli-3.54.0/src/Command/CommandBase.php 2020-04-15 13:54:14.000000000 +0200 @@ -386,7 +386,7 @@ if ($urlService->canOpenUrls() && $questionHelper->confirm("Authentication is required.\nLog in via a browser?")) { $this->stdErr->writeln(''); - $exitCode = $this->runOtherCommand('auth:browser-login'); + $exitCode = $this->runOtherCommand('auth:browser-login', ['--force' => true]); $this->stdErr->writeln(''); $success = $exitCode === 0; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.53.1/src/Command/Environment/EnvironmentHttpAccessCommand.php new/platformsh-cli-3.54.0/src/Command/Environment/EnvironmentHttpAccessCommand.php --- old/platformsh-cli-3.53.1/src/Command/Environment/EnvironmentHttpAccessCommand.php 2020-04-07 23:15:20.000000000 +0200 +++ new/platformsh-cli-3.54.0/src/Command/Environment/EnvironmentHttpAccessCommand.php 2020-04-15 13:54:14.000000000 +0200 @@ -21,13 +21,13 @@ 'access', null, InputOption::VALUE_IS_ARRAY | InputOption::VALUE_REQUIRED, - 'Access restriction in the format "permission:address"' + 'Access restriction in the format "permission:address". Use 0 to clear all addresses.' ) ->addOption( 'auth', null, InputOption::VALUE_IS_ARRAY | InputOption::VALUE_REQUIRED, - 'Authentication details in the format "username:password"' + 'HTTP Basic auth credentials in the format "username:password". Use 0 to clear all credentials.' ) ->addOption( 'enabled', @@ -139,72 +139,61 @@ $access = $input->getOption('access'); $accessOpts = []; + $change = false; $enabled = $input->getOption('enabled'); if ($enabled !== null) { + $change = true; $accessOpts['is_enabled'] = !in_array($enabled, ['0', 'false']); } - if ($access) { + if ($access === ['0']) { + $accessOpts['addresses'] = null; + $change = true; + } elseif ($access !== []) { $accessOpts['addresses'] = []; foreach (array_filter($access) as $access) { - $accessOpts["addresses"][] = $this->parseAccess($access); + $accessOpts['addresses'][] = $this->parseAccess($access); } + $change = true; } - if ($auth) { - $accessOpts['basic_auth'] = []; + if ($auth === ['0']) { + $accessOpts['basic_auth'] = null; + $change = true; + } elseif ($auth !== []) { foreach (array_filter($auth) as $auth) { $parsed = $this->parseAuth($auth); - $accessOpts["basic_auth"][$parsed["username"]] = $parsed["password"]; + $accessOpts['basic_auth'][$parsed['username']] = $parsed['password']; } + $change = true; } - // Ensure the environment is refreshed. $selectedEnvironment = $this->getSelectedEnvironment(); - $selectedEnvironment->ensureFull(); $environmentId = $selectedEnvironment->id; /** @var \Platformsh\Cli\Service\PropertyFormatter $formatter */ $formatter = $this->getService('property_formatter'); - if (!empty($accessOpts)) { - $current = (array) $selectedEnvironment->http_access; - - // Merge existing settings. Not using a reference here, as that - // would affect the comparison with $current later. - foreach ($current as $key => $value) { - if (!isset($accessOpts[$key])) { - $accessOpts[$key] = $value; - } + // Patch the environment with the changes. + if ($change) { + $result = $selectedEnvironment->update(['http_access' => $accessOpts]); + $this->api()->clearEnvironmentsCache($selectedEnvironment->project); + + $this->stdErr->writeln("Updated HTTP access settings for the environment <info>$environmentId</info>:"); + + $output->writeln($formatter->format($selectedEnvironment->http_access, 'http_access')); + + $success = true; + if (!$result->countActivities()) { + $this->redeployWarning(); + } elseif ($this->shouldWait($input)) { + /** @var \Platformsh\Cli\Service\ActivityMonitor $activityMonitor */ + $activityMonitor = $this->getService('activity_monitor'); + $success = $activityMonitor->waitMultiple($result->getActivities(), $this->getSelectedProject()); } - if ($current != $accessOpts) { - // The API only accepts {} for an empty "basic_auth" value, - // rather than []. - if (isset($accessOpts['basic_auth']) && $accessOpts['basic_auth'] === []) { - $accessOpts['basic_auth'] = (object) []; - } - - // Patch the environment with the changes. - $result = $selectedEnvironment->update(['http_access' => $accessOpts]); - $this->api()->clearEnvironmentsCache($selectedEnvironment->project); - - $this->stdErr->writeln("Updated HTTP access settings for the environment <info>$environmentId</info>:"); - - $output->writeln($formatter->format($selectedEnvironment->http_access, 'http_access')); - - $success = true; - if (!$result->countActivities()) { - $this->redeployWarning(); - } elseif ($this->shouldWait($input)) { - /** @var \Platformsh\Cli\Service\ActivityMonitor $activityMonitor */ - $activityMonitor = $this->getService('activity_monitor'); - $success = $activityMonitor->waitMultiple($result->getActivities(), $this->getSelectedProject()); - } - - return $success ? 0 : 1; - } + return $success ? 0 : 1; } $this->stdErr->writeln("HTTP access settings for the environment <info>$environmentId</info>:"); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.53.1/src/Command/Integration/Activity/IntegrationActivityGetCommand.php new/platformsh-cli-3.54.0/src/Command/Integration/Activity/IntegrationActivityGetCommand.php --- old/platformsh-cli-3.53.1/src/Command/Integration/Activity/IntegrationActivityGetCommand.php 2020-04-07 23:15:20.000000000 +0200 +++ new/platformsh-cli-3.54.0/src/Command/Integration/Activity/IntegrationActivityGetCommand.php 2020-04-15 13:54:14.000000000 +0200 @@ -24,15 +24,16 @@ ->addArgument('activity', InputArgument::OPTIONAL, 'The activity ID. Defaults to the most recent integration activity.') ->addOption('property', 'P', InputOption::VALUE_REQUIRED, 'The property to view') ->setDescription('View detailed information on a single integration activity'); - $this->addProjectOption() - ->addEnvironmentOption(); + $this->addProjectOption(); + $this->addOption('environment', 'e', InputOption::VALUE_REQUIRED, '[Deprecated option, not used]'); Table::configureInput($this->getDefinition()); PropertyFormatter::configureInput($this->getDefinition()); } protected function execute(InputInterface $input, OutputInterface $output) { - $this->validateInput($input); + $this->warnAboutDeprecatedOptions(['environment']); + $this->validateInput($input, true); $project = $this->getSelectedProject(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.53.1/src/Command/Integration/Activity/IntegrationActivityListCommand.php new/platformsh-cli-3.54.0/src/Command/Integration/Activity/IntegrationActivityListCommand.php --- old/platformsh-cli-3.53.1/src/Command/Integration/Activity/IntegrationActivityListCommand.php 2020-04-07 23:15:20.000000000 +0200 +++ new/platformsh-cli-3.54.0/src/Command/Integration/Activity/IntegrationActivityListCommand.php 2020-04-15 13:54:14.000000000 +0200 @@ -30,13 +30,14 @@ $this->setHiddenAliases(['integration:activities']); Table::configureInput($this->getDefinition()); PropertyFormatter::configureInput($this->getDefinition()); - $this->addProjectOption() - ->addEnvironmentOption(); + $this->addProjectOption(); + $this->addOption('environment', 'e', InputOption::VALUE_REQUIRED, '[Deprecated option, not used]'); } protected function execute(InputInterface $input, OutputInterface $output) { - $this->validateInput($input); + $this->warnAboutDeprecatedOptions(['environment']); + $this->validateInput($input, true); $project = $this->getSelectedProject(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.53.1/src/Command/Integration/Activity/IntegrationActivityLogCommand.php new/platformsh-cli-3.54.0/src/Command/Integration/Activity/IntegrationActivityLogCommand.php --- old/platformsh-cli-3.53.1/src/Command/Integration/Activity/IntegrationActivityLogCommand.php 2020-04-07 23:15:20.000000000 +0200 +++ new/platformsh-cli-3.54.0/src/Command/Integration/Activity/IntegrationActivityLogCommand.php 2020-04-15 13:54:14.000000000 +0200 @@ -24,13 +24,14 @@ ->addOption('timestamps', 't', InputOption::VALUE_NONE, 'Display a timestamp next to each message') ->setDescription('Display the log for an integration activity'); PropertyFormatter::configureInput($this->getDefinition()); - $this->addProjectOption() - ->addEnvironmentOption(); + $this->addProjectOption(); + $this->addOption('environment', 'e', InputOption::VALUE_REQUIRED, '[Deprecated option, not used]'); } protected function execute(InputInterface $input, OutputInterface $output) { - $this->validateInput($input); + $this->warnAboutDeprecatedOptions(['environment']); + $this->validateInput($input, true); $project = $this->getSelectedProject(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.53.1/src/Command/Integration/IntegrationCommandBase.php new/platformsh-cli-3.54.0/src/Command/Integration/IntegrationCommandBase.php --- old/platformsh-cli-3.53.1/src/Command/Integration/IntegrationCommandBase.php 2020-04-07 23:15:20.000000000 +0200 +++ new/platformsh-cli-3.54.0/src/Command/Integration/IntegrationCommandBase.php 2020-04-15 13:54:14.000000000 +0200 @@ -341,8 +341,9 @@ 'conditions' => ['type' => [ 'health.email', ]], - 'description' => 'The From address for alert emails', + 'description' => '[Optional] Custom From address for alert emails', 'default' => $this->config()->getWithDefault('service.default_from_address', null), + 'required' => false, ]), 'recipients' => new ArrayField('Recipients', [ 'conditions' => ['type' => [ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.53.1/src/Service/Api.php new/platformsh-cli-3.54.0/src/Service/Api.php --- old/platformsh-cli-3.53.1/src/Service/Api.php 2020-04-07 23:15:20.000000000 +0200 +++ new/platformsh-cli-3.54.0/src/Service/Api.php 2020-04-15 13:54:14.000000000 +0200 @@ -2,9 +2,11 @@ namespace Platformsh\Cli\Service; +use CommerceGuys\Guzzle\Oauth2\AccessToken; use Doctrine\Common\Cache\CacheProvider; use GuzzleHttp\ClientInterface; use GuzzleHttp\Event\ErrorEvent; +use GuzzleHttp\Exception\BadResponseException; use Platformsh\Cli\ApiToken\Storage; use Platformsh\Cli\ApiToken\StorageInterface; use Platformsh\Cli\CredentialHelper\Manager; @@ -13,6 +15,7 @@ use Platformsh\Cli\Model\Route; use Platformsh\Cli\Util\NestedArrayUtil; use Platformsh\Client\Connection\Connector; +use Platformsh\Client\Exception\ApiResponseException; use Platformsh\Client\Model\Deployment\EnvironmentDeployment; use Platformsh\Client\Model\Environment; use Platformsh\Client\Model\Project; @@ -20,6 +23,9 @@ use Platformsh\Client\Model\Resource as ApiResource; use Platformsh\Client\PlatformClient; use Platformsh\Client\Session\Storage\File; +use Symfony\Component\Console\Output\ConsoleOutput; +use Symfony\Component\Console\Output\ConsoleOutputInterface; +use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\EventDispatcher\EventDispatcher; use Symfony\Component\EventDispatcher\EventDispatcherInterface; @@ -34,6 +40,12 @@ /** @var \Doctrine\Common\Cache\CacheProvider */ protected $cache; + /** @var OutputInterface */ + private $output; + + /** @var OutputInterface */ + private $stdErr; + /** @var StorageInterface */ private $apiTokenStorage; @@ -75,16 +87,20 @@ * * @param Config|null $config * @param CacheProvider|null $cache + * @param OutputInterface|null $output * @param StorageInterface|null $apiTokenStorage * @param EventDispatcherInterface|null $dispatcher */ public function __construct( Config $config = null, CacheProvider $cache = null, + OutputInterface $output = null, StorageInterface $apiTokenStorage = null, EventDispatcherInterface $dispatcher = null ) { $this->config = $config ?: new Config(); + $this->output = $output ?: new ConsoleOutput(); + $this->stdErr = $output instanceof ConsoleOutputInterface ? $output->getErrorOutput(): $output; $this->apiTokenStorage = $apiTokenStorage ?: Storage::factory($this->config); $this->dispatcher = $dispatcher ?: new EventDispatcher(); @@ -272,10 +288,45 @@ $connectorOptions['revoke_url'] = $this->config->get('api.oauth2_revoke_url'); } + $connectorOptions['on_refresh_error'] = function (BadResponseException $e) { + return $this->onRefreshError($e); + }; + return $connectorOptions; } /** + * Logs out and prompts for re-authentication after a token refresh error. + * + * @param BadResponseException $e + * + * @return AccessToken|null + */ + private function onRefreshError(BadResponseException $e) { + $response = $e->getResponse(); + if ($response && !in_array($response->getStatusCode(), [400, 401])) { + return null; + } + + $this->logout(); + $this->stdErr->writeln('<comment>Your session has expired. You have been logged out.</comment>'); + + if ($response && $this->stdErr->isVeryVerbose()) { + $this->stdErr->writeln($e->getMessage() . ApiResponseException::getErrorDetails($response)); + } + + $this->stdErr->writeln(''); + + $this->dispatcher->dispatch('login_required'); + $session = $this->getClient(false)->getConnector()->getSession(); + if (!$session->get('accessToken')) { + return null; + } + + return new AccessToken($session->get('accessToken'), $session->get('tokenType') ?: null, ['expires' => $session->get('expires') ?: null]); + } + + /** * @return array */ public function getGuzzleOptions() { ++++++ platformsh-cli-vendor.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vendor/autoload.php new/vendor/autoload.php --- old/vendor/autoload.php 2020-04-08 21:12:07.878932067 +0200 +++ new/vendor/autoload.php 2020-04-16 05:13:13.120584925 +0200 @@ -4,4 +4,4 @@ require_once __DIR__ . '/composer/autoload_real.php'; -return ComposerAutoloaderInit6bf3c85db5aeeea4f0ca359a60956462::getLoader(); +return ComposerAutoloaderInita5a20c44729d051bb2c404e0b78e24cb::getLoader(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vendor/composer/autoload_real.php new/vendor/composer/autoload_real.php --- old/vendor/composer/autoload_real.php 2020-04-08 21:12:07.878932067 +0200 +++ new/vendor/composer/autoload_real.php 2020-04-16 05:13:13.120584925 +0200 @@ -2,7 +2,7 @@ // autoload_real.php @generated by Composer -class ComposerAutoloaderInit6bf3c85db5aeeea4f0ca359a60956462 +class ComposerAutoloaderInita5a20c44729d051bb2c404e0b78e24cb { private static $loader; @@ -19,15 +19,15 @@ return self::$loader; } - spl_autoload_register(array('ComposerAutoloaderInit6bf3c85db5aeeea4f0ca359a60956462', 'loadClassLoader'), true, true); + spl_autoload_register(array('ComposerAutoloaderInita5a20c44729d051bb2c404e0b78e24cb', 'loadClassLoader'), true, true); self::$loader = $loader = new \Composer\Autoload\ClassLoader(); - spl_autoload_unregister(array('ComposerAutoloaderInit6bf3c85db5aeeea4f0ca359a60956462', 'loadClassLoader')); + spl_autoload_unregister(array('ComposerAutoloaderInita5a20c44729d051bb2c404e0b78e24cb', 'loadClassLoader')); $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded()); if ($useStaticLoader) { require_once __DIR__ . '/autoload_static.php'; - call_user_func(\Composer\Autoload\ComposerStaticInit6bf3c85db5aeeea4f0ca359a60956462::getInitializer($loader)); + call_user_func(\Composer\Autoload\ComposerStaticInita5a20c44729d051bb2c404e0b78e24cb::getInitializer($loader)); } else { $map = require __DIR__ . '/autoload_namespaces.php'; foreach ($map as $namespace => $path) { @@ -48,19 +48,19 @@ $loader->register(true); if ($useStaticLoader) { - $includeFiles = Composer\Autoload\ComposerStaticInit6bf3c85db5aeeea4f0ca359a60956462::$files; + $includeFiles = Composer\Autoload\ComposerStaticInita5a20c44729d051bb2c404e0b78e24cb::$files; } else { $includeFiles = require __DIR__ . '/autoload_files.php'; } foreach ($includeFiles as $fileIdentifier => $file) { - composerRequire6bf3c85db5aeeea4f0ca359a60956462($fileIdentifier, $file); + composerRequirea5a20c44729d051bb2c404e0b78e24cb($fileIdentifier, $file); } return $loader; } } -function composerRequire6bf3c85db5aeeea4f0ca359a60956462($fileIdentifier, $file) +function composerRequirea5a20c44729d051bb2c404e0b78e24cb($fileIdentifier, $file) { if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { require $file; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vendor/composer/autoload_static.php new/vendor/composer/autoload_static.php --- old/vendor/composer/autoload_static.php 2020-04-08 21:12:07.878932067 +0200 +++ new/vendor/composer/autoload_static.php 2020-04-16 05:13:13.120584925 +0200 @@ -4,7 +4,7 @@ namespace Composer\Autoload; -class ComposerStaticInit6bf3c85db5aeeea4f0ca359a60956462 +class ComposerStaticInita5a20c44729d051bb2c404e0b78e24cb { public static $files = array ( '320cde22f66dd4f5d3fd621d3e88b98f' => __DIR__ . '/..' . '/symfony/polyfill-ctype/bootstrap.php', @@ -193,9 +193,9 @@ public static function getInitializer(ClassLoader $loader) { return \Closure::bind(function () use ($loader) { - $loader->prefixLengthsPsr4 = ComposerStaticInit6bf3c85db5aeeea4f0ca359a60956462::$prefixLengthsPsr4; - $loader->prefixDirsPsr4 = ComposerStaticInit6bf3c85db5aeeea4f0ca359a60956462::$prefixDirsPsr4; - $loader->classMap = ComposerStaticInit6bf3c85db5aeeea4f0ca359a60956462::$classMap; + $loader->prefixLengthsPsr4 = ComposerStaticInita5a20c44729d051bb2c404e0b78e24cb::$prefixLengthsPsr4; + $loader->prefixDirsPsr4 = ComposerStaticInita5a20c44729d051bb2c404e0b78e24cb::$prefixDirsPsr4; + $loader->classMap = ComposerStaticInita5a20c44729d051bb2c404e0b78e24cb::$classMap; }, null, ClassLoader::class); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vendor/composer/installed.json new/vendor/composer/installed.json --- old/vendor/composer/installed.json 2020-04-08 21:12:07.382927404 +0200 +++ new/vendor/composer/installed.json 2020-04-16 05:13:12.684581142 +0200 @@ -635,17 +635,17 @@ }, { "name": "pjcdawkins/guzzle-oauth2-plugin", - "version": "v2.2.0", - "version_normalized": "2.2.0.0", + "version": "v2.3.1", + "version_normalized": "2.3.1.0", "source": { "type": "git", "url": "https://github.com/pjcdawkins/guzzle-oauth2-plugin.git", - "reference": "4bbb1261a18f419f5fe1f15cdf47d384cc94cfe0" + "reference": "f8139ff410824c68a6a341dcd88bf070e5908a9e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/pjcdawkins/guzzle-oauth2-plugin/zipball/4bbb1261a18f419f5fe1f15cdf47d384cc94cfe0", - "reference": "4bbb1261a18f419f5fe1f15cdf47d384cc94cfe0", + "url": "https://api.github.com/repos/pjcdawkins/guzzle-oauth2-plugin/zipball/f8139ff410824c68a6a341dcd88bf070e5908a9e", + "reference": "f8139ff410824c68a6a341dcd88bf070e5908a9e", "shasum": "" }, "require": { @@ -655,7 +655,7 @@ "require-dev": { "phpunit/phpunit": "~4.5" }, - "time": "2019-05-29T20:51:02+00:00", + "time": "2020-04-15T07:44:29+00:00", "type": "library", "installation-source": "dist", "autoload": { @@ -682,17 +682,17 @@ }, { "name": "platformsh/client", - "version": "v0.31.2", - "version_normalized": "0.31.2.0", + "version": "v0.32.2", + "version_normalized": "0.32.2.0", "source": { "type": "git", "url": "https://github.com/platformsh/platformsh-client-php.git", - "reference": "073a925c8524169675495234d68b72d77f411a12" + "reference": "f9672b6fd14c5450a8194c0abadef18a63956ba1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/platformsh/platformsh-client-php/zipball/073a925c8524169675495234d68b72d77f411a12", - "reference": "073a925c8524169675495234d68b72d77f411a12", + "url": "https://api.github.com/repos/platformsh/platformsh-client-php/zipball/f9672b6fd14c5450a8194c0abadef18a63956ba1", + "reference": "f9672b6fd14c5450a8194c0abadef18a63956ba1", "shasum": "" }, "require": { @@ -701,12 +701,12 @@ "guzzlehttp/cache-subscriber": "~0.1", "guzzlehttp/guzzle": "~5.3", "php": ">=5.5.9", - "pjcdawkins/guzzle-oauth2-plugin": "^2.2" + "pjcdawkins/guzzle-oauth2-plugin": ">=2.3.1 <=3.0" }, "require-dev": { "phpunit/phpunit": "~4.5" }, - "time": "2020-01-29T10:13:08+00:00", + "time": "2020-04-15T08:21:33+00:00", "type": "library", "installation-source": "dist", "autoload": { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vendor/pjcdawkins/guzzle-oauth2-plugin/src/Oauth2Subscriber.php new/vendor/pjcdawkins/guzzle-oauth2-plugin/src/Oauth2Subscriber.php --- old/vendor/pjcdawkins/guzzle-oauth2-plugin/src/Oauth2Subscriber.php 2019-05-29 22:51:02.000000000 +0200 +++ new/vendor/pjcdawkins/guzzle-oauth2-plugin/src/Oauth2Subscriber.php 2020-04-15 09:44:29.000000000 +0200 @@ -8,6 +8,7 @@ use GuzzleHttp\Event\ErrorEvent; use GuzzleHttp\Event\RequestEvents; use GuzzleHttp\Event\SubscriberInterface; +use GuzzleHttp\Exception\BadResponseException; class Oauth2Subscriber implements SubscriberInterface { @@ -25,6 +26,9 @@ /** @var callable|null */ protected $tokenSave; + /** @var callable|null */ + protected $onRefreshError; + /** * Create a new Oauth2 subscriber. * @@ -85,7 +89,17 @@ $this->refreshTokenGrantType->setRefreshToken($this->refreshToken->getToken()); } if ($this->refreshTokenGrantType->hasRefreshToken()) { - $accessToken = $this->refreshTokenGrantType->getToken(); + try { + $accessToken = $this->refreshTokenGrantType->getToken(); + } catch (BadResponseException $e) { + if (isset($this->onRefreshError)) { + $accessToken = call_user_func($this->onRefreshError, $e); + if ($accessToken) { + return $accessToken; + } + } + throw $e; + } } } @@ -196,4 +210,16 @@ { $this->tokenSave = $tokenSave; } + + /** + * Set a callback that will react to a refresh token error. + * + * @param callable $callback + * A callback which accepts one argument, the BadResponseException, and + * returns an AccessToken or null. + */ + public function setOnRefreshError(callable $callback) + { + $this->onRefreshError = $callback; + } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vendor/platformsh/client/composer.json new/vendor/platformsh/client/composer.json --- old/vendor/platformsh/client/composer.json 2020-01-29 11:13:08.000000000 +0100 +++ new/vendor/platformsh/client/composer.json 2020-04-15 10:21:33.000000000 +0200 @@ -6,7 +6,7 @@ "php": ">=5.5.9", "cocur/slugify": "^2.0 || ~1.0", "guzzlehttp/guzzle": "~5.3", - "pjcdawkins/guzzle-oauth2-plugin": "^2.2", + "pjcdawkins/guzzle-oauth2-plugin": ">=2.3.1 <=3.0", "guzzlehttp/cache-subscriber": "~0.1", "ext-json": "*" }, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vendor/platformsh/client/composer.lock new/vendor/platformsh/client/composer.lock --- old/vendor/platformsh/client/composer.lock 2020-01-29 11:13:08.000000000 +0100 +++ new/vendor/platformsh/client/composer.lock 2020-04-15 10:21:33.000000000 +0200 @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "03fe0925dc2cbf2ec401e9f21bba515b", + "content-hash": "2230ff986e3652acb832e306072738e9", "packages": [ { "name": "cocur/slugify", @@ -338,6 +338,7 @@ } ], "description": "Provides a simple API and specification that abstracts away the details of HTTP into a single PHP function.", + "abandoned": true, "time": "2018-07-31T13:22:33+00:00" }, { @@ -388,20 +389,21 @@ "Guzzle", "stream" ], + "abandoned": true, "time": "2014-10-12T19:18:40+00:00" }, { "name": "pjcdawkins/guzzle-oauth2-plugin", - "version": "v2.2.0", + "version": "v2.3.1", "source": { "type": "git", "url": "https://github.com/pjcdawkins/guzzle-oauth2-plugin.git", - "reference": "4bbb1261a18f419f5fe1f15cdf47d384cc94cfe0" + "reference": "f8139ff410824c68a6a341dcd88bf070e5908a9e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/pjcdawkins/guzzle-oauth2-plugin/zipball/4bbb1261a18f419f5fe1f15cdf47d384cc94cfe0", - "reference": "4bbb1261a18f419f5fe1f15cdf47d384cc94cfe0", + "url": "https://api.github.com/repos/pjcdawkins/guzzle-oauth2-plugin/zipball/f8139ff410824c68a6a341dcd88bf070e5908a9e", + "reference": "f8139ff410824c68a6a341dcd88bf070e5908a9e", "shasum": "" }, "require": { @@ -433,7 +435,7 @@ } ], "description": "An OAuth2 plugin (subscriber) for Guzzle (forked from commerceguys/guzzle-oauth2-plugin)", - "time": "2019-05-29T20:51:02+00:00" + "time": "2020-04-15T07:44:29+00:00" }, { "name": "react/promise", diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vendor/platformsh/client/src/Connection/Connector.php new/vendor/platformsh/client/src/Connection/Connector.php --- old/vendor/platformsh/client/src/Connection/Connector.php 2020-01-29 11:13:08.000000000 +0100 +++ new/vendor/platformsh/client/src/Connection/Connector.php 2020-04-15 10:21:33.000000000 +0200 @@ -49,6 +49,9 @@ * - proxy (array|string): A proxy setting, passed to Guzzle directly. * Use a string to specify an HTTP proxy, or an array to specify * different proxies for different protocols. + * - on_refresh_error: A callback to run when a refresh token error is + * received. It will be passed a Guzzle BadResponseException, and + * should return an AccessToken or null. * @param SessionInterface $session */ public function __construct(array $config = [], SessionInterface $session = null) @@ -67,6 +70,7 @@ 'api_token' => null, 'api_token_type' => 'access', 'gzip' => extension_loaded('zlib'), + 'on_refresh_error' => null, ]; $this->config = Collection::fromConfig($config, $defaults); @@ -153,12 +157,15 @@ ->combine($this->config['revoke_url']) ->__toString(); foreach ($revocations as $type => $token) { - $options = ['body' => [ - 'client_id' => $this->config['client_id'], - 'client_secret' => $this->config['client_secret'], - 'token' => $token, - 'token_type_hint' => $type, - ]]; + $options = [ + 'body' => [ + 'client_id' => $this->config['client_id'], + 'client_secret' => $this->config['client_secret'], + 'token' => $token, + 'token_type_hint' => $type, + ], + 'auth' => false, + ]; try { $this->getClient()->post($url, $options); } catch (ClientException $e) { @@ -337,6 +344,10 @@ $this->oauth2Plugin->setTokenSaveCallback(function (AccessToken $token) { $this->saveToken($token); }); + + if ($this->config['on_refresh_error'] !== null) { + $this->oauth2Plugin->setOnRefreshError($this->config['on_refresh_error']); + } } return $this->oauth2Plugin;