cc1  v2.1
CC1 source code docs
 All Classes Namespaces Files Functions Variables Pages
src.cm.views.user.ctx Namespace Reference

Functions

def add_ssh_key
 Injects given SSH public key to authorized keys on specified VMs.
def reboot
 Executes reboot on given VM at given timeout (now by default).
def reset_password
 Resets password of the existing OS user user_name on given VM.
def shutdown
 Executes shutdown on virtual machines listed in vm_list at a given timeout (now by default) provided they belong to caller.

Detailed Description

Note
All functions here are decorated by src.cm.utils.decorators.user_log. It's recommended to read src.cm.utils.decorators.user_log docs before using functions below.

Function Documentation

def src.cm.views.user.ctx.add_ssh_key (   caller_id,
  vm_ids,
  vm_username,
  vm_key 
)

Injects given SSH public key to authorized keys on specified VMs.

Note
The cm.utils.decorators.user_log decorator performs User authentication. It also provides handling/logging mechanism for each Exception raised in view. see also: cm.utils.decorators.user_log
Parameters
http_request(HttpRequest)
caller_id(POST int)
vm_ids(POST list(int)) id's of the VMs where SSH public key should be injected
vm_username(POST string)
vm_key(POST string)

Definition at line 85 of file ctx.py.

def src.cm.views.user.ctx.reboot (   caller_id,
  vm_id,
  timeout = 'now' 
)

Executes reboot on given VM at given timeout (now by default).

 @warning Deprecated since execution's success/failure depends on inner
 VM's state.
Note
The cm.utils.decorators.user_log decorator performs User authentication. It also provides handling/logging mechanism for each Exception raised in view. see also: cm.utils.decorators.user_log
Parameters
http_request(HttpRequest)
caller_id(POST int)
vm_id(POST int) id of the VM to reboot
timeout(POST string) (optional, "now" by default)

Definition at line 55 of file ctx.py.

def src.cm.views.user.ctx.reset_password (   caller_id,
  vm_id,
  vm_username 
)

Resets password of the existing OS user user_name on given VM.

User obtains new randomly created password. Such a password is sent in CM response. It is recommended to change password manually afterwards.

Note
The cm.utils.decorators.user_log decorator performs User authentication. It also provides handling/logging mechanism for each Exception raised in view. see also: cm.utils.decorators.user_log
Parameters
http_request(HttpRequest)
caller_id(POST int)
vm_id(POST int)
vm_username(POST string) username of the user whose password should be reseted

Definition at line 71 of file ctx.py.

def src.cm.views.user.ctx.shutdown (   caller_id,
  vm_id,
  timeout = 'now' 
)

Executes shutdown on virtual machines listed in vm_list at a given timeout (now by default) provided they belong to caller.

Note
The cm.utils.decorators.user_log decorator performs User authentication. It also provides handling/logging mechanism for each Exception raised in view. see also: cm.utils.decorators.user_log
Parameters
http_request(HttpRequest)
caller_id(POST int)
vm_id(POST int)
timeout(POST string) optional, "now" by default

Definition at line 39 of file ctx.py.