PaloAltoNetworks / prismacloud-cli

The Prisma Cloud CLI is a command line interface for Prisma Cloud by Palo Alto Networks.
MIT License
37 stars 30 forks source link

New installation requires /Users/$USER/.prismacloud to exist #79

Closed dukekautington3rd closed 1 year ago

dukekautington3rd commented 1 year ago

Describe the bug

initial acceptance of support policy requires /Users/$USER/.prismacloud to pre-exist

Expected behavior

Expected that initial install will create /Users/$USER/.prismacloud

Current behavior

❯ pc version
# Community Supported
This template/solution is released under an as-is, best effort,
support policy. These scripts should be seen as community
supported and Palo Alto Networks will contribute our expertise as
and when possible. We do not provide technical support or help in
using or troubleshooting the components of the project through our
normal support options such as Palo Alto Networks support teams,
or ASC (Authorized Support Centers) partners and backline support
options. The underlying product used (Prisma Cloud) by the scripts
or templates are still supported, but the support is only for the
product functionality and not for help in deploying or using the
template or script itself.

Unless explicitly tagged, all projects or work posted in our
GitHub repository (at https://github.com/PaloAltoNetworks) or
sites other than our official Downloads page on
https://support.paloaltonetworks.com are provided under the best
effort policy.

Type yes to confirm you have read the message above: yes
Message accepted.
Traceback (most recent call last):
  File "/usr/local/bin/pc", line 8, in <module>
    sys.exit(cli())
  File "/Users/lkaut/Library/Python/3.10/lib/python/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/Users/lkaut/Library/Python/3.10/lib/python/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/Users/lkaut/Library/Python/3.10/lib/python/site-packages/click/core.py", line 1651, in invoke
    cmd_name, cmd, args = self.resolve_command(ctx, args)
  File "/usr/local/lib/python3.10/site-packages/click_help_colors/core.py", line 101, in resolve_command
    cmd_name, cmd, args[1:] = super(HelpColorsMultiCommand, self).resolve_command(ctx, args)
  File "/Users/lkaut/Library/Python/3.10/lib/python/site-packages/click/core.py", line 1698, in resolve_command
    cmd = self.get_command(ctx, cmd_name)
  File "/usr/local/lib/python3.10/site-packages/prismacloud/cli/__init__.py", line 135, in get_command
    mod = __import__(f"prismacloud.cli.{module_type}.cmd_{cmd_name}", None, None, ["cli"])
  File "/usr/local/lib/python3.10/site-packages/prismacloud/cli/cwpp/cmd_version.py", line 4, in <module>
    from prismacloud.cli.api import pc_api
  File "/usr/local/lib/python3.10/site-packages/prismacloud/cli/api.py", line 264, in <module>
    pc_api.configure(map_cli_config_to_api_config())
  File "/usr/local/lib/python3.10/site-packages/prismacloud/cli/api.py", line 33, in map_cli_config_to_api_config
    settings = get_cli_config()
  File "/usr/local/lib/python3.10/site-packages/prismacloud/cli/api.py", line 100, in get_cli_config
    community_supported()  # Check if support message has been shown and accepted
  File "/usr/local/lib/python3.10/site-packages/prismacloud/cli/api.py", line 78, in community_supported
    with open(community_support_accepted, "w") as _accepted:
FileNotFoundError: [Errno 2] No such file or directory: '/Users/lkaut/.prismacloud/.community_supported_accepted'

Possible solution

programmatically create ~/.prismacloud/ directory workaround --> `mkdir /Users/$USER/.prismacloud

Steps to reproduce

New install per user

Screenshots

image image

Context

Your Environment

Using MacOS Python3.10

welcome-to-palo-alto-networks[bot] commented 1 year ago

:tada: Thanks for opening your first issue here! Welcome to the community!

dukekautington3rd commented 1 year ago

I will try to contribute this fix myself.

dukekautington3rd commented 1 year ago

Submitted PR https://github.com/PaloAltoNetworks/prismacloud-cli/pull/80