Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,7 @@ def cf_hdinsight_extensions(cli_ctx, *_, **__):

def cf_hdinsight_locations(cli_ctx, *_, **__):
return cf_hdinsight(cli_ctx).locations


def cf_hdinsight_virtual_machines(cli_ctx, *_, **__):
return cf_hdinsight(cli_ctx).virtual_machines
24 changes: 24 additions & 0 deletions src/azure-cli/azure/cli/command_modules/hdinsight/_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
# --------------------------------------------------------------------------------------------

from knack.help_files import helps # pylint: disable=unused-import

# pylint: disable=line-too-long, too-many-lines

helps['hdinsight'] = """
Expand Down Expand Up @@ -162,6 +163,29 @@
--persist-on-success
"""

helps['hdinsight host'] = """
type: group
short-summary: Manage HDInsight cluster's virtual hosts.
"""

helps['hdinsight host list'] = """
type: command
short-summary: List the hosts of the specified HDInsight cluster.
examples:
- name: List the hosts of the specified HDInsight cluster.
text: |-
az hdinsight host list --resource-group MyResourceGroup --cluster-name MyCluster
"""

helps['hdinsight host restart'] = """
type: command
short-summary: Restart the specific hosts of the specified HDInsight cluster.
examples:
- name: Restart the specific hosts of the specified HDInsight cluster.
text: |-
az hdinsight host restart --resource-group MyResourceGroup --cluster-name MyCluster --host-names hostname1 hostname2
"""

helps['hdinsight wait'] = """
type: command
short-summary: Place the CLI in a waiting state until an operation is complete.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ def load_arguments(self, _):

# cluster
with self.argument_context('hdinsight') as c:

# Cluster
c.argument('cluster_name', arg_type=name_type,
completer=get_resource_name_completion_list('Microsoft.HDInsight/clusters'),
Expand Down Expand Up @@ -237,3 +236,10 @@ def load_arguments(self, _):
c.argument('primary_key', help='The certificate for the Log Analytics workspace. '
'Required when workspace ID is provided.')
c.ignore('workspace_type')

with self.argument_context('hdinsight host') as c:
c.argument('cluster_name', options_list=['--cluster-name'],
completer=get_resource_name_completion_list('Microsoft.HDInsight/clusters'),
help='The name of the cluster.')
c.argument('hosts', options_list=['--host-names'], nargs='+',
help='A space-delimited list of host names that need to be restarted.')
12 changes: 12 additions & 0 deletions src/azure-cli/azure/cli/command_modules/hdinsight/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ def load_command_table(self, _):
from ._client_factory import cf_hdinsight_locations
from ._client_factory import cf_hdinsight_script_execution_history
from ._client_factory import cf_hdinsight_script_actions
from ._client_factory import cf_hdinsight_virtual_machines

hdinsight_clusters_sdk = CliCommandType(
operations_tmpl='azure.mgmt.hdinsight.operations#ClustersOperations.{}',
Expand Down Expand Up @@ -43,6 +44,11 @@ def load_command_table(self, _):
client_factory=cf_hdinsight_script_execution_history
)

hdinsight_virtual_machines_sdk = CliCommandType(
operations_tmpl='azure.mgmt.hdinsight.operations#VirtualMachinesOperations.{}',
client_factory=cf_hdinsight_virtual_machines
)

# cluster operations
with self.command_group('hdinsight', hdinsight_clusters_sdk, client_factory=cf_hdinsight_clusters) as g:
g.custom_command('create', 'create_cluster', supports_no_wait=True)
Expand Down Expand Up @@ -92,3 +98,9 @@ def load_command_table(self, _):
g.show_command('show', 'get_monitoring_status')
g.custom_command('enable', 'enable_hdi_monitoring')
g.command('disable', 'disable_monitoring')

# VirtualMachine operations
with self.command_group('hdinsight host', hdinsight_virtual_machines_sdk,
client_factory=cf_hdinsight_virtual_machines) as g:
g.command('list', 'list_hosts')
g.command('restart', 'restart_hosts', confirmation=True)
Loading