Revision 6afeb85d snf-cyclades-app/synnefo/logic/utils.py

b/snf-cyclades-app/synnefo/logic/utils.py
30 30
# Utility functions
31 31

  
32 32
from synnefo.db.models import VirtualMachine, Network
33

  
34 33
from django.conf import settings
34
from copy import copy
35 35

  
36 36
def id_from_instance_name(name):
37 37
    """Returns VirtualMachine's Django id, given a ganeti machine name.
......
105 105
        return "REBOOT"
106 106
    return r
107 107

  
108

  
108 109
def update_state(vm, new_operstate):
109 110
    """Wrapper around updates of the VirtualMachine.operstate field"""
110 111

  
111 112
    vm.operstate = new_operstate
113

  
114

  
115
def hide_pass(kw):
116
    if 'osparams' in kw and 'img_passwd' in kw['osparams']:
117
        kw1 = copy(kw)
118
        kw1['osparams']['img_passwd'] = 'x' * 8
119
        return kw1
120
    else:
121
        return kw

Also available in: Unified diff