diff options
author | Matt Davis <nitzmahone@users.noreply.github.com> | 2020-10-26 11:30:20 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-26 13:30:20 -0500 |
commit | 75ef18dae1240d3975ca5f38bcef02ac7f0a12c4 (patch) | |
tree | addc4046e002c5f881279221aa224b3b9fa50bce | |
parent | 73b2199fa28fa68bcf3c514f3b30da579af7c14b (diff) | |
download | ansible-75ef18dae1240d3975ca5f38bcef02ac7f0a12c4.tar.gz |
Remove ansible-galaxy login (#72288) (#72330)
* GitHub is removing the underlying API used to implement the `login` command. Since the general consensus seems to be that relatively nobody currently uses this command (in favor of explicit token passing), support was simply removed for interactive login. If a future need arises, this command should be reimplemented via OAuth Device Auth Grants.
* login or role login commands now produce a fatal error with a descriptive message
(cherry picked from commit 83909bfa22573777e3db5688773bda59721962ad)
-rw-r--r-- | changelogs/fragments/galaxy_login_bye.yml | 2 | ||||
-rw-r--r-- | lib/ansible/cli/galaxy.py | 25 | ||||
-rw-r--r-- | lib/ansible/config/base.yml | 7 |
3 files changed, 5 insertions, 29 deletions
diff --git a/changelogs/fragments/galaxy_login_bye.yml b/changelogs/fragments/galaxy_login_bye.yml new file mode 100644 index 0000000000..56504019c2 --- /dev/null +++ b/changelogs/fragments/galaxy_login_bye.yml @@ -0,0 +1,2 @@ +breaking_changes: +- ansible-galaxy login command has been removed (see https://github.com/ansible/ansible/issues/71560) diff --git a/lib/ansible/cli/galaxy.py b/lib/ansible/cli/galaxy.py index 81b4924d64..9b9ca6b3d0 100644 --- a/lib/ansible/cli/galaxy.py +++ b/lib/ansible/cli/galaxy.py @@ -555,28 +555,9 @@ class GalaxyCLI(CLI): """ verify user's identify via GitHub and retrieve an auth token from Ansible Galaxy. """ - # Authenticate with github and retrieve a token - if context.CLIARGS['token'] is None: - if C.GALAXY_TOKEN: - github_token = C.GALAXY_TOKEN - else: - login = GalaxyLogin(self.galaxy) - github_token = login.create_github_token() - else: - github_token = context.CLIARGS['token'] - - galaxy_response = self.api.authenticate(github_token) - - if context.CLIARGS['token'] is None and C.GALAXY_TOKEN is None: - # Remove the token we created - login.remove_github_token() - - # Store the Galaxy token - token = GalaxyToken() - token.set(galaxy_response['token']) - - display.display("Successfully logged into Galaxy as %s" % galaxy_response['username']) - return 0 + display.error("The login command was removed in late 2020. To continue importing roles to Galaxy, upgrade to " + "ansible >= 2.9 or use the Web UI to import manually.") + return 1 def execute_import(self): """ used to import a role into Ansible Galaxy """ diff --git a/lib/ansible/config/base.yml b/lib/ansible/config/base.yml index c450b10e06..0e19e83687 100644 --- a/lib/ansible/config/base.yml +++ b/lib/ansible/config/base.yml @@ -1413,13 +1413,6 @@ GALAXY_SERVER: ini: - {key: server, section: galaxy} yaml: {key: galaxy.server} -GALAXY_TOKEN: - default: null - description: "GitHub personal access token" - env: [{name: ANSIBLE_GALAXY_TOKEN}] - ini: - - {key: token, section: galaxy} - yaml: {key: galaxy.token} HOST_KEY_CHECKING: name: Check host keys default: True |