fix some weird little bugs

master
lza_menace 3 years ago
parent e0b2b0095c
commit 906a9fb906

@ -41,7 +41,7 @@ class Cache(object):
data = '' data = ''
return data return data
except: except:
return {'error': 'true'} return ''
def get_info(self, codename): def get_info(self, codename):
key_name = f'node_{codename}_info' key_name = f'node_{codename}_info'

@ -89,6 +89,10 @@ class DigitalOcean(object):
# Droplets # Droplets
def create_droplet(self, name, region, extra_vols=[]): def create_droplet(self, name, region, extra_vols=[]):
# First check that droplet name does not exist
de = self.check_droplet_exists(name)
if de[0]:
return self.show_droplet(de[1])
data = { data = {
'name': name, 'name': name,
'region': region, 'region': region,

@ -31,7 +31,7 @@ class Operation(db.Model):
def get_node_tor_url(self): def get_node_tor_url(self):
u = cache.get_tor_url(self.codename) u = cache.get_tor_url(self.codename)
return u.decode() return u
def get_node_url(self): def get_node_url(self):
return f'{self.codename}.node.{config.DO_DOMAIN}' return f'{self.codename}.node.{config.DO_DOMAIN}'
@ -94,4 +94,4 @@ class Payout(db.Model):
hours_since_last = db.Column(db.Integer) hours_since_last = db.Column(db.Integer)
def __repr__(self): def __repr__(self):
return self.id return f'payout-{self.id}'

@ -34,7 +34,11 @@
<td>{{ op.account_idx }}</td> <td>{{ op.account_idx }}</td>
<td>{{ op.droplet_id }}</td> <td>{{ op.droplet_id }}</td>
<td>{{ op.volume_id }}</td> <td>{{ op.volume_id }}</td>
{% if op.get_last_payout() %}
<td>{{ op.get_last_payout().create_date | humanize }}</td> <td>{{ op.get_last_payout().create_date | humanize }}</td>
{% else %}
<td>None</td>
{% endif %}
<td>{{ unlocked }} XMR ({{ locked }} locked)</td> <td>{{ unlocked }} XMR ({{ locked }} locked)</td>
</tr> </tr>
{% endfor %} {% endfor %}

Loading…
Cancel
Save