anaynayak/aws-security-viz

Uninitialized constant ColorPicker::NodeColors::GraphViz - Did you mean? Graphviz

ayeks opened this issue · 5 comments

ayeks commented

Hey,

when executing aws-security-viz I get the following Error:

aws_security_viz -a XXXXXXXXXXXXXXXXXXXx -s YYYYYYYYYYYYYYYYYYY -f viz.svg --color=true
[ERROR] uninitialized constant ColorPicker::NodeColors::GraphViz
Did you mean?  Graphviz

I tried the following ways to install graphviz which all resulted in the same error:

    1. install via sudo apt-get install graphviz
    1. install via sudo gem install graphviz
    1. install via bundler install --path vendor/bundle and exec with bundler exec

I am happy to try out a fix if you point me to the file where the constant should be initialized.

Best regards
Lars


Debug info:

$ uname -a
Linux lars-Inspiron-7559 4.15.0-43-generic #46-Ubuntu SMP Thu Dec 6 14:45:28 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
$ bundler
Using rake 12.3.2
Using aws-eventstream 1.0.1
Using aws-partitions 1.129.0
Using aws-sigv4 1.0.3
Using jmespath 1.4.0
Using aws-sdk-core 3.44.2
Using aws-sdk-ec2 1.65.0
Using process-group 1.1.0
Using process-pipeline 1.0.1
Using graphviz 1.1.0
Using optimist 3.0.0
Using organic_hash 1.0.2
Using lazy_priority_queue 0.1.1
Using stream 0.5
Using rgl 0.5.3
Using aws_security_viz 0.1.5 from source at `.`
Using bundler 2.0.1
Using diff-lcs 1.3
Using rspec-support 3.8.0
Using rspec-core 3.8.0
Using rspec-expectations 3.8.2
Using rspec-mocks 3.8.0
Using rspec 3.8.0

@ayeks thanks for reporting this. I've identified the problem and would push a fix shortly.

This is fixed with 527478e . Do let me know if you still face issues.

ayeks commented

Thanks for replying so fast! The commit fixed the constant error. Unfortunately the svg can't be rendered still. Every other parameter for -f than *.json results in [ERROR] No such file or directory - dot.

-f *.json works

$ DEBUG=true bundler exec aws_security_viz -a XXXXX -s YYYYY -f aws.json
node: default
edge: default -> default
edge: default -> 0.0.0.0/0

Generated aws.json file looks good:

{"nodes":[{"id":"default","label":"default"},{"id":"0.0.0.0/0","label":"0.0.0.0/0"}],"edges":[{"id":"default-default","source":"default","target":"default","label":"*"},{"id":"default-0.0.0.0/0","source":"default","target":"0.0.0.0/0","label":"*"}]}

view.html works as well

-f *.svg fails

SVG creation works not. Same output for executing without -f parameter.

$ DEBUG=true bundler exec aws_security_viz -a XXXXXX -s YYYYYY -f viz.svg
node: default
edge: default -> default
edge: default -> 0.0.0.0/0
[ERROR] No such file or directory - dot
  • No .json file gets created
  • aws.svg / .png file is empty

Generate graph with existing json fails

Using the generated aws.json fails as well.

$ DEBUG=true bundler exec aws_security_viz -o aws.json -f viz.svg --color
[ERROR] undefined method `collect' for nil:NilClass

No viz.svg file gets created in this case.

@ayeks you'd also install graphviz on your machine. I'll add this as a post-install message in the gem so that it is easier to remember.
brew install graphviz --with-gts

Also, about the last scenario:

Generate graph with existing json fails
Using the generated aws.json fails as well.

I'm assuming that you used the output from the previous command ? If so, that wouldn't work. It would need the security groups from the aws cli. The purpose of this is only if you don't trust the tool with your AWS credentials and instead want to pass it a static generated json file. You can generate one by using the following command:

aws ec2 describe-security-groups  > groups.json
bundler exec aws_security_viz -o groups.json -f viz.svg --color
ayeks commented

Perfect! Installed graphviz via apt-get again and it works. I thought the gem is all I need.

Thanks a lot!