Skip to content

Commit

Permalink
Bug Fixes around three state flags (#624)
Browse files Browse the repository at this point in the history
  • Loading branch information
gauravsaralMs authored May 24, 2019
1 parent 23b0fd4 commit 55cbd3c
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 10 deletions.
9 changes: 6 additions & 3 deletions azure-devops/azext_devops/dev/team/arguments.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@ def load_team_arguments(self, _):
with self.argument_context('devops user') as context:
context.argument('license_type', arg_type=get_enum_type(_LICENSE_TYPES))
with self.argument_context('devops user add') as context:
context.argument('send_email_invite', help='Whether to send email invite for new user or not.')
context.argument('send_email_invite', arg_type=get_three_state_flag(),
help='Whether to send email invite for new user or not.')

with self.argument_context('devops security group create') as context:
context.argument('project',
Expand Down Expand Up @@ -126,8 +127,10 @@ def load_team_arguments(self, _):
for given user/group and token.')

with self.argument_context('devops extension') as context:
context.argument('include_built_in', help='Include built in extensions.')
context.argument('include_disabled', help='Include disabled extensions.')
context.argument('include_built_in', arg_type=get_three_state_flag(),
help='Include built in extensions.')
context.argument('include_disabled', arg_type=get_three_state_flag(),
help='Include disabled extensions.')
context.argument('publisher_name', help='Publisher Name')
context.argument('extension_name', help='Extension Name')
context.argument('search_query', options_list=('--search-query', '-q'), help='Search term')
Expand Down
4 changes: 2 additions & 2 deletions azure-devops/azext_devops/dev/team/configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ def configure(defaults=None, use_git_aliases=None, list_config=False):
e.g. '--defaults project=my-project-name organization=https://dev.azure.com/organizationName
arg=value' Use '' to clear the defaults, e.g. --defaults project=''.
:type defaults: str
:param use_git_aliases: Set to 'yes' to configure Git aliases global git config file
:param use_git_aliases: Set to 'true' to configure Git aliases global git config file
(to enable commands like "git pr list").
Set to 'no' to remove any aliases set by the tool.
Set to 'false' to remove any aliases set by the tool.
:type use_git_aliases: str
:param list_config: Lists the contents of the config file.
:type list_config: bool
Expand Down
6 changes: 5 additions & 1 deletion azure-devops/azext_devops/dev/team/extension.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,13 @@ def search_extensions(search_query):
return response_json['results'][0]['extensions']


def list_extensions(include_built_in=True, include_disabled=True, organization=None, detect=None):
def list_extensions(include_built_in=None, include_disabled=None, organization=None, detect=None):
""" List extensions installed in an organization
"""
if include_built_in is None:
include_built_in = True
if include_disabled is None:
include_disabled = True
organization = resolve_instance(detect=detect, organization=organization)
extension_client = get_extension_client(organization)
extensions = extension_client.get_installed_extensions(include_disabled_extensions=include_disabled)
Expand Down
5 changes: 2 additions & 3 deletions azure-devops/azext_devops/dev/team/service_endpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,12 @@ def show_service_endpoint(id, organization=None, project=None, detect=None): #
return client.get_service_endpoint_details(project, id)


def delete_service_endpoint(id, deep=True, organization=None, project=None, detect=None): # pylint: disable=redefined-builtin
def delete_service_endpoint(id, deep=False, organization=None, project=None, detect=None): # pylint: disable=redefined-builtin
"""Deletes service endpoint
:param id: Id of the service endpoint to delete.
:type id: str
:pram deep: Specific to AzureRM endpoint created in Automatic flow. When set to true,
:param deep: Specific to AzureRM endpoint created in Automatic flow. When it is specified,
this will also delete corresponding AAD application in Azure.
Default value is true.
:type deep: bool
"""
organization, project = resolve_instance_and_project(detect=detect,
Expand Down
4 changes: 3 additions & 1 deletion azure-devops/azext_devops/dev/team/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,16 @@ def update_user_entitlement(user, license_type, organization=None, detect=None):
return user_entitlement_update.user_entitlement


def add_user_entitlement(email_id, license_type, send_email_invite=True, organization=None, detect=None):
def add_user_entitlement(email_id, license_type, send_email_invite=None, organization=None, detect=None):
"""Add user.
:param email_id: Email ID of the user.
:type email_id: str
:param license_type: License type for the user.
:type license_type: str
:rtype: UserEntitlementsPatchResponse
"""
if send_email_invite is None:
send_email_invite = True
do_not_send_invite = not send_email_invite
organization = resolve_instance(detect=detect, organization=organization)
client = get_member_entitlement_management_client(organization)
Expand Down

0 comments on commit 55cbd3c

Please sign in to comment.