isaac-sim / IsaacAutomator

Isaac Sim/Lab in AWS, Azure, Google Cloud, Alibaba Cloud
Apache License 2.0
74 stars 8 forks source link

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

Closed mattmazzola closed 5 months ago

mattmazzola commented 5 months ago

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 commented 5 months ago

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 commented 5 months ago

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

https://github.com/isaac-sim/IsaacAutomator/blob/b830676bb31e058a06971477e852e1e2ce8bb5b5/Dockerfile#L50-L51

myurasov-nv commented 5 months ago

@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.