mozilla-iam/mozilla-aws-cli

No such file or directory $HOME/.cache/maws

Closed this issue · 6 comments

What I did (1/2):

pip install --user --upgrade mozilla-aws-cli

What I see (1/2):

Installing collected packages: mozilla-aws-cli
  Attempting uninstall: mozilla-aws-cli
    Found existing installation: mozilla-aws-cli 1.0.0
    Uninstalling mozilla-aws-cli-1.0.0:
      Successfully uninstalled mozilla-aws-cli-1.0.0
Successfully installed mozilla-aws-cli-1.1.0

What I did (2/2):

$(maws -w)

What I see (2/2):

Traceback (most recent call last):
  File "/Users/emma/.local/bin/maws", line 8, in <module>
    sys.exit(main())
  File "/Users/emma/.local/lib/python3.7/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/Users/emma/.local/lib/python3.7/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/Users/emma/.local/lib/python3.7/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/emma/.local/lib/python3.7/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/Users/emma/.local/lib/python3.7/site-packages/mozilla_aws_cli/cli.py", line 221, in main
    login.login()
  File "/Users/emma/.local/lib/python3.7/site-packages/mozilla_aws_cli/login.py", line 152, in login
    self.jwks)
  File "/Users/emma/.local/lib/python3.7/site-packages/mozilla_aws_cli/cache.py", line 103, in wrapper
    return func(*args, **kwargs)
  File "/Users/emma/.local/lib/python3.7/site-packages/mozilla_aws_cli/cache.py", line 114, in wrapper
    mode = os.stat(CACHE_DIR).st_mode
FileNotFoundError: [Errno 2] No such file or directory: '/Users/emma/.cache/maws'

Furthermore, I notice that I do not have a $HOME/.cache directory at all. However $HOME/.maws/cache exists and contains files such as id_<hex>, rolemap_<hex> and several stscreds_<hex> files.

What I expect (1/1):
The usual role select flow and automatic navigation to the AWS web console.

I suspect you may have mismatched versions. Would you try upgrading mozilla-aws-cli-mozilla with this command

pip install --user --upgrade mozilla-aws-cli-mozilla

After doing the above, I see:

Installing collected packages: mozilla-aws-cli-mozilla
  Attempting uninstall: mozilla-aws-cli-mozilla
    Found existing installation: mozilla-aws-cli-mozilla 1.2.0
    Uninstalling mozilla-aws-cli-mozilla-1.2.0:
      Successfully uninstalled mozilla-aws-cli-mozilla-1.2.0
Successfully installed mozilla-aws-cli-mozilla-1.3.0

However running $(maws -w) results in the same error about a cache directory.

Aha! Got it. Sorry about the redherring regarding version mismatch. I think what's going on is that there is a bug in maws that assumes that the .cache directory exists on all Mac's. I'll make a fix and if you're open to it I'll have you install the newer version and see if it fixes the bug for you.

Ok, give it a try with this :

pip uninstall mozilla-aws-cli
pip install --user git+git://github.com/mozilla-iam/mozilla-aws-cli.git#egg=mozilla-aws-cli

That will update your maws to the head of master.

Then test see if the problem is fixed (it should be).

I'll then cut a patch release and let you know at which point you can uninstall and just do a normal install

I can confirm that following the above steps resolved the issue for me.

As something of a minor aside, I found that zsh attempts to parse the git+git:// URL as a special string and produces an error saying that

zsh: no matches found: git+git://github.com/mozilla-iam/mozilla-aws-cli.git#egg=mozilla-aws-cli

This was simply resolved by enclosing the URL in quotation marks, producing

pip install --user "git+git://github.com/mozilla-iam/mozilla-aws-cli.git#egg=mozilla-aws-cli"

which works as expected. May be relevant to other zsh users who want to try this before a new release, but I suspect this won't be valuable except to record for posterity.

@emma ok v1.1.1 has been released go ahead and

pip install --user --upgrade mozilla-aws-cli