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

Fix typo. Change credentialss to credentials #1423

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion plugins/module_utils/azure_rm_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -1522,7 +1522,7 @@ def __init__(self, auth_source=None, profile=None, subscription_id=None, client_
authority=self._adfs_authority_url)

elif self.credentials.get('ad_user') is not None and self.credentials.get('password') is not None:
client_id = self.credentialss.get('client_id')
client_id = self.credentials.get('client_id')
if client_id is None:
client_id = '04b07795-8ddb-461a-bbee-02f9e1bf7b46'
self.azure_credential_track2 = user_password.UsernamePasswordCredential(username=self.credentials['ad_user'],
Expand Down
41 changes: 34 additions & 7 deletions plugins/modules/azure_rm_adapplication_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,15 @@
type: str
object_id:
description:
- It's application's object ID.
- The application's object ID.
type: str
identifier_uri:
description:
- It's identifier_uri's object ID.
- The identifier_uri's object ID.
type: str
app_display_name:
description:
- The applications' Name.
type: str

extends_documentation_fragment:
Expand All @@ -55,6 +59,10 @@
- name: get ad app info ---- by identifier uri
azure_rm_adapplication_info:
identifier_uri: "{{ identifier_uri }}"

- name: get ad app info ---- by display name
azure_rm_adapplication_info:
app_display_name: "{{ display_name }}"
'''

RETURN = '''
Expand Down Expand Up @@ -119,9 +127,11 @@ def __init__(self):
self.module_arg_spec = dict(
app_id=dict(type='str'),
object_id=dict(type='str'),
identifier_uri=dict(type='str')
identifier_uri=dict(type='str'),
app_display_name=dict(type='str')
)
self.app_id = None
self.app_display_name = None
self.object_id = None
self.identifier_uri = None
self.results = dict(changed=False)
Expand All @@ -147,9 +157,10 @@ def exec_module(self, **kwargs):
sub_filters.append("identifierUris/any(s:s eq '{0}')".format(self.identifier_uri))
if self.app_id:
sub_filters.append("appId eq '{0}'".format(self.app_id))

if self.app_display_name:
sub_filters.append("displayName eq '{0}'".format(self.app_display_name))
apps = asyncio.get_event_loop().run_until_complete(self.get_applications(sub_filters))
applications = list(apps.value)
applications = list(apps)
self.results['applications'] = [self.to_dict(app) for app in applications]
except APIError as e:
if e.response_status_code != 404:
Expand Down Expand Up @@ -179,9 +190,25 @@ async def get_applications(self, sub_filters):
filter=(' and '.join(sub_filters)),
),
)
return await self._client.applications.get(request_configuration=request_configuration)
applications = await self._client.applications.get(request_configuration=request_configuration)
return applications.value
else:
return await self._client.applications.get()
applications_list = []
applications = await self._client.applications.get()
for app in applications.value:
applications_list.append(app)

if applications.odata_next_link:
next_link = applications.odata_next_link
else:
next_link = None

while next_link:
applications = await self._client.applications.with_url(next_link).get()
next_link = applications.odata_next_link
for app in applications.value:
applications_list.append(app)
return applications_list


def main():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@
app_id: "{{ create_output.app_id }}"
register: output

- name: Get ad app info by display name
azure_rm_adapplication_info:
object_id: "{{ create_output.app_display_name }}"
register: output

- name: Assert the application facts
ansible.builtin.assert:
that:
Expand Down