wallix / awless

A Mighty CLI for AWS
http://awless.io/
Apache License 2.0
4.97k stars 263 forks source link

awless show error #161

Closed hectorv closed 6 years ago

hectorv commented 6 years ago

I keep getting errors for different calls to awless show:

❯ awless show i-1b169f9c
[error]   file '/Users/hector/.awless/aws/rdf/us-east-1/infra.triples': tok ' .
<vol-14212bbc> <cloud:type> "gp2':reaching literate but missing element (node count 0)

❯ awless show AIDAIJYONYZNJAECNQ4FY
[error]   file '/Users/hector/.awless/aws/rdf/us-east-1/infra.triples': tok ' .
<vol-14212bbc> <cloud:type> "gp2':reaching literate but missing element (node count 0)
❯ awless --version
awless version=v0.1.5, commit=21a3a94174dfe7033ce760f050c187637100d22e, build-date=2017-10-05T14:56:19+02:00, build-arch=amd64, build-os=darwin, build-for=targz

Any ideas what could be wrong? Thanks!

simcap commented 6 years ago

Thanks for reporting @hectorv , quite a key issue!

Explanations: awless encodes locally cloud data using the NTriple RDF format. We use triplestore as our encode/decode store. Here the store tells us it cannot decode the data line concerning the volume. It could be due to an escape character or a issue in our triplestore codec.

To fix it, we will need to see what the triplestore cannot parse, so basically get the full line causing the codec issue.

So here are the steps for you at the command line:

  1. run a command to reproduce the error (to make sure it is still there and that the data have not been overwritten by a sync)
  2. do not run any other awless command
  3. do a grep on the file in error grabbing the line in error with some context line around. Ex: grep -C 2 "<vol-14212bbc> <cloud:type>" /Users/hector/.awless/aws/rdf/us-east-1/infra.triples (note that if you just put the volume id here you will get to many lines so by adding more char to grep we get a unique line)
  4. put the output of the grep in this issue.

(The grep command will output the line in error with 2 lines above and below so we can see the multi-line context i.e. linefeed, carriage returns, etc...).

Then I will work on it starting Tuesday!

hectorv commented 6 years ago

@simcap thanks for the detailed instructions :) Here it is:

<arn:aws:ecs:us-east-1:xxx:container-instance/77879497-e51c-43e8-ad2c-0cd9d62dc7fe> <cloud:attributes> <831ce0f2> .
<ami-e22c518b> <cloud:description> "differs from api-server.1.0_x64 (ami-1dbec974) in that it it includes some image libraries and pillow.  This box is really small, but the exact commands are documented in an email between Alice and Bob entitled "Installing pillow on the webservers"." .
<vol-14212bbc> <cloud:type> "gp2" .
<i-0265ac85d85050421> <cloud:vpc> <vpc-ed1b1d84> .
<arn:aws:ecr:us-east-1:xxx:repository/quiz-web-prod> <cloud:account> "xxx" .
simcap commented 6 years ago

The issue is our NTriple parser parsing the line:

<ami-e22c518b> <cloud:description> "differs from api-server.1.0_x64 (ami-1dbec974) in that it it includes some image libraries and pillow.  This box is really small, but the exact commands are documented in an email between Alice and Bob entitled "Installing pillow on the webservers"." .

We can reduce this line - while still exposing the error - to:

<node> <node> "anystring ""." .

The lenient parser currently uses ". or " . as a terminator of a NTriple of the form subject, predicate, string literal. Here a terminator token appears before the real end one. So the parsing of the next triple begins earlier making the next line (with the volume) faulty.

The parser implementation has been done this way for various reason. But obviously this is a limitation that we need to improve on.

@hectorv While we are fixing the issue, in the meantime you can solve the issue if you edit the description string (through the web console) of the AMI (if this is not an official one) to use single quote instead of double, or to remove the dot . at the end.

If you cannot edit that string or if that does not make sense let me know.

hectorv commented 6 years ago

@simcap thanks, editing the AMI description did the trick. I also had to force a re-sync (maybe there's a better way):

❯ rm -fr ~/.awless
simcap commented 6 years ago

Good!

Other easier way to re-sync would be:

$ awless sync -r my-correct-region

or only the infra as we know it is the volume who is concerned

$ awless sync --infra -r my-region

We will close this issue once it is properly fixed. Thanks.

simcap commented 6 years ago

Closed with fix in wallix/triplestore dependency