Error. Eb clone using BASH script

0

So, I'm trying to clone all our beanstalk environments and wrote a shell script which gets the environments using awscli and then make use of awsebcli to clone.

I loop thru the environment running the following code:

echo 1 | eb init "${BEANSTALK_APPNAME}" -r "${AWS_REGION}" --debug
eb use -r "${AWS_REGION}" "${BEANSTALK_ENVNAME}"
eb clone "${BEANSTALK_ENVNAME}" -n "${BEANSTALK_CLONE_ENVNAME}" -r "${AWS_REGION}" --exact

I get some success cloning some environments however encounter errors cloning others.

Running in debug mode I realise that the problem stems from the eb init stage which causes ERROR: NotFoundError - Environment "BEANSTALK_ENVNAME" not Found at the eb clone stage.

What am I doing wrong please?

Below is a log sample from the eb init stage.

eb : Traceback (most recent call last):
  File "/usr/local/Cellar/aws-elasticbeanstalk/3.14.6/libexec/lib/python2.7/site-packages/ebcli/core/ebrun.py", line 41, in run_app
    app.run()
  File "/usr/local/Cellar/aws-elasticbeanstalk/3.14.6/libexec/lib/python2.7/site-packages/cement/core/foundation.py", line 797, in run
    return_val = self.controller._dispatch()
  File "/usr/local/Cellar/aws-elasticbeanstalk/3.14.6/libexec/lib/python2.7/site-packages/cement/core/controller.py", line 472, in _dispatch
    return func()
  File "/usr/local/Cellar/aws-elasticbeanstalk/3.14.6/libexec/lib/python2.7/site-packages/cement/core/controller.py", line 478, in _dispatch
    return func()
  File "/usr/local/Cellar/aws-elasticbeanstalk/3.14.6/libexec/lib/python2.7/site-packages/ebcli/core/abstractcontroller.py", line 85, in default
    self.do_command()
  File "/usr/local/Cellar/aws-elasticbeanstalk/3.14.6/libexec/lib/python2.7/site-packages/ebcli/controllers/initialize.py", line 203, in do_command
    io.validate_action(prompts['codecommit.usecc'], "y")
  File "/usr/local/Cellar/aws-elasticbeanstalk/3.14.6/libexec/lib/python2.7/site-packages/ebcli/core/io.py", line 232, in validate_action
    result = get_input(output)
  File "/usr/local/Cellar/aws-elasticbeanstalk/3.14.6/libexec/lib/python2.7/site-packages/ebcli/core/io.py", line 152, in get_input
    result = _get_input(output)
  File "/usr/local/Cellar/aws-elasticbeanstalk/3.14.6/libexec/lib/python2.7/site-packages/ebcli/core/io.py", line 158, in _get_input
    return input(output + ': ').strip()
EOFError: EOF when reading a line
tuxan
質問済み 5年前304ビュー
3回答
0
承認された回答

Thread creator has found a workaround to their problem.

AWS
progfan
回答済み 5年前
0

Hi tuxan,

Thanks for reaching out.

  1. From the stack trace on eb init, it appears that eb is waiting for user input. Passing the --platform to eb init should get you around that problem.

  2. Note that there is no problem with your eb clone ... command per se, however, it is good practice to short-circuit command combinations using && (i.e. -- eb init ... && eb use ... && eb clone ...), so that the first command that fails is the last to execute.

Please let me know if you encounter further problems.

Thanks,
Rahul.

AWS
progfan
回答済み 5年前
0

Thank you Rahul.

Yes, I went with the short-circuited command combinations. Thought explicitly laying them out will make for clearer reading up here.

I ended up resolving the issue by creating a new directory for each environment and cloning from within the directory. After the clone I took out the directory and moved on to the next environment. Lots of IO... but just about all I could think of to get passed the problem.

It appeared that there was a lot of conflict/contention making use of the same .elasticbeanstalk/config.yml file in a single directory for all the environments being cloned and making use of different directories resolved it.

Thanks for your response.

Cheers.

tuxan
回答済み 5年前

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ