Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when attempting ./deploy-azure - No such file or directory: '/root/.azure/azureProfile.json' #8

Closed
mattmazzola opened this issue Jun 11, 2024 · 3 comments
Assignees

Comments

@mattmazzola
Copy link

I was attempting to follow directions for Deploying to Azure; however, there seems to be missing prerequisite steps.

Since I have multiple subscription, I first need to login. However, it seems the file az cli version used is expecting a different file structure than what exists and fails.

Reproduce Error

IsaacAutomator git:(main) ./build
IsaacAutomator git:(main) ./run
[Isaac Automator v3.0.0]:/app$ az login

Error

Traceback (most recent call last):
  File "/opt/az/lib/python3.11/site-packages/azure/cli/core/_session.py", line 37, in load
    with open(self.filename, 'r', encoding=self._encoding) as f:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: '/root/.azure/azureProfile.json'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/opt/az/lib/python3.11/site-packages/azure/cli/__main__.py", line 39, in <module>
    az_cli = get_default_cli()
             ^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.11/site-packages/azure/cli/core/__init__.py", line 924, in get_default_cli
    return AzCli(cli_name='az',
           ^^^^^^^^^^^^^^^^^^^^
  File "/opt/az/lib/python3.11/site-packages/azure/cli/core/__init__.py", line 79, in __init__
    ACCOUNT.load(os.path.join(azure_folder, 'azureProfile.json'))
  File "/opt/az/lib/python3.11/site-packages/azure/cli/core/_session.py", line 50, in load
    self.save()
  File "/opt/az/lib/python3.11/site-packages/azure/cli/core/_session.py", line 54, in save
    with open(self.filename, 'w', encoding=self._encoding) as f:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: '/root/.azure/azureProfile.json'

Investigation of /root/.azure directory

/root/.azure looks like a symbol link back to the app directory inside the container /app/state/.azure

[Isaac Automator v3.0.0]:~$ ls -la
total 44
drwx------ 1 root root 4096 Jun 11 15:59 .
drwxr-xr-x 1 root root 4096 Jun 11 16:00 ..
drwxr-xr-x 2 root root 4096 Jun 11 15:59 .aliyun
drwxr-xr-x 5 root root 4096 Jun 11 15:58 .ansible
lrwxrwxrwx 1 root root   17 Jun 11 15:57 .azure -> /app/state/.azure
-rw-r--r-- 1 root root 3249 Jun 11 15:59 .bashrc
drwxr-xr-x 1 root root 4096 Jun 11 15:57 .cache
drwxr-xr-x 1 root root 4096 Jun 11 15:59 .config
-rw-r--r-- 1 root root  161 Dec  5  2019 .profile
-rw-r--r-- 1 root root  181 Jun 10 22:51 .wget-hsts

I tried to manually create /app/state/.azure/azureProfile.json; however, az login still fails.

Version info

[Isaac Automator v3.0.0]:/app$ az --version
azure-cli                         2.61.0

core                              2.61.0
telemetry                          1.1.0

Dependencies:
msal                              1.28.0
azure-mgmt-resource               23.1.1

Python location '/opt/az/bin/python3'
Extensions directory '/root/.azure/cliextensions'

Python (Linux) 3.11.8 (main, May 16 2024, 03:47:41) [GCC 9.4.0]
@mattmazzola
Copy link
Author

Hmm, I'm not sure what was wrong the first time I tried but I was able to get past the error by starting over and manually creating only the .azure directory in /app/state, but not creating the .json file

[Isaac Automator v3.0.0]:/app$ cd state
[Isaac Automator v3.0.0]:/app/state$ mkdir .azure
[Isaac Automator v3.0.0]:/app/state/.azure$ cd /app
[Isaac Automator v3.0.0]:/app$ az login

Then login works! 🥳

@mattmazzola
Copy link
Author

I see there is some link creation here in the Docker file which is likely related to this.

# store azure credentials in a persistent location
RUN ln -s /app/state/.azure /root/.azure

@myurasov-nv myurasov-nv self-assigned this Jun 11, 2024
@myurasov-nv
Copy link
Collaborator

@mattmazzola Thanks for reporting! I have fixed that in v3.1.0: https://github.com/isaac-sim/IsaacAutomator/releases/tag/v3.1.0. Please re-build Automator container to get the fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants