Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gyuricska Milán
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
9a9a9b06
authored
Oct 21, 2016
by
Sulyok Gábor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Controller and model fix
parent
252d3595
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
56 additions
and
11 deletions
+56
-11
circle/setty/controller.py
+9
-11
circle/setty/migrations/0025_AddDatabases.py
+47
-0
No files found.
circle/setty/controller.py
View file @
9a9a9b06
...
...
@@ -112,23 +112,21 @@ class SettyController:
else
:
raise
PermissionDenied
# TODO: something more meaningful
@staticmethod
def
getMachineAvailableList
(
serviceId
,
used_hostnames
,
current_user
):
all_minions
=
SettyController
.
salthelper
.
getAllMinionsUngrouped
()
usedMachines
=
Machine
.
objects
.
get
(
service
=
serviceId
)
user_instances
=
Instance
.
objects
.
get
(
owner
=
current_user
)
all_minions
=
[]
# SettyController.salthelper.getAllMinionsUngrouped()
usedMachines
=
Machine
.
objects
.
filter
(
service
=
serviceId
)
user_instances
=
Instance
.
objects
.
filter
(
owner
=
current_user
)
userMachines
=
[]
userMachines
=
[]
for
instance
in
user_instances
:
if
user_instances
.
vm_name
():
userMachines
.
append
(
user_instances
.
vm_name
())
result
=
[]
for
machine
in
usedMachines
:
if
machine
.
hostname
not
in
userMachines
:
result
.
append
(
machine
.
hostname
)
if
instance
.
vm_name
:
print
instance
.
vm_name
userMachines
.
append
(
instance
.
vm_name
)
return
{
'machinedata'
:
result
}
return
{
'machinedata'
:
userMachines
}
@staticmethod
def
addMachine
(
hostname
):
...
...
circle/setty/migrations/0025_AddDatabases.py
0 → 100644
View file @
9a9a9b06
# -*- coding: utf-8 -*-
from
__future__
import
unicode_literals
from
django.db
import
models
,
migrations
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'setty'
,
'0024_AddApacheAndWordpress'
),
]
operations
=
[
migrations
.
CreateModel
(
name
=
'DatabaseNode'
,
fields
=
[
(
'servicenode_ptr'
,
models
.
OneToOneField
(
parent_link
=
True
,
auto_created
=
True
,
primary_key
=
True
,
serialize
=
False
,
to
=
'setty.ServiceNode'
)),
(
'adminUserName'
,
models
.
CharField
(
max_length
=
50
)),
(
'adminPassword'
,
models
.
CharField
(
max_length
=
50
)),
(
'listeningPort'
,
models
.
PositiveIntegerField
()),
],
options
=
{
'abstract'
:
False
,
},
bases
=
(
'setty.servicenode'
,),
),
migrations
.
CreateModel
(
name
=
'MySQLNode'
,
fields
=
[
(
'databasenode_ptr'
,
models
.
OneToOneField
(
parent_link
=
True
,
auto_created
=
True
,
primary_key
=
True
,
serialize
=
False
,
to
=
'setty.DatabaseNode'
)),
],
options
=
{
'abstract'
:
False
,
},
bases
=
(
'setty.databasenode'
,),
),
migrations
.
CreateModel
(
name
=
'PostgreSQLNode'
,
fields
=
[
(
'databasenode_ptr'
,
models
.
OneToOneField
(
parent_link
=
True
,
auto_created
=
True
,
primary_key
=
True
,
serialize
=
False
,
to
=
'setty.DatabaseNode'
)),
],
options
=
{
'abstract'
:
False
,
},
bases
=
(
'setty.databasenode'
,),
),
]
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment