Skip to content
This repository has been archived by the owner on Mar 20, 2023. It is now read-only.

Commit

Permalink
Fix various issues
Browse files Browse the repository at this point in the history
- Monitoring SSH login
- Grafana update regression with Batch Shipyard Dashboard
- Federation job submission
  • Loading branch information
alfpark committed Nov 6, 2018
1 parent 95dec30 commit 342b7fc
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 14 deletions.
9 changes: 6 additions & 3 deletions convoy/fleet.py
Original file line number Diff line number Diff line change
Expand Up @@ -4429,7 +4429,8 @@ def action_monitor_ssh(
_check_network_client(network_client)
vm_res = settings.monitoring_settings(config)
resource.ssh_to_virtual_machine_resource(
compute_client, network_client, vm_res, tty, command)
compute_client, network_client, vm_res,
crypto.get_monitoring_ssh_key_prefix(), tty, command)


def action_monitor_suspend(compute_client, config, wait):
Expand Down Expand Up @@ -4571,7 +4572,8 @@ def action_fed_proxy_ssh(
_check_network_client(network_client)
vm_res = settings.federation_settings(config)
resource.ssh_to_virtual_machine_resource(
compute_client, network_client, vm_res, tty, command)
compute_client, network_client, vm_res,
crypto.get_federation_ssh_key_prefix(), tty, command)


def action_fed_proxy_suspend(compute_client, config, wait):
Expand Down Expand Up @@ -4822,7 +4824,8 @@ def action_fed_jobs_add(
batch_client, blob_client, table_client, queue_client, keyvault_client,
config, None, _IMAGE_BLOCK_FILE,
_BLOBXFER_WINDOWS_FILE if is_windows else _BLOBXFER_FILE,
recreate=False, tail=None, federation_id=federation_id)
_AUTOSCRATCH_FILE, recreate=False, tail=None,
federation_id=federation_id)


def action_fed_jobs_list(
Expand Down
21 changes: 12 additions & 9 deletions convoy/resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -728,7 +728,7 @@ def create_virtual_machine(
# create vm
logger.debug(
'creating virtual machine: {} availset={} zone={}'.format(
vm_name, availset.id, zone))
vm_name, availset.id if availset is not None else None, zone))
return compute_client.virtual_machines.create_or_update(
resource_group_name=vm_resource.resource_group,
vm_name=vm_name,
Expand Down Expand Up @@ -953,10 +953,12 @@ def deallocate_virtual_machine(compute_client, rg_name, vm_name):
)


def get_ssh_info(compute_client, network_client, vm_res, nic=None, pip=None):
def get_ssh_info(
compute_client, network_client, vm_res, ssh_key_prefix=None, nic=None,
pip=None):
# type: (azure.mgmt.compute.ComputeManagementClient,
# azure.mgmt.network.NetworkManagementClient,
# settings.VmResource, networkmodes.NetworkInterface,
# settings.VmResource, str, networkmodes.NetworkInterface,
# networkmodels.PublicIPAddress) ->
# Tuple[pathlib.Path, int, str, str]
"""Get SSH info to a federation proxy
Expand All @@ -965,6 +967,7 @@ def get_ssh_info(compute_client, network_client, vm_res, nic=None, pip=None):
:param azure.mgmt.network.NetworkManagementClient network_client:
network client
:param settings.VmResource vm_res: resource
:param str ssh_key_prefix: ssh key prefix
:param networkmodels.NetworkInterface nic: network interface
:param networkmodels.PublicIPAddress pip: public ip
:rtype: tuple
Expand Down Expand Up @@ -998,30 +1001,30 @@ def get_ssh_info(compute_client, network_client, vm_res, nic=None, pip=None):
ssh_priv_key = vm_res.ssh.ssh_private_key
else:
ssh_priv_key = pathlib.Path(
vm_res.ssh.generated_file_export_path,
crypto.get_federation_ssh_key_prefix())
vm_res.ssh.generated_file_export_path, ssh_key_prefix)
if not ssh_priv_key.exists():
raise RuntimeError('SSH private key file not found at: {}'.format(
ssh_priv_key))
return ssh_priv_key, 22, vm.os_profile.admin_username, ip_address


def ssh_to_virtual_machine_resource(
compute_client, network_client, vm_res, tty, command):
compute_client, network_client, vm_res, ssh_key_prefix, tty, command):
# type: (azure.mgmt.compute.ComputeManagementClient,
# azure.mgmt.network.NetworkManagementClient,
# settings.VmResource, bool, tuple) -> None
"""SSH to a node in federation proxy
# settings.VmResource, str, bool, tuple) -> None
"""SSH to a node
:param azure.mgmt.compute.ComputeManagementClient compute_client:
compute client
:param azure.mgmt.network.NetworkManagementClient network_client:
network client
:param settings.VmResource vm_res: resource
:param str ssh_key_prefix: ssh key prefix
:param bool tty: allocate pseudo-tty
:param tuple command: command to execute
"""
ssh_priv_key, port, username, ip = get_ssh_info(
compute_client, network_client, vm_res)
compute_client, network_client, vm_res, ssh_key_prefix=ssh_key_prefix)
crypto.connect_or_exec_ssh_command(
ip, port, ssh_priv_key, username, tty=tty, command=command)

Expand Down
2 changes: 1 addition & 1 deletion heimdall/docker-compose-nonginx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ services:
- "--web.enable-lifecycle"

grafana:
image: grafana/grafana:5.3.2
image: grafana/grafana:5.2.3
container_name: grafana
restart: unless-stopped
ports:
Expand Down
2 changes: 1 addition & 1 deletion heimdall/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ services:
- "--web.enable-lifecycle"

grafana:
image: grafana/grafana:5.3.2
image: grafana/grafana:5.2.3
container_name: grafana
restart: unless-stopped
ports:
Expand Down

0 comments on commit 342b7fc

Please sign in to comment.