Replace other occurrences of strip('public-') with
lstrip('public-')
This commit is contained in:
parent
c0c79ebf2b
commit
f866368e85
2 changed files with 4 additions and 4 deletions
|
@ -36,7 +36,7 @@ class VirtualMachineTemplateSerializer(serializers.Serializer):
|
||||||
return int(obj.template.memory) / 1024
|
return int(obj.template.memory) / 1024
|
||||||
|
|
||||||
def get_name(self, obj):
|
def get_name(self, obj):
|
||||||
return obj.name.strip('public-')
|
return obj.name.lstrip('public-')
|
||||||
|
|
||||||
|
|
||||||
class VirtualMachineSerializer(serializers.Serializer):
|
class VirtualMachineSerializer(serializers.Serializer):
|
||||||
|
@ -133,7 +133,7 @@ class VirtualMachineSerializer(serializers.Serializer):
|
||||||
def get_configuration(self, obj):
|
def get_configuration(self, obj):
|
||||||
template_id = obj.template.template_id
|
template_id = obj.template.template_id
|
||||||
template = OpenNebulaManager().get_template(template_id)
|
template = OpenNebulaManager().get_template(template_id)
|
||||||
return template.name.strip('public-')
|
return template.name.lstrip('public-')
|
||||||
|
|
||||||
def get_ipv4(self, obj):
|
def get_ipv4(self, obj):
|
||||||
"""
|
"""
|
||||||
|
@ -162,7 +162,7 @@ class VirtualMachineSerializer(serializers.Serializer):
|
||||||
return '-'
|
return '-'
|
||||||
|
|
||||||
def get_name(self, obj):
|
def get_name(self, obj):
|
||||||
return obj.name.strip('public-')
|
return obj.name.lstrip('public-')
|
||||||
|
|
||||||
|
|
||||||
class VMTemplateSerializer(serializers.Serializer):
|
class VMTemplateSerializer(serializers.Serializer):
|
||||||
|
|
|
@ -145,5 +145,5 @@ class VirtualMachineSerializerTestCase(TestCase):
|
||||||
|
|
||||||
for vm in self.manager.get_vms():
|
for vm in self.manager.get_vms():
|
||||||
serialized = VirtualMachineSerializer(vm)
|
serialized = VirtualMachineSerializer(vm)
|
||||||
self.assertEqual(serialized.data.get('name'), vm.name.strip('public-'))
|
self.assertEqual(serialized.data.get('name'), vm.name.lstrip('public-'))
|
||||||
break
|
break
|
||||||
|
|
Loading…
Reference in a new issue