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

Several mas commands depreciated #41

Closed
JBarrskog opened this issue Apr 26, 2022 · 3 comments
Closed

Several mas commands depreciated #41

JBarrskog opened this issue Apr 26, 2022 · 3 comments

Comments

@JBarrskog
Copy link

JBarrskog commented Apr 26, 2022

Copy from README.md of mas (https://github.com/mas-cli/mas#%EF%B8%8F-known-issues)

Over time, Apple has changed the APIs used by mas to manage App Store apps, limiting its capabilities. Please sign in or purchase apps using the App Store app instead. Subsequent redownloads can be performed with mas install.

⛔️ The signin command is not supported as of macOS 10.13 High Sierra. mas-cli/mas#164
⛔️ The purchase command is not supported as of macOS 10.15 Catalina. mas-cli/mas#289
⛔️ The account command is not supported as of macOS 12 Monterey. mas-cli/mas#417

The way I see it, the best way would be to either remove the first few checks, or simply set a requirement on OS-version. To remove them (or come up with a workaround) would be more stringent, as the behaviour would be constant for different OS-versions.

@JBarrskog
Copy link
Author

These are the lines that are depreciated in 12:

- name: Get MAS account status
command: mas account
register: mas_account_result
failed_when: mas_account_result.rc > 1
check_mode: false
changed_when: false
- name: Sign in to MAS when email and password are provided.
command: 'mas signin "{{ mas_email }}" "{{ mas_password }}"'
register: mas_signin_result
when:
- mas_account_result.rc == 1
- mas_email | bool
- mas_password | bool
- not mas_signin_dialog
- name: Sign in to MAS when email is provided, and complete password and 2FA using dialog.
command: 'mas signin "{{ mas_email }}" "{{ mas_password }}" --dialog'
register: mas_signin_result
when:
- mas_signin_dialog
- mas_account_result.rc == 1
- mas_email | bool

@JBarrskog
Copy link
Author

JBarrskog commented Apr 26, 2022

And this is the error I receive:

fatal: [10.42.0.202]: FAILED! => changed=false
cmd: mas account
failed_when_result: true
invocation:
module_args:
_raw_params: mas account
_uses_shell: false
argv: null
chdir: null
creates: null
executable: null
removes: null
stdin: null
stdin_add_newline: true
strip_empty_ends: true
warn: false
msg: '[Errno 2] No such file or directory: b''mas'''
rc: 2
stderr: ''
stderr_lines:
stdout: ''
stdout_lines:

@JBarrskog
Copy link
Author

JBarrskog commented May 3, 2022

I stumbled upon another problem. Upon solving that error, I realised that my problem here is due to mas not being on the$PATH. The path to mas is /opt/homebrew/bin on arm64. I solved this by adding the two lines regarding environment as below:

      name: ansible-collection-mac/roles/mas
      when: mas_installed_apps or mas_installed_app_ids
      tags: ['mas']
      environment:
        PATH: /opt/homebrew/bin:/usr/local/bin:{{ ansible_facts.env.PATH }}

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

1 participant