gaucho icon indicating copy to clipboard operation
gaucho copied to clipboard

KeyError: 'execute'

Open sgrunt91 opened this issue 8 years ago • 7 comments

Hi,

I would like to use your script (thanks for the share) to execute some commands in my stack, but I'm in front of a problem that I didn't understand.

Everytime that I want to execute a command in one of my services I got this error:

Traceback (most recent call last): File "/app/gaucho", line 274, in baker.run() File "/usr/local/lib/python2.7/site-packages/baker.py", line 888, in run value = self.apply(*self.parse(argv), instance=instance) File "/usr/local/lib/python2.7/site-packages/baker.py", line 866, in apply return cmd.fn(*newargs, **newkwargs) File "/app/gaucho", line 225, in execute execution_url = containers[0]['actions']['execute'] KeyError: 'execute

Command used: docker run --rm -it -e CATTLE_ACCESS_KEY=xxxx -e CATTLE_SECRET_KEY=xxxx -e CATTLE_URL="http://rancher.mydomain.org:8080" etlweather/gaucho execute 1s278 hostname

Important note: this happens on only one of my services in the stack, I can execute commands with others services in the same stack. I don't think this is due to the docker image of the service because I've other services with the same image for which it's works.

Have you an idea from where to find the problem ?

I'm using Rancher 1.3

Regards, Sgrunt

sgrunt91 avatar Jan 25 '17 08:01 sgrunt91

Hi Sgrunt,

I unfortunately don't know off-hand. I wasn't the author of the execute command and I haven't used it myself yet. Maybe @ben-ole has an idea?

However, I see you are using Rancher 1.3. I have so far only been using 1.1, but in #10 there are reports of similarly strange issues with Rancher 1.2 whereby the service upgrade works on most services, but some (apparently those with a service id > 100) don't work. Maybe it's the same problem. Not sure.

I'm planning to set up a 1.2/1.3 Rancher for testing on my system soon.

One place to check however which may shed more light to this problem is the Rancher server logs. Maybe there is something there that will tell us what the problem is. Can you check this out?

etlweather avatar Jan 25 '17 15:01 etlweather

Hi @etlweather and @sgrunt91,

I didn't test the execution script on rancher > 1.1.4, so maybe something changed in their API.

Looks like the execution action is not listed in the available actions for the selected container https://github.com/etlweather/gaucho/blob/master/services.py#L225. @sgrunt91 could you check the API of the container manually?

ben-ole avatar Jan 25 '17 15:01 ben-ole

Hi @etlweather @ben-ole !

Thanks both of you for your quick reply!

Indeed, in the API page of my service, there is no "execute" action... Do you think this is because my container have a side-kick container ?

sgrunt91 avatar Jan 25 '17 16:01 sgrunt91

Are you trying to execute a command against a "run once" container?

etlweather avatar Jan 25 '17 16:01 etlweather

Lol @etlweather, no.. :) This is a running container of a MongoDB Router. The side-kick container associed to it is for some deployment scripts. EDIT: that said, the side kick container is a run-once container which probably disable the "execute" action, am I right ? :/

sgrunt91 avatar Jan 25 '17 16:01 sgrunt91

Sorry, my knowledge of the sidekick containers in Rancher is limited as I haven't used that so much, so I don't know what they allow and what they don't in the API. It looks like they don't allow it from the data above.

etlweather avatar Feb 01 '17 16:02 etlweather

I had plenty of scripts with this image and execute, all of them stopped working. I guess this has to do with an API change...

N1v0k avatar Oct 27 '17 09:10 N1v0k