Hello community, here is the log from the commit of package platformsh-cli for openSUSE:Factory checked in at 2019-02-26 22:21:46 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/platformsh-cli (Old) and /work/SRC/openSUSE:Factory/.platformsh-cli.new.28833 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "platformsh-cli" Tue Feb 26 22:21:46 2019 rev:64 rq:679272 version:3.40.4 Changes: -------- --- /work/SRC/openSUSE:Factory/platformsh-cli/platformsh-cli.changes 2019-02-19 12:03:03.673055680 +0100 +++ /work/SRC/openSUSE:Factory/.platformsh-cli.new.28833/platformsh-cli.changes 2019-02-26 22:23:08.338050446 +0100 @@ -1,0 +2,11 @@ +Tue Feb 26 13:46:19 UTC 2019 - [email protected] + +- Update to version 3.40.4: + * Release v3.40.4 + * Block snapshot:restore with --target for legacy regions + * fix(mongo): database authentification + * Release v3.40.3 + * Attempt to find the app root via SSH for Enterprise environments (#781) + * Fix "Service not found: " error in "db:" commands where the service is not known + +------------------------------------------------------------------- Old: ---- platformsh-cli-3.40.2.tar.xz New: ---- platformsh-cli-3.40.4.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ platformsh-cli.spec ++++++ --- /var/tmp/diff_new_pack.w6dcxM/_old 2019-02-26 22:23:08.954050227 +0100 +++ /var/tmp/diff_new_pack.w6dcxM/_new 2019-02-26 22:23:08.954050227 +0100 @@ -17,7 +17,7 @@ Name: platformsh-cli -Version: 3.40.2 +Version: 3.40.4 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.w6dcxM/_old 2019-02-26 22:23:08.978050219 +0100 +++ /var/tmp/diff_new_pack.w6dcxM/_new 2019-02-26 22:23:08.978050219 +0100 @@ -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.40.2</param> + <param name="revision">refs/tags/v3.40.4</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.w6dcxM/_old 2019-02-26 22:23:08.998050212 +0100 +++ /var/tmp/diff_new_pack.w6dcxM/_new 2019-02-26 22:23:08.998050212 +0100 @@ -1,6 +1,6 @@ <servicedata> <service name="tar_scm"> <param name="url">git://github.com/platformsh/platformsh-cli.git</param> - <param name="changesrevision">d32290596cf0d5aec73e88a309c7b94571df8fe3</param> + <param name="changesrevision">503cb7301afffdae8700e5e59170c81e89c6c935</param> </service> </servicedata> ++++++ platformsh-cli-3.40.2.tar.xz -> platformsh-cli-3.40.4.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.40.2/config.yaml new/platformsh-cli-3.40.4/config.yaml --- old/platformsh-cli-3.40.2/config.yaml 2019-02-18 11:22:35.000000000 +0100 +++ new/platformsh-cli-3.40.4/config.yaml 2019-02-26 12:06:03.000000000 +0100 @@ -1,7 +1,7 @@ # Metadata about the CLI application itself. application: name: 'Platform.sh CLI' - version: '3.40.2' + version: '3.40.4' executable: 'platform' package_name: 'platformsh/cli' installer_url: 'https://platform.sh/cli/installer' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.40.2/dist/manifest.json new/platformsh-cli-3.40.4/dist/manifest.json --- old/platformsh-cli-3.40.2/dist/manifest.json 2019-02-18 11:22:35.000000000 +0100 +++ new/platformsh-cli-3.40.4/dist/manifest.json 2019-02-26 12:06:03.000000000 +0100 @@ -1,10 +1,10 @@ [ { "name": "platform.phar", - "sha1": "66eecd90e6872766f7b94825a57e5f9958dbc4d5", - "sha256": "d36648b91dfe8f24c8f38d8be78e48a59ff787bb19cf41a13e7a018c326c5761", - "url": "https://github.com/platformsh/platformsh-cli/releases/download/v3.40.2/platform.phar", - "version": "3.40.2", + "sha1": "070b2b34831f988bc572b8dc77ebf520c9e5e5ea", + "sha256": "a95fba2f073621104114e3c826d0e082385913bf7ada981a9601d245402e3282", + "url": "https://github.com/platformsh/platformsh-cli/releases/download/v3.40.4/platform.phar", + "version": "3.40.4", "php": { "min": "5.5.9" }, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.40.2/src/Command/Db/DbDumpCommand.php new/platformsh-cli-3.40.4/src/Command/Db/DbDumpCommand.php --- old/platformsh-cli-3.40.2/src/Command/Db/DbDumpCommand.php 2019-02-18 11:22:35.000000000 +0100 +++ new/platformsh-cli-3.40.4/src/Command/Db/DbDumpCommand.php 2019-02-26 12:06:03.000000000 +0100 @@ -67,15 +67,16 @@ // Get information about the deployed service associated with the // selected relationship. $deployment = $this->api()->getCurrentDeployment($environment); - $service = $deployment->getService($database['service']); + $service = isset($database['service']) ? $deployment->getService($database['service']) : false; // Get a list of schemas from the service configuration. - $schemas = !empty($service->configuration['schemas']) + $schemas = $service && !empty($service->configuration['schemas']) ? $service->configuration['schemas'] : ['main']; // Filter the list by the schemas accessible from the endpoint. if (isset($database['rel']) + && $service && isset($service->configuration['endpoints'][$database['rel']]['privileges'])) { $schemas = array_intersect( $schemas, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.40.2/src/Command/Db/DbSizeCommand.php new/platformsh-cli-3.40.4/src/Command/Db/DbSizeCommand.php --- old/platformsh-cli-3.40.2/src/Command/Db/DbSizeCommand.php 2019-02-18 11:22:35.000000000 +0100 +++ new/platformsh-cli-3.40.4/src/Command/Db/DbSizeCommand.php 2019-02-26 12:06:03.000000000 +0100 @@ -52,11 +52,15 @@ $this->stdErr->writeln('No database selected.'); return 1; } + if (!isset($database['service'])) { + $this->stdErr->writeln('Unable to find database service information.'); + return 1; + } + $dbServiceName = $database['service']; // Get information about the deployed service associated with the // selected relationship. $deployment = $this->api()->getCurrentDeployment($this->getSelectedEnvironment()); - $dbServiceName = $database['service']; $service = $deployment->getService($dbServiceName); $allocatedDisk = $service->disk; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.40.2/src/Command/Db/DbSqlCommand.php new/platformsh-cli-3.40.4/src/Command/Db/DbSqlCommand.php --- old/platformsh-cli-3.40.2/src/Command/Db/DbSqlCommand.php 2019-02-18 11:22:35.000000000 +0100 +++ new/platformsh-cli-3.40.4/src/Command/Db/DbSqlCommand.php 2019-02-26 12:06:03.000000000 +0100 @@ -53,15 +53,16 @@ // Get information about the deployed service associated with the // selected relationship. $deployment = $this->api()->getCurrentDeployment($this->getSelectedEnvironment()); - $service = $deployment->getService($database['service']); + $service = isset($database['service']) ? $deployment->getService($database['service']) : false; // Get a list of schemas from the service configuration. - $schemas = !empty($service->configuration['schemas']) + $schemas = $service && !empty($service->configuration['schemas']) ? $service->configuration['schemas'] : ['main']; // Filter the list by the schemas accessible from the endpoint. if (isset($database['rel']) + && $service && isset($service->configuration['endpoints'][$database['rel']]['privileges'])) { $schemas = array_intersect( $schemas, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.40.2/src/Command/Local/LocalDrushAliasesCommand.php new/platformsh-cli-3.40.4/src/Command/Local/LocalDrushAliasesCommand.php --- old/platformsh-cli-3.40.2/src/Command/Local/LocalDrushAliasesCommand.php 2019-02-18 11:22:35.000000000 +0100 +++ new/platformsh-cli-3.40.4/src/Command/Local/LocalDrushAliasesCommand.php 2019-02-26 12:06:03.000000000 +0100 @@ -49,7 +49,8 @@ /** @var \Platformsh\Cli\Service\Drush $drush */ $drush = $this->getService('drush'); - if (!$drush->getDrupalApps($projectRoot)) { + $apps = $drush->getDrupalApps($projectRoot); + if (empty($apps)) { $this->stdErr->writeln('No Drupal applications found.'); return 1; @@ -98,6 +99,39 @@ } $environments = $this->api()->getEnvironments($project, true, false); + + // Attempt to find the absolute application root directory for + // each Enterprise environment. This will be cached by the Drush + // service ($drush), for use while generating aliases. + /** @var \Platformsh\Cli\Service\RemoteEnvVars $envVarsService */ + $envVarsService = $this->getService('remote_env_vars'); + foreach ($environments as $environment) { + if ($environment->deployment_target !== 'enterprise') { + continue; + } + foreach ($apps as $app) { + $sshUrl = $environment->getSshUrl($app->getName()); + if (empty($sshUrl)) { + continue; + } + try { + $appRoot = $envVarsService->getEnvVar('APP_DIR', $sshUrl); + } catch (\Symfony\Component\Process\Exception\RuntimeException $e) { + $this->stdErr->writeln(sprintf( + 'Unable to find app root for environment %s, app %s', + $this->api()->getEnvironmentLabel($environment, 'comment'), + '<comment>' . $app->getName() . '</comment>' + )); + $this->stdErr->writeln($e->getMessage()); + continue; + } + if (!empty($appRoot)) { + $this->debug(sprintf('App root for %s: %s', $sshUrl, $appRoot)); + $drush->setCachedAppRoot($sshUrl, $appRoot); + } + } + } + $drush->createAliases($project, $projectRoot, $environments, $current_group); $this->ensureDrushConfig($drush); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.40.2/src/Command/Snapshot/SnapshotRestoreCommand.php new/platformsh-cli-3.40.4/src/Command/Snapshot/SnapshotRestoreCommand.php --- old/platformsh-cli-3.40.2/src/Command/Snapshot/SnapshotRestoreCommand.php 2019-02-18 11:22:35.000000000 +0100 +++ new/platformsh-cli-3.40.4/src/Command/Snapshot/SnapshotRestoreCommand.php 2019-02-26 12:06:03.000000000 +0100 @@ -92,6 +92,16 @@ ? $this->api()->getEnvironmentLabel($targetEnvironment) : '<info>' . $target . '</info>'; + // Do not allow restoring with --target on legacy regions: it can + // overwrite the wrong branch. This is a (hopefully) temporary measure. + if ((!$targetEnvironment || $targetEnvironment->id !== $environment->id) + && preg_match('#https://(eu|us)\.[pm]#', $this->getSelectedProject()->getUri())) { + $this->stdErr->writeln('Snapshots cannot be automatically restored to another environment on this region.'); + $this->stdErr->writeln('Please contact support.'); + + return 1; + } + /** @var \Platformsh\Cli\Service\QuestionHelper $questionHelper */ $questionHelper = $this->getService('question_helper'); $name = $selectedActivity['payload']['backup_name']; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.40.2/src/Service/Drush.php new/platformsh-cli-3.40.4/src/Service/Drush.php --- old/platformsh-cli-3.40.2/src/Service/Drush.php 2019-02-18 11:22:35.000000000 +0100 +++ new/platformsh-cli-3.40.4/src/Service/Drush.php 2019-02-26 12:06:03.000000000 +0100 @@ -36,6 +36,9 @@ /** @var string|null */ protected $executable; + /** @var string[] */ + protected $cachedAppRoots = []; + /** * @param Config|null $config * @param Shell|null $shellHelper @@ -62,6 +65,25 @@ } /** + * @param string $sshUrl + * @param string $enterpriseAppRoot + */ + public function setCachedAppRoot($sshUrl, $enterpriseAppRoot) + { + $this->cachedAppRoots[$sshUrl] = $enterpriseAppRoot; + } + + /** + * @param string $sshUrl + * + * @return string + */ + public function getCachedAppRoot($sshUrl) + { + return isset($this->cachedAppRoots[$sshUrl]) ? $this->cachedAppRoots[$sshUrl] : false; + } + + /** * Find the global Drush configuration directory. * * @return string diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.40.2/src/Service/Relationships.php new/platformsh-cli-3.40.4/src/Service/Relationships.php --- old/platformsh-cli-3.40.2/src/Service/Relationships.php 2019-02-18 11:22:35.000000000 +0100 +++ new/platformsh-cli-3.40.4/src/Service/Relationships.php 2019-02-26 12:06:03.000000000 +0100 @@ -239,7 +239,7 @@ $database['port'] ); if ($schema !== '') { - $args .= '--authenticationDatabase ' . OsUtil::escapePosixShellArg($schema); + $args .= ' --authenticationDatabase ' . OsUtil::escapePosixShellArg($schema); if ($command === 'mongo') { $args .= ' ' . OsUtil::escapePosixShellArg($schema); } else { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.40.2/src/Service/RemoteEnvVars.php new/platformsh-cli-3.40.4/src/Service/RemoteEnvVars.php --- old/platformsh-cli-3.40.2/src/Service/RemoteEnvVars.php 2019-02-18 11:22:35.000000000 +0100 +++ new/platformsh-cli-3.40.4/src/Service/RemoteEnvVars.php 2019-02-26 12:06:03.000000000 +0100 @@ -39,7 +39,10 @@ * @param bool $refresh Whether to refresh the cache. * @param int $ttl The cache lifetime of the result. * - * @return string + * @throws \Symfony\Component\Process\Exception\RuntimeException + * If the SSH command fails. + * + * @return string The environment variable or an empty string. */ public function getEnvVar($variable, $sshUrl, $refresh = false, $ttl = 3600) { @@ -55,7 +58,7 @@ $this->cache->save($cacheKey, $cached, $ttl); } - return $cached; + return $cached ?: ''; } /** diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.40.2/src/SiteAlias/DrushAlias.php new/platformsh-cli-3.40.4/src/SiteAlias/DrushAlias.php --- old/platformsh-cli-3.40.2/src/SiteAlias/DrushAlias.php 2019-02-18 11:22:35.000000000 +0100 +++ new/platformsh-cli-3.40.4/src/SiteAlias/DrushAlias.php 2019-02-26 12:06:03.000000000 +0100 @@ -240,33 +240,25 @@ return false; } - // Drush 8 (on the remote) accepts a relative path for the 'root'. - // Drush 9 (on the remote) does not accept a relative path for some - // structures of Drupal (e.g. where the Drupal root is inside the - // Composer root). - // - // Drush 9 will replace ~/ with the home directory, but Drush 8 won't. - // - // The Drush 9 relative path issue could be resolved via this PR: - // https://github.com/webflo/drupal-finder/pull/40 - // - // The CLI cannot determine the Drush version on the remote, but it - // can make a guess based on the site-local Drush version. Those - // versions may become out of sync, but this is the best we can do for - // now. Relative 'root' support in Drush 9 would solve the problem. - $version = $this->drush->getVersion(); - $root = $version !== false && version_compare($version, '9', '>=') - ? '~/' . $app->getDocumentRoot() - : $app->getDocumentRoot(); + $sshUrl = $environment->getSshUrl($app->getName()); $alias = [ - 'root' => $root, 'options' => [ $this->getAutoRemoveKey() => true, ], ]; - $sshUrl = $environment->getSshUrl($app->getName()); + // For most environments, we know the application root directory is + // '/app'. It's different in Enterprise environments. + if ($environment->deployment_target === 'enterprise') { + $appRoot = $this->drush->getCachedAppRoot($sshUrl); + if ($appRoot) { + $alias['root'] = rtrim($appRoot, '/') . '/' . $app->getDocumentRoot(); + } + } else { + $alias['root'] = '/app/' . $app->getDocumentRoot(); + } + list($alias['user'], $alias['host']) = explode('@', $sshUrl, 2); if ($url = $this->getUrl($environment)) { ++++++ 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 2019-02-18 22:03:04.659144053 +0100 +++ new/vendor/autoload.php 2019-02-26 14:46:23.954494339 +0100 @@ -4,4 +4,4 @@ require_once __DIR__ . '/composer/autoload_real.php'; -return ComposerAutoloaderInitaecf6b35dedc98c8e26348c0045e1a06::getLoader(); +return ComposerAutoloaderInitc8a16bc2e9d3d872a7c1b323b3c5d840::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 2019-02-18 22:03:04.659144053 +0100 +++ new/vendor/composer/autoload_real.php 2019-02-26 14:46:23.954494339 +0100 @@ -2,7 +2,7 @@ // autoload_real.php @generated by Composer -class ComposerAutoloaderInitaecf6b35dedc98c8e26348c0045e1a06 +class ComposerAutoloaderInitc8a16bc2e9d3d872a7c1b323b3c5d840 { private static $loader; @@ -19,15 +19,15 @@ return self::$loader; } - spl_autoload_register(array('ComposerAutoloaderInitaecf6b35dedc98c8e26348c0045e1a06', 'loadClassLoader'), true, true); + spl_autoload_register(array('ComposerAutoloaderInitc8a16bc2e9d3d872a7c1b323b3c5d840', 'loadClassLoader'), true, true); self::$loader = $loader = new \Composer\Autoload\ClassLoader(); - spl_autoload_unregister(array('ComposerAutoloaderInitaecf6b35dedc98c8e26348c0045e1a06', 'loadClassLoader')); + spl_autoload_unregister(array('ComposerAutoloaderInitc8a16bc2e9d3d872a7c1b323b3c5d840', '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\ComposerStaticInitaecf6b35dedc98c8e26348c0045e1a06::getInitializer($loader)); + call_user_func(\Composer\Autoload\ComposerStaticInitc8a16bc2e9d3d872a7c1b323b3c5d840::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\ComposerStaticInitaecf6b35dedc98c8e26348c0045e1a06::$files; + $includeFiles = Composer\Autoload\ComposerStaticInitc8a16bc2e9d3d872a7c1b323b3c5d840::$files; } else { $includeFiles = require __DIR__ . '/autoload_files.php'; } foreach ($includeFiles as $fileIdentifier => $file) { - composerRequireaecf6b35dedc98c8e26348c0045e1a06($fileIdentifier, $file); + composerRequirec8a16bc2e9d3d872a7c1b323b3c5d840($fileIdentifier, $file); } return $loader; } } -function composerRequireaecf6b35dedc98c8e26348c0045e1a06($fileIdentifier, $file) +function composerRequirec8a16bc2e9d3d872a7c1b323b3c5d840($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 2019-02-18 22:03:04.655144026 +0100 +++ new/vendor/composer/autoload_static.php 2019-02-26 14:46:23.954494339 +0100 @@ -4,7 +4,7 @@ namespace Composer\Autoload; -class ComposerStaticInitaecf6b35dedc98c8e26348c0045e1a06 +class ComposerStaticInitc8a16bc2e9d3d872a7c1b323b3c5d840 { public static $files = array ( '320cde22f66dd4f5d3fd621d3e88b98f' => __DIR__ . '/..' . '/symfony/polyfill-ctype/bootstrap.php', @@ -201,9 +201,9 @@ public static function getInitializer(ClassLoader $loader) { return \Closure::bind(function () use ($loader) { - $loader->prefixLengthsPsr4 = ComposerStaticInitaecf6b35dedc98c8e26348c0045e1a06::$prefixLengthsPsr4; - $loader->prefixDirsPsr4 = ComposerStaticInitaecf6b35dedc98c8e26348c0045e1a06::$prefixDirsPsr4; - $loader->classMap = ComposerStaticInitaecf6b35dedc98c8e26348c0045e1a06::$classMap; + $loader->prefixLengthsPsr4 = ComposerStaticInitc8a16bc2e9d3d872a7c1b323b3c5d840::$prefixLengthsPsr4; + $loader->prefixDirsPsr4 = ComposerStaticInitc8a16bc2e9d3d872a7c1b323b3c5d840::$prefixDirsPsr4; + $loader->classMap = ComposerStaticInitc8a16bc2e9d3d872a7c1b323b3c5d840::$classMap; }, null, ClassLoader::class); }
