GithubHelp home page GithubHelp logo

acquia / cli Goto Github PK

View Code? Open in Web Editor NEW
42.0 42.0 45.0 5.62 MB

Command-line interface for Acquia Cloud Platform products

Home Page: https://docs.acquia.com/acquia-cli/

License: GNU General Public License v2.0

PHP 99.89% Batchfile 0.01% Dockerfile 0.03% Shell 0.06%
acquia cli drupal

cli's Introduction

Build status codecov Mutation testing badge

Acquia CLI

The official command-line tool for interacting with the Acquia Cloud Platform and services. Acquia CLI (acli) helps you run Drush commands and tail logs from your Acquia-hosted applications, manage Acquia Cloud IDEs, create and manage teams and applications via the Cloud Platform API, and much more!

Acquia CLI is not a local development environment. If you are looking for an integrated development environment, consider Acquia Cloud IDE or third-party tools such as Lando.

Installation and usage

Install instructions and official documentation are available at https://docs.acquia.com/acquia-cli/install/

cli's People

Contributors

akashkska avatar alanevans avatar alberto56 avatar alchatti avatar alex-moreno avatar anavarre avatar ba66e77 avatar balsama avatar cdubz avatar chaseontheweb avatar danepowell avatar dependabot[bot] avatar eporama avatar fiasco avatar grasmash avatar joshirohit100 avatar jura avatar mdlutz24 avatar netrapk avatar nielsvm avatar rmott-littler avatar shriacquia avatar shubham-bansal96 avatar violinist-bot avatar wimleers avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cli's Issues

self-update command aborting tests

I think PHPUnit tests are exiting early as a result of a regression introduced by #220

A bit insidious because the tests still pass but don't run to completion. I'm not sure exactly how to fix this, or how to prevent this from recurring.

This also means that we aren't getting code coverage reports. Again, coveralls should fail the test run if it can't report, and Github shouldn't allow merging if coveralls didn't report.

Failing to download drush aliases

Using drush 8:

~$ drush --version
 Drush Version   :  8.3.1-dev

acli latest release

~$ acli --version
acli v1.0.0-beta1

acli is properly configured to acquia as I can retrieve api:applications:list

~$ acli api:applications:list
[
    {
        "id": 9999,
        "uuid": "000bXXXXXXXXXX",
        "name": "XXXXXXX",
        "hosting": {
            "type": "ace",
            "id": "prod:XXXXXX"
        },
        "subscription": {
            "uuid": "000XXXXX",
            "name": "XXXXXXXX"
        },
[..snip..]

But drush aliases download command api:accounts:drush-aliases is failing:

~$ acli api:accounts:drush-aliases 8

In Client.php line 110:

  Only Drush 8 and 9 are supported.


api:accounts:drush-aliases [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [--] <command> <version>

remote:aliases:download pre/post hooks

We had some custom logic to manipulate aliases pre/post acquia_update using:

//drush_hook_pre_COMMAND -> drush_custom_pre_acquia_update
//drush_hook_post_COMMAND -> drush_custom_post_acquia_update

Would it be possible to have equivalent commands for remote:aliases:download in order to manipulate those downloaded aliases?

Too many arguments, expected arguments "command" "environmentId" error when using "api:environments:code-switch"

Describe the bug
When running this command

acli api:environments:code-switch myapp.dev "my-feature-branch"

... the process fails with the following error

In ArgvInput.php line 171: [Symfony\Component\Console\Exception\RuntimeException] Too many arguments, expected arguments "command" "environmentId". Exception trace: at phar:///usr/local/bin/acli/vendor/symfony/console/Input/ArgvInput.php:171 Symfony\Component\Console\Input\ArgvInput->parseArgument() at phar:///usr/local/bin/acli/vendor/symfony/console/Input/ArgvInput.php:82 Symfony\Component\Console\Input\ArgvInput->parse() at phar:///usr/local/bin/acli/vendor/symfony/console/Input/Input.php:55 Symfony\Component\Console\Input\Input->bind() at phar:///usr/local/bin/acli/vendor/symfony/console/Command/Command.php:217 Symfony\Component\Console\Command\Command->run() at phar:///usr/local/bin/acli/src/Command/CommandBase.php:243 Acquia\Cli\Command\CommandBase->run() at phar:///usr/local/bin/acli/vendor/symfony/console/Application.php:929 Symfony\Component\Console\Application->doRunCommand() at phar:///usr/local/bin/acli/vendor/symfony/console/Application.php:264 Symfony\Component\Console\Application->doRun() at phar:///usr/local/bin/acli/vendor/symfony/console/Application.php:140 Symfony\Component\Console\Application->run() at phar:///usr/local/bin/acli/bin/acli:95 require() at /usr/local/bin/acli:12 api:environments:code-switch [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [--] <command> <environmentId>

This error has been reproduced on own environments too.

Could you please help us investigate why ? Thanks

Sophie

acli api:applications:find often returns "The {applicationUuid} must be a valid UUID or site alias" error

acli api:applications:find <uuid> often returns the below error while the UUID is valid:

In ApiCommandBase.php line 248:
                                                             
  The {applicationUuid} must be a valid UUID or site alias.  
                                                             

api:applications:find [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [--] <command> <applicationUuid>

One potential reason for that is we're using our own UUID generation and validation compared to typhonius/acquia-php-sdk-v2 which calls Symfony’s built in validator.

api:environments:stack-metrics-data-metric requires an additional argument

The help output for the api:environments:stack-metrics-data-metric command suggests the following example syntax:

acli api:environments:stack-metrics-data-metric myapp.dev web-cpu web

Unfortunately, when I attempt that syntax (with a real site alias), I get the following error response:

{
    "error": "system",
    "message": "'From' date not provided."
}

This suggests that the underlying API call requires additional arguments to specify the date range for the data returned —but I don't see any way to provide those arguments.

Error responses should be a json response just like success responses

A success response of api:environments:domains-clear-varnish for example:

./acli.phar api:environments:domains-clear-varnish 2701-******-******** --domains=domain.com

{
    "message": "Varnish is being cleared for the selected domains.",
    "_links": {
        "self": {
            "href": "https:\/\/cloud.acquia.com\/api\/environments\/88888-888888-88888\/domains\/actions\/clear-varnish"
        },
        "notification": {
            "href": "https:\/\/cloud.acquia.com\/api\/notifications\/99999-9999990999999"
        }
    }
}

But when it fails, a json response should be expected as well:

./acli.phar api:environments:domains-clear-varnish 2701-invalid-******** --domains=domain.com

In Client.php line 110:

  The ID "2701-invalid-********" is not a valid environment ID.


api:environments:domains-clear-varnish [--domains DOMAINS] [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [--] <command> <environmentId>

Other errors such as invalid domains or others, should also be json... I believe this behavior should be applied to others commands as well...

api:applications:environment-list not finding uuid argument

Current acli version

$ acli --version
acli v1.0.0-beta1

Command not working locally...

$ acli api:applications:environment-list 2cbf4649-9999999999999999
  The "applicationUuid" option does not exist.

api:applications:environment-list [--sort SORT] [--filter FILTER] [--limit LIMIT] [--offset OFFSET] [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [--] <command> <applicationUuid>

same command on ADS works just fine

ads api:applications:environment-list 2cbf4649-9999999999999999
{
[..snip..]
  },
  "_embedded": {
    "items": [
      {
        "id": "00000000-00000000",
        "label": "Dev",
        "name": "dev",
        "application": {
          "name": "sitename",
          "uuid": "11111-111111-111111"
        },
        "domains": [
          "sitenamedev.prod.acquia-sites.com",
          "sitename-dev.custom.io"
        ],

Other commands such as acli api:applications:list works fine.

Command remote:drush should accept aliases with `@` to be similar to standard drush

I’m noticing the acli remote:drush command expects the site aliases as returned by remote:aliases:list, without the @ which is commonly used on drush aliases. If I download the same aliases through our cloud UI and use them in local drush, I’m expected to include the @. Not a big deal but kind of an annoying discrepancy. Just me?

For example, using local drush with aliases downloaded from cloud I need to run…

% drush @mysite.dev status
 Drupal version   : 8.8.8
....

With ACLI, the command is…

 % acli remote:drush mysite.dev status
 Drupal version   : 8.8.8
...

Cannot run on Windows PowerShell

PHP Fatal error: Uncaught Symfony\Component\DependencyInjection\Exception\EnvNotFoundException: Environment variable not found: "HOME".

I think it's due to our usage of HOME in the Symfony config/services.yml.

Git Bash is fine because it has this variable defined.

PHP Notice: Trying to get property 'sshUrl' of non-object in phar:///usr/local/bin/acli/src/Helpers/SshHelper.php on line 153

Ran into the below issue when testing RC6 on an ACSF test subscription. It also happens with RC1 so IDK under which conditions the error shows up because in non-ACE IDEs I have it working well.

ide:~$ ./acli.phar ide:wizard:ssh-key:create-upload
    ✔ Creating a local SSH key
    ✔ Uploading the local key to Acquia Cloud
    ✔ Adding the SSH key to local keychain
    ⠹ Waiting for the key to become available on Acquia Cloud web servers
PHP Notice:  Trying to get property 'sshUrl' of non-object in phar:///home/ide/acli.phar/src/Helpers/SshHelper.php on line 153
    ⣰ Waiting for the key to become available on Acquia Cloud web servers
PHP Notice:  Trying to get property 'sshUrl' of non-object in phar:///home/ide/acli.phar/src/Helpers/SshHelper.php on line 153
    ⡇ Waiting for the key to become available on Acquia Cloud web servers
(snip)

The key looks to be uploaded correctly though.

Allow [site] and [site].[env] to be used rather than appUuid or EnvUuid

We already do this for the remote:* commands: https://github.com/acquia/cli/blob/master/src/Command/Remote/SshBaseCommand.php#L47

We also already substitute applicationUuid when a repo is linked: https://github.com/acquia/cli/blob/master/src/Command/Api/ApiCommandBase.php#L57

So for instance, it'd be nice if both of these worked:

acli api:applications:find eemgrasmick
acli api:applications:find 257a5440-22c3-49d1-894d-29497a1cf3b8

Or:

acli api:environments:domain-clear-varnish 21351-257a5440-22c3-49d1-894d-29497a1cf3b8 eemgrasmickdev.prod.acquia-sites.com
acli api:environments:domain-clear-varnish eemgrasmick.dev eemgrasmickdev.prod.acquia-sites.com

And not just for api:* commands, for all commands.

[Feature-Request] Drush debug command

It would be really helpful if we can add debug mode support like Drush command -d for cli. verbose is very limited and i do not see much of the logs during verbose.

Display a user-friendly message when no Cloud IDE exists

We could probably improve the message when no IDE exists. Currently we only have the string "IDEs"

acli ide:list
Please select an Acquia Cloud application:
  [0] testapp
 > 1
Would you like to link the Cloud application testapp to this repository? n
 ====== 
  IDEs  
 ======

We should probably have something like this:

"No IDE exists for this application. Would you like to create one?" => and upon answering "yes" it would run acli ide:create

acli mistakenly assumes the .version file always exists in IDEs

See

$this->phpVersionFilePath = '/home/ide/configs/php/.version';

The reality in IDEs is we only create this file when we want to switch to a different PHP version than the default. See https://docs.acquia.com/dev-studio/ide/#configuring-the-php-version

So what needs to happen here is we need to create the file if it doesn't exist, and populate it with the expected PHP version we're switching to.

Regression when adding SSH key to keychain with beta2

Brand new IDE:

ide:~$ acli ide:wizard:ssh-key:create-upload
    ✔ Creating a local SSH key
    ✔ Uploading local key to Acquia Cloud
    ⌛ Adding SSH key to local keychain...

In IdeWizardCreateSshKeyCommand.php line 126:
                                                                                                                                      
  Unable to add SSH key to local SSH agent:ssh_askpass: exec(phar:///home/ide/acli/src/Command/Ide/Wizard/passphrase_prompt.sh): No   
  such file or directory                                                                                                              
                                                                                                                                      

ide:wizard:ssh-key:create-upload [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interactio
n] [--] <command>

api:environments:domains-clear-varnish not working

Current acli version

$ acli --version
acli v1.0.0-beta1

When trying to clear varnish cache, command is faling:

$ acli api:environments:domains-clear-varnish 99999-99999999-9999999 --domains=sitename.domain.io,domain2.domain.io

  Too many arguments, expected arguments "command".

api:environments:domains-clear-varnish [--domains DOMAINS] [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [--] <command>

The previous error don't indicate uuid / environment id, i tried to ommit that as seen:

$ acli api:environments:domains-clear-varnish --domains=sitename.domain.io,domain2.domain.io

  The "environmentId" option does not exist.

api:environments:domains-clear-varnish [--domains DOMAINS] [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [--] <command>

Same equivalent command works just fine on ADS

ads api:environments:domains-clear-varnish 99999-99999999-9999999 --domains=sitename.domain.io domain2.domain.io
{
  "message": "Varnish is being cleared for the selected domains.",
  "_links": {
    "self": {
      "href": "https://cloud.acquia.com/api/environments/99999-99999999-9999999/domains/actions/clear-varnish"
    },
    "notification": {
      "href": "https://cloud.acquia.com/api/notifications/33333-44444-55555-6666"
    }
  }
}

acli refresh in an IDE should force you to be in the project directory

Currently, acli refresh can be run from anywhere in an IDE, but the command will fail when it's not in the project directory.

ide:~$ acli refresh
Could not find a local Drupal project. Looked for docroot/index.php in current and parent directories.
Would you like to clone a project into the current directory?y
Would you like to link the Cloud application anavarred8 to this repository? n
Using Cloud Application anavarred8
Choose an Acquia Cloud environment to copy from:
  [0] Dev (vcs: pipelines-build-master)
  [1] pipelines-build-ads-integration (vcs: pipelines-build-ads-integration)
  [2] Stage (vcs: tags/progress)
 > 2
    ⌛ Cloning git repository from Acquia Cloud...
fatal: destination path '.' already exists and is not an empty directory.

In RefreshCommand.php line 576:
                                                 
  Failed to clone repository from Acquia Cloud:  
                                                 

refresh [-from|--cloud-env-uuid CLOUD-ENV-UUID] [--no-code] [--no-files] [--no-databases] [--no-scripts] [--scripts] [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [--] <command>

Since only the project directory can serve a site, we should likely remove any confusion and tell the user they need to change directory and run the command again. We can rely on the environment detector for this.

api:environments:domains-clear-varnish not working

As reported on #110, api:environments:domains-clear-varnish still not working...

already using beta2 (also fails in latest HEAD on master)

$ acli --version
Acquia CLI v1.0.0-beta2

command still failing

acli api:environments:domains-clear-varnish 9999-999999-888888 --domains=domain1.com,domain2.com

  Too many arguments, expected arguments "command".

api:environments:domains-clear-varnish [--domains DOMAINS] [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [--] <command>

Ensure Drupal root can be found

Following Symfony refactor, ensure that Acquia CLI can find and match cloud accounts when running in a subdirectory of the Drupal root.

Issue while clearing more than 1 domain using api:environments:domains-clear-varnish

Fixes from #120 are looking great, just having a minor issue when attempting to clear multiple domains cache at once.

Current master version used:

~/Sites/devops/acquia/cli  master  git log --pretty=oneline --abbrev-commit
a7e8837 (HEAD -> master, origin/master, origin/HEAD) Fixes #120: Keeping case intact. (#126)
[..snip..]

Purging a single domain, works fine:

/Users/lnunes/Sites/devops/acquia/cli/bin/acli api:environments:domains-clear-varnish 2695-2cbf4649-*REDACTED* --domains='domain.com'
{
    "message": "Varnish is being cleared for the selected domains.",
    "_links": {
        "self": {
            "href": "https:\/\/cloud.acquia.com\/api\/environments\/2695-XXXXXXXXX\/domains\/actions\/clear-varnish"
        },
        "notification": {
            "href": "https:\/\/cloud.acquia.com\/api\/notifications\/862b5f5b-XXXXXXX"
        }
    }
}

Multiple domains (comma separated), it fails:

/Users/lnunes/Sites/devops/acquia/cli/bin/acli api:environments:domains-clear-varnish 2695-2cbf4649-*REDACTED*  --domains='domain.com,domain2.com'

In Client.php line 110:

  The domain 'domain.com,domain2.com' does not appear to be a valid domain name.


api:environments:domains-clear-varnish [--domains DOMAINS] [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [--] <command> <environmentId>

Tried some other variations like (with and without quote marks):

--domains='domain.com, domain2.com'
--domains='domain.com domain2.com'

But didnt work as well.

ide:php-version command improvements

The ide:php-version works great. I noticed a few limitations, however. See below:

  • There's no indication the command was executed successfully. A better UX would be for Acquia CLI to return a) the command completed successfully and b) which PHP version is now running
  • Switching to a PHP version that isn't supported works (see below when I tried to switch to PHP 8.0). A better UX would be to return this isn't available in IDEs
ide:~$ php -v
PHP 7.4.6 (cli) (built: Jun  1 2020 17:56:08) ( NTS )
ide:~$ acli ide:php-version 7.2
ide:~$ php -v
PHP 7.2.31 (cli) (built: Jun  1 2020 19:34:41) ( NTS )
ide:~$ acli ide:php-version 7.3
ide:~$ php -v
PHP 7.3.18 (cli) (built: Jun  1 2020 19:39:17) ( NTS )
ide:~$ acli ide:php-version 7.4
ide:~$ php -v
PHP 7.4.6 (cli) (built: Jun  1 2020 17:56:08) ( NTS )
ide:~$ acli ide:php-version 8.0
ide:~$ php -v
PHP 7.4.6 (cli) (built: Jun  1 2020 17:56:08) ( NTS )

ide:wizard:ssh-key:create-upload broken due to missing shell script

Attempting to run ide:wizard:ssh-key:create-upload will throw an error:

In IdeWizardCreateSshKeyCommand.php line 126:
  Unable to add SSH key to local SSH agent:ssh_askpass: exec(phar:///usr/local/bin/acli/src/Command/Ide/Wizard/passphrase_prompt.sh)  
  : No such file or directory

We thought we fixed this by including the shell script in the phar, but I confirmed it's there and we still get the error.

I think the problem is that there's simply no way to run a shell script packaged inside a phar, without doing some gymnastics: https://stackoverflow.com/questions/41710814/execute-helper-script-inside-of-phar

remote:aliases:list command output has columns for Environment Alias and Application reversed

ACLI Version : v1.0.0-rc4

It looks to me like the columns for Environment Alias and Application are reversed in the output of remote:aliases:list. As you can see below the environment aliases appear under the Application column, and vice versa.

% acli remote:aliases:list
Please select an Acquia Cloud application:
...
  [1 ] Barrett Smith (Employee Free)
...
 > 1
Would you like to link the Cloud application Barrett Smith (Employee Free) to this repository? no
+-------------------------------+---------------+-------------------------------------------+
| Environment Alias             | Application   | Environment UUID                          |
+-------------------------------+---------------+-------------------------------------------+
| Barrett Smith (Employee Free) | eebsmith.dev  | 5261-redact-5e                                           |
| Barrett Smith (Employee Free) | eebsmith.prod | 5259-redact-5e                                           |
| Barrett Smith (Employee Free) | eebsmith.test | 5260--redact-5e                                           |
+-------------------------------+---------------+-------------------------------------------+

Create an ide:php command

Currently, to switch PHP versions in IDEs, you need to do the following and restart PHP:

echo "7.4" >> /home/ide/configs/php/.version

To enable Xdebug, you need to uncomment a line under /home/ide/configs/php/xdebug.ini and restart PHP.

We should make all PHP operations easier with Acquia CLI, by introducing an ide:php command. The command should do the following:

  • Allow switching PHP versions (7.2 to 7.4)
  • Enable/disable Xdebug

Note: this command should probably only be visible from within an IDE.

Remote drush commands failing

using latest HEAD

$ git log --pretty=oneline --abbrev-commit

08df362 (HEAD -> master, origin/master, origin/HEAD) Fixes #123: Infer applicationUuid argument for api:* commands. (#128)
[..snip..]

some drush commands will work fine, such as status:

./bin/acli remote:drush sitename.dev status

 Drupal version             :  8.8.7
 Site URI                   :  http://default
 Database driver            :  mysql
 Database hostname          :  ded-9999
 Database port              :  3306
 Database username          :  sitenamedev
 Database name              :  sitenamedev
 Database                   :  Connected
 Drupal bootstrap           :  Successful

[..snip..]

but others with params will fail

./bin/acli remote:drush sitename.dev uli 1

  Too many arguments, expected arguments "command" "alias" "drush_command".

remote:drush [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [--] <command> <alias> <drush_command>

or

./bin/acli remote:drush sitename.dev user-unblock 1

  Too many arguments, expected arguments "command" "alias" "drush_command".

remote:drush [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [--] <command> <alias> <drush_command>

Fatal error: Uncaught RuntimeException: Unable to write in the "cache" directory

Report from a user installing RC4. User is forbidden write access to /usr/local/bin.

$ mv acli /Users/myyser/Development/Acquia/

$ export PATH=/Users/myuser/Development/Acquia
$ acli auth:login

Fatal error: Uncaught RuntimeException: Unable to write in the "cache" directory (phar:///Users/myuser/Development/Acquia/acli/var/cache/prod). in phar:///Users/myuser/Development/Acquia/acli/vendor/symfony/http-kernel/Kernel.php:626
Stack trace:
#0 phar:///Users/myuser/Development/Acquia/acli/vendor/symfony/http-kernel/Kernel.php(532): Symfony\Component\HttpKernel\Kernel->buildContainer()
#1 phar:///Users/myuser/Development/Acquia/acli/vendor/symfony/http-kernel/Kernel.php(131): Symfony\Component\HttpKernel\Kernel->initializeContainer()
#2 phar:///Users/myuser/Development/Acquia/acli/bin/acli(75): Symfony\Component\HttpKernel\Kernel->boot()
#3 /Users/myuser/Development/Acquia/acli(12): require('phar:///Users/g...')
#4 {main}
thrown in phar:///Users/myuser/Development/Acquia/acli/vendor/symfony/http-kernel/Kernel.php on line 626

acli api:environments:cron-create fails to register a new cron job

Failure with Acquia CLI:

$ acli api:environments:cron-create REDACTED --command="/usr/local/bin/drush cc all" --frequency="*/30 * * * *" --label="Test"

                                                   
  An argument with name "command" already exists.  
                                                   

api:environments:cron-create [--server_id SERVER_ID] [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [--] <command> <environmentId>

Success with Dev Studio CLI:

$ ads api:environments:cron-create REDACTED --command="/usr/local/bin/drush cc all" --frequency="*/30 * * * *" --label="Test"
{
  "message": "Creating a new cron.",
  "_links": {
    "self": {
      "href": "https://cloud.acquia.com/api/environments/REDACTED/crons/REDACTED"
    },
    "parent": {
      "href": "https://cloud.acquia.com/api/environments/REDACTED/crons"
    },
    "notification": {
      "href": "https://cloud.acquia.com/api/notifications/REDACTED"
    }
  }
}

self-update errors

When updating from rc4:

% acli update --allow-unstable
Downloading Acquia CLI v1.0.0-rc5
 9539522/9539522 [============================] 100%Updated from v1.0.0-rc4 to v1.0.0-rc5
ception.php',
        'Acquia\\Cli\\Helpers\\ClientService' => __DIR__ . '/../..' . '/src/Helpers/ClientService.php',
        'Acquia\\Cli\\Helpers\\DataStoreContract' => __DIR__ . '/../..' . '/src/Helpers/DataStoreContract.php',
        'Acquia\\Cli\\Helpers\\LocalMachineHelper' => __DIR__ . '/../..' . '/src/Helpers/LocalMachineHelper.php',
        'Acquia\\Cli\\Helpers\\LoopHelper' => __DIR__ . '/../..' . '/src/Helpers/LoopHelper.php',
        'Acquia\\Cli\\Helpers\\SshHelper' => __DIR__ . '/../..' . '/src/Helpers/SshHelper.php',
        'Acquia\\Cli\\Helpers\\TelemetryHelper' => __DIR__ . '/../..' . '/src/Helpers/TelemetryHelper.php',
        'Acquia\\Cli\\Kernel' => __DIR__ . '/../..' . '/src/Kernel.php',
        'Acquia\\Cli\\Output\\Checklist' => __DIR__ . '/../..' . '/src/Output/Checklist.php',
        'Acquia\\Cli\\Output\\Spinner\\Color' => __DIR__ . '/../..' . '/src/Output/Spinner/Color.php',
        'Acquia\\Cli\\Output\\Spinner\\Spinner' => __DIR__ . '/../..' . '/src/Output/Spinner/Spinner.php',
        'Acquia\\Cli\\SelfUpdate\\Strategy\\GithubStrategy' => __DIR__ . '/../..' . '/src/SelfUpdate/Strategy/GithubStrategy.php',
        'Acquia\\DrupalEnvironmentDetector\\AcquiaDrupalEnvironmentDetector' => __DIR__ . '/..' . '/acquia/drupal-environment-detector/src/AcquiaDrupalEnvironmentDetector.php',
        'ArithmeticError' => __DIR__ . '/..' . '/symfony/polyfill-php70/Resources/stubs/ArithmeticError.php',
        'AssertionError' => __DIR__ . '/..' . '/symfony/polyfill-php70/Resources/stubs/AssertionError.php',
        'Composer\\CaBundle\\CaBundle' => __DIR__ . '/..' . '/composer/ca-bundle/src/CaBundle.php',
        'DivisionByZeroError' => __DIR__ . '/..' . '/symfony/polyfill-php70/Resources/stubs/DivisionByZeroError.php',
        'Doctrine\\Common\\Cache\\ApcCactrlen($command->getName()) + 2)."\n\n"
.($command->getDescription() ? $command->getDescription()."\n\n" : '')
.'### Usage'."\n\n"
.array_reduce(array_merge([$command->getSynopsis()], $command->getAliases(), $command->getUsages()), function ($carry, $usage) {
return $carry.'* `'.$usage.'`'."\n";
})
);
if ($help = $command->getProcessedHelp()) {
$this->write("\n");
$this->write($help);
}
if ($command->getNativeDefinition()) {
$this->write("\n\n");
$this->describeInputDefinition($command->getNativeDefinition());
}
}
protected function describeApplication(Application $application, array $options = [])
{
$describedNamespace = isset($options['namespace']) ? $options['namespace'] : null;
$description = new ApplicationDescription($application, $describedNamespace);
$title = $this->getApplicationTitle($application);
$this->write($title."\n".str_repeat('=', Helper::strlen($title)));
foreach ($description->getNamespaces() as $namespace) {
if (ApplicationDescription::GLOBAL_NAMESPACE !== $namespace['id']) {
$this->write("\n\n");

Improve user output when there's a DNS propagation timeout

User feedback related to DNS propagation

Perhaps we should be providing additional feedback on creating an IDE via the acli tool. I just started using acli (in place of ads) and hit the same issue, but acli doesn't even give the impression of a successful IDE creation (upon a time out).

If I hadn't hit the same issue previously, I'd have assumed the process had failed completely and attempted to create another IDE. See from the details I provided in the description in this ticket, at least the ads tool provided links along with the time out message, so I could verify the IDE creation.

$ acli ide:create
Please select an Acquia Cloud application:
  [0] Test Subscription
 > 0
Would you like to link the Cloud application Test subscription to this repository? y
Please enter a label for your Cloud IDE: TEST IDE
    ✔ Creating your Cloud IDE
    ✔ Getting IDE information
    ✔ Waiting for DNS to propagate...
Timed out after 15 minutes!
$
$ acli ide:list
Please select an Acquia Cloud application:
  [0] Test Subscription
 > 0
Would you like to link the Cloud application Test Subscription to this repository? y
 =======================================================================
  IDEs
 =======================================================================
 TEST IDE ([email protected])
  IDE URL: https://<uuid>.ide.ahdev.cloud
  Web URL: https://<uuid>.web.ahdev.cloud
 =======================================================================

So I think at a minimum we should return the links for the newly created IDE.

acli ide:wizard:ssh-key:create-upload needs to run acli auth:login underneath

Currently, we can't automate acli in IDEs because Acquia CLI has a different behavior than Acquia Developer Studio CLI in that it's not running the authentication command when the API keys haven't been sent.

Observe the difference below:

ide:~/project$ ads refresh
The refresh command requires valid Acquia Cloud credentials.
You will need an Acquia Cloud API token from <https://cloud.acquia.com/a/profile/tokens>. You should create a new token specifically for Acquia Developer Studio and get prepared to enter the associated key and secret below.
? Please enter your API Key ide:~/project$ ^C
ide:~/project$ acli refresh

In CommandBase.php line 196:
                                                                                         
  This machine is not yet authenticated with Acquia Cloud. Please run `acli auth:login`  
                                                                                         

refresh [-from|--cloud-env-uuid CLOUD-ENV-UUID] [--no-code] [--no-files] [--no-databases] [--no-scripts] [--scripts] [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [--] <command>

So instead of quitting with an error we'd need acli auth:login to be executed whenever /home/ide/.acquia/cloud_api.conf doesn't exist.

Create a deploy command

In Acquia CLI, there's no equivalent to ads deploy. This means in Cloud IDE users might be confused as to how they can deploy to any Cloud environment.

Here's how ads deploy currently works:

$ ads deploy
Select corresponding Acquia Cloud Application: mydrupalwebsite
? Select source:  Stage
? Select target environment:  Prod
? Are you sure you want to deploy to Prod? Yes
? Do you want to back up the databases before deploying the code? No
? Do you want to clear Varnish cache after the deploy? Yes

Summary:

 ›   Warning: The databases from Prod will not be backed up before deployment.
The environment Prod will be switched to progress.
Varnish cache will be cleared from Prod after deployment.

? Continue? Yes
  ✔ mydrupalwebsite: deploying progress to Prod
  ✔ Clearing Varnish cache

Successfully deployed progress to Prod
? Open the website? No

Perhaps initially in an IDE there could be a wrapper to ads deploy until we have a full-blown command.

The remote:ssh command works, but exits with an exception sometimes

In SshHelper.php line 58:

  [Acquia\Cli\Exception\AcquiaCliException]

The command returns the status of the last command that was run on the remote server. This isn't expected behavior.

Successfully establishing the SSH connection should be sufficient to return successfully. We don't really care about the status of the commands inside the remote server.

PHP Fatal error: Uncaught Error: Class 'Phar' not found in /usr/local/bin/acli:10

I tried installing Acquia CLI on OpenSuse. PHP 7.4 is installed with the JSON extension

$ php -v
PHP 7.4.9 (cli) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
$ installed php7
Loading repository data...
Reading installed packages...

S  | Name      | Summary                                              | Type
---+-----------+------------------------------------------------------+--------
i+ | php7      | Interpreter for the PHP scripting language version 7 | package
i+ | php7-json | JSON (de)serializer functions for PHP                | package

But acli refuses to bootstrap

$ acli
PHP Fatal error:  Uncaught Error: Class 'Phar' not found in /usr/local/bin/acli:10
Stack trace:
#0 {main}
  thrown in /usr/local/bin/acli on line 10

acli refresh doesn't pull composer dependencies when the directory is empty

2 runs below:

  • In the first one the directory is empty and acli doesn't try to pull dependencies
  • In the second one it's not and acli behaves as expected

So it's either we have a different behavior when the dir is empty or we don't correctly detect the composer.json file it seems?

ide:~/project$ acli refresh
Could not find a local Drupal project. Looked for docroot/index.php in current and parent directories.
Would you like to clone a project into the current directory?y
Would you like to link the Cloud application anavarred8 to this repository? n
Using Cloud Application anavarred8
Choose an Acquia Cloud environment to copy from:
  [0] Dev (vcs: pipelines-build-master)
  [1] pipelines-build-ads-integration (vcs: pipelines-build-ads-integration)
  [2] Stage (vcs: tags/progress)
 > 2
    ⌛ Cloning git repository from Acquia Cloud...
Cloning into '.'...
remote: Counting objects: 149300, done.
remote: Compressing objects: 100% (65712/65712), done.
remote: Total 149300 (delta 82016), reused 141431 (delta 74147)
Receiving objects: 100% (149300/149300), 156.56 MiB | 32.58 MiB/s, done.
    ✔ Cloning git repository from Acquia Cloud
    ✔ Importing Drupal database copy from Acquia Cloud
    ✔ Copying Drupal's public files from Acquia Cloud
ide:~/project$ ls -l
total 21412
-rw-r--r-- 1 ide ide 21292364 Jun 11 10:24 anavarred8.sql
drwxr-xr-x 2 ide ide     4096 Jun 11 10:24 blt
-rw-r--r-- 1 ide ide     3849 Jun 11 10:24 composer.json
-rw-r--r-- 1 ide ide   583504 Jun 11 10:24 composer.lock
drwxr-xr-x 4 ide ide     4096 Jun 11 10:24 config
drwxr-xr-x 6 ide ide     4096 Jun 11 10:24 docroot
drwxr-xr-x 3 ide ide     4096 Jun 11 10:24 drush
drwxr-xr-x 2 ide ide     4096 Jun 11 10:24 patches
-rw-r--r-- 1 ide ide     1538 Jun 11 10:24 phpcs.xml.dist
-rw-r--r-- 1 ide ide     6255 Jun 11 10:24 README.md
-rw-r--r-- 1 ide ide       56 Jun 11 10:24 salt.txt
drwxr-xr-x 3 ide ide     4096 Jun 11 10:24 tests
ide:~/project$ acli refresh
Using Cloud Application anavarred8
Choose an Acquia Cloud environment to copy from:
  [0] Dev (vcs: pipelines-build-master)
  [1] pipelines-build-ads-integration (vcs: pipelines-build-ads-integration)
  [2] Stage (vcs: tags/progress)
 > 2
    ✔ Pulling code from Acquia Cloud
    ✔ Importing Drupal database copy from Acquia Cloud
    ✔ Copying Drupal's public files from Acquia Cloud
    ✔ Installing Composer dependencies

acli api:applications:ide-list always returns an error

Here's an example with a sample app UUID. Tried with at leat 5 different app UUIDs for which I know there are existing IDEs.

$ acli api:applications:ide-list a2e88z93-a9fe-4357-b322-cdcw2da68753
{
    "error": "not_found",
    "message": "The path \"api\/api\/applications\/a2e88z93-a9fe-4357-b322-cdcw2da68753\/ides\" does not match any known resources."
}

It appears we’ve prepended an additional api/ to the requested path.

To support different DBs in IDEs, Acquia CLI needs to create the corresponding <DB>-settings.inc file upon doing a refresh

Take an example. Sample IDE is provisioned with sitegroup "test". Automatically, the configuration overrides in the IDE will be stored under /var/www/site-php/test/test-settings.inc

But upon selecting a different database than the default one via Acquia CLI, then the expected path might become /var/www/site-php/test/db2-settings.inc

But the IDE in question won't be updated accordingly. This leaves the user in a dead end because the configuration overrides AND DB credentials are not preconfigured for this specific sitegroup's database.

What we should do is upon doing an acli refresh AND selecting a DB, rename /var/www/site-php/<SITEGROUP>/<DB>-settings.inc so DB-settings.inc is modified accordingly to the database name we're pulling.

acli ide:php-version 7.2 leaves users in a dead end

In IDEs, if we want acli ide:php-version to run for any PHP version supported in the IDE, we need to silence the PHP 7.2 error. Here's an example where switching to PHP 7.2 worked well, but upon switching to PHP 7.4 from PHP 7.2 it returned an error (but did complete the operation).

But if you try to switch to a valid PHP version, this time you'll be out of luck because you'll be on PHP 7.2 and Acquia CLI will shutdown immediately.

$ acli ide:php-version 7.4

Box Requirements Checker
========================

> Using PHP 7.2.31
> PHP is using the following php.ini file:
  /usr/local/php7.2/etc/cli/php.ini

> Checking Box requirements:
  E.....

                                                                                
 [ERROR] Your system is not ready to run the application.                       
                                                                                

Fix the following mandatory requirements:
=========================================

 * The application requires the version "^7.3" or greater.

Self update command works, but displays scary error

 ~  Downloads  $  ./acli.phar self-update --allow-unstable
Updated from v1.0.0-beta5 to v1.0.0-beta6
;

break;
} else {
$this->addLongOption($option->getName(), null);
}
}
}




private function parseLongOption(string $token)
{
$name = substr($token, 2);

if (false !== $pos = strpos($name, '=')) {
if (0 === \strlen($value = substr($name, $pos + 1))) {
array_unshift($this->parsed, $value);
}
$this->addLongOption(substr($name, 0, $pos), $value);
} else {
$this->addLongOption($name, null);
}
}






private function parseArgument(string $token)
{
$c = \count($this->arguments);


 if ($this->definition->hasArgument($c)) {
$arg = $this->definition->getArgument($c);
$this->arguments[$arg->getName()] = $arg->isArray() ? [$token] : $token;


 } elseif ($this->definition->hasArgument($c - 1) && $this->definition->getArgument($c - 1)->isArray()) {
$arg = $this->definition->getArgument($c - 1);
$this->arguments[$arg->getName()][] = $token;


 } else {
$all = $this->definition->getArguments();
if (\count($all)) {
throw new RuntimeException(sprintf('Too many arguments, expected arguments "%s".', implode('" "', array_keys($all))));
}

throw ne
Fatal error: Uncaught Error: Class 'Symfony\Component\Console\Event\ConsoleErrorEvent' not found in phar:///Users/matthew.grasmick/Downloads/acli.phar/vendor/symfony/console/Application.php:934
Stack trace:
#0 phar:///Users/matthew.grasmick/Downloads/acli.phar/vendor/symfony/console/Application.php(264): Symfony\Component\Console\Application->doRunCommand(Object(Acquia\Cli\Command\UpdateCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#1 phar:///Users/matthew.grasmick/Downloads/acli.phar/vendor/symfony/console/Application.php(140): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#2 phar:///Users/matthew.grasmick/Downloads/acli.phar/bin/acli(101): Symfony\Component\Console\Application->run()
#3 /Users/matthew.grasmick/Downloads/acli.phar(12): require('phar:///Users/m...')
#4 {main}
  thrown in phar:///Users/matthew.grasmick/Downloads/acli.phar/vendor/symfony/console/Application.php on line 934

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.