Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
jijisa
/
porch
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
e3f189c2
authored
Jun 20, 2017
by
Heechul Kim
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Add server-side supported os
parent
89c8c1bb
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
101 additions
and
29 deletions
porch/api/machine/bizlogic.py
porch/api/machine/endpoints/route.py
porch/config.py.dev
quasar/src/components/log/List.vue
quasar/src/components/machine/Create.vue
quasar/src/components/machine/List.vue
quasar/src/components/os/List.vue
quasar/src/components/play/List.vue
porch/api/machine/bizlogic.py
View file @
e3f189c2
...
...
@@ -39,6 +39,7 @@ from porch.config import PORCH_USER
from
porch.config
import
IPMITOOL
,
IPMIPOWER
,
IPMICONSOLE
,
IPMIUSER
,
IPMIPASS
from
porch.config
import
OS_LOG
from
porch.config
import
FAI_MONITOR
from
porch.config
import
SUPPORTED_OS
from
porch.utils
import
cmd
...
...
@@ -432,7 +433,7 @@ def install_machine(data):
# power on the physical machines if any.
if
len
(
l_ipmi
):
for
ipmi_ip
in
l_ipmi
:
s_cmd
=
"{} -I lanplus -H {} -U {} -f {} chassis power
cycle
"
\
s_cmd
=
"{} -I lanplus -H {} -U {} -f {} chassis power
reset
"
\
.
format
(
IPMITOOL
,
ipmi_ip
,
IPMIUSER
,
s_tmp
)
(
b_ret
,
l_out
)
=
cmd
(
s_cmd
)
...
...
@@ -593,3 +594,11 @@ def poweroff_machine(name):
log
.
warn
(
e
)
return
(
b_ret
,
s_msg
)
def
supported_os_machine
():
"""Returns supported OS."""
l_supported_os
=
list
()
l_supported_os
=
SUPPORTED_OS
return
l_supported_os
porch/api/machine/endpoints/route.py
View file @
e3f189c2
...
...
@@ -29,6 +29,7 @@ from porch.api.machine.bizlogic import close_console_machine
from
porch.api.machine.bizlogic
import
dpt_machine
from
porch.api.machine.bizlogic
import
poweron_machine
from
porch.api.machine.bizlogic
import
poweroff_machine
from
porch.api.machine.bizlogic
import
supported_os_machine
log
=
logging
.
getLogger
(
'porch'
)
...
...
@@ -236,3 +237,15 @@ class MachinePowerOff(Resource):
return
d_msg
,
i_ret_code
@ns.route
(
'/supported_os'
)
class
MachineSupportedOS
(
Resource
):
@ns.response
(
200
,
'Machine successfully powered off.'
)
@jwt_required
def
get
(
self
):
"""Get supported OS.
"""
l_supported_os
=
list
()
l_supported_os
=
supported_os_machine
()
return
l_supported_os
porch/config.py.dev
View file @
e3f189c2
...
...
@@ -34,6 +34,8 @@ MY_IP = '121.254.203.198'
PROXY_URL = '192.168.24.50'
PROXY_PORT = 3128
# Supported OS List
SUPPORTED_OS = ['JESSIE', 'CENTOS7', 'CENTOS6', 'UXENOS']
#
## Do not edit below!!!
...
...
@@ -80,3 +82,4 @@ FILE_LOG = APP_ROOT + '/log/file'
# ansible
ANSIBLE_PLAYBOOK = '/usr/local/bin/ansible-playbook'
quasar/src/components/log/List.vue
View file @
e3f189c2
...
...
@@ -272,9 +272,6 @@ export default {
rowsPerPage
:
10
,
options
:
[
5
,
10
,
15
,
30
,
50
,
100
]
},
sort
(
a
,
b
)
{
return
(
a
-
b
)
},
messages
:
{
noData
:
'
<
i
>
warning
<
/i> 데이터가 없습니다.'
,
noDataAfterFiltering
:
'
<
i
>
warning
<
/i> 검색 결과가 없습니다.
'
...
...
@@ -289,9 +286,6 @@ export default {
rowsPerPage
:
10
,
options
:
[
5
,
10
,
15
,
30
,
50
,
100
]
},
sort
(
a
,
b
)
{
return
(
a
-
b
)
},
messages
:
{
noData
:
'
<
i
>
warning
<
/i> 데이터가 없습니다.'
,
noDataAfterFiltering
:
'
<
i
>
warning
<
/i> 검색 결과가 없습니다.
'
...
...
@@ -306,9 +300,6 @@ export default {
rowsPerPage
:
10
,
options
:
[
5
,
10
,
15
,
30
,
50
,
100
]
},
sort
(
a
,
b
)
{
return
(
a
-
b
)
},
messages
:
{
noData
:
'
<
i
>
warning
<
/i> 데이터가 없습니다.'
,
noDataAfterFiltering
:
'
<
i
>
warning
<
/i> 검색 결과가 없습니다.
'
...
...
@@ -319,7 +310,7 @@ export default {
label
:
'배포일'
,
field
:
'logname'
,
filter
:
true
,
sort
:
true
,
sort
:
'date'
,
width
:
'100px'
},
{
...
...
@@ -341,7 +332,7 @@ export default {
label
:
'배포일'
,
field
:
'logname'
,
filter
:
true
,
sort
:
true
,
sort
:
'date'
,
width
:
'100px'
},
{
...
...
@@ -369,7 +360,7 @@ export default {
label
:
'배포일'
,
field
:
'logname'
,
filter
:
true
,
sort
:
true
,
sort
:
'date'
,
width
:
'100px'
},
{
...
...
quasar/src/components/machine/Create.vue
View file @
e3f189c2
...
...
@@ -168,7 +168,7 @@
</
template
>
<
script
>
import
{
API_URL
,
selectOS
}
from
'config'
import
{
API_URL
}
from
'config'
import
{
Toast
}
from
'quasar'
import
{
required
,
minLength
}
from
'vuelidate/lib/validators'
...
...
@@ -194,7 +194,7 @@ export default {
{
'label'
:
'PM'
,
value
:
'PM'
},
{
'label'
:
'VM'
,
value
:
'VM'
}
],
selectOS
:
selectOS
,
selectOS
:
[]
,
selectDPT
:
[]
}
},
...
...
@@ -246,6 +246,23 @@ export default {
this
.
$refs
.
name
.
focus
()
})
},
getSupportedOS
:
function
()
{
const
url
=
API_URL
+
'/machine/supported_os'
const
token
=
this
.
$store
.
state
.
token
const
headers
=
{
headers
:
{
'Authorization'
:
`Bearer
${
token
}
`
}
}
this
.
$http
.
get
(
url
,
headers
).
then
(
response
=>
{
let
self
=
this
response
.
body
.
forEach
(
function
(
el
)
{
self
.
selectOS
.
push
({
'label'
:
el
,
'value'
:
el
})
})
},
response
=>
{
Toast
.
create
.
negative
(
'지원 OS 정보 수신 실패'
)
})
},
getDPT
:
function
()
{
const
url
=
API_URL
+
'/machine/dpt'
const
token
=
this
.
$store
.
state
.
token
...
...
@@ -265,8 +282,9 @@ export default {
}
},
mounted
()
{
if
(
!
this
.
$store
.
state
.
login
)
{
this
.
$router
.
push
(
'/'
)
}
//
if (!this.$store.state.login) { this.$router.push('/') }
this
.
getSupportedOS
()
this
.
getDPT
()
this
.
$refs
.
name
.
focus
()
...
...
quasar/src/components/machine/List.vue
View file @
e3f189c2
...
...
@@ -118,7 +118,7 @@
</template>
<
script
>
import
{
API_URL
,
selectOS
,
POLLING_INTERVAL
}
from
'config'
import
{
API_URL
,
POLLING_INTERVAL
}
from
'config'
import
{
Loading
,
Dialog
,
Toast
}
from
'quasar'
function
show
(
options
)
{
...
...
@@ -347,7 +347,7 @@ export default {
os
:
{
type
:
'radio'
,
model
:
row
.
os
,
items
:
selectOS
items
:
this
.
getSupportedOS
()
},
header11
:
{
type
:
'heading'
,
...
...
@@ -469,6 +469,24 @@ export default {
]
})
},
getSupportedOS
:
function
()
{
const
url
=
API_URL
+
'/machine/supported_os'
const
token
=
this
.
$store
.
state
.
token
const
headers
=
{
headers
:
{
'Authorization'
:
`Bearer
${
token
}
`
}
}
let
selectOS
=
[]
this
.
$http
.
get
(
url
,
headers
).
then
(
response
=>
{
response
.
body
.
forEach
(
function
(
el
)
{
selectOS
.
push
({
'label'
:
el
,
'value'
:
el
})
})
},
response
=>
{
Toast
.
create
.
negative
(
'지원 OS 정보 수신 실패'
)
})
return
selectOS
},
getDPT
:
function
()
{
const
url
=
API_URL
+
'/machine/dpt'
const
token
=
this
.
$store
.
state
.
token
...
...
quasar/src/components/os/List.vue
View file @
e3f189c2
...
...
@@ -104,7 +104,7 @@
</
template
>
<
script
>
import
{
API_URL
,
selectOS
}
from
'config'
import
{
API_URL
}
from
'config'
import
{
Toast
}
from
'quasar'
export
default
{
...
...
@@ -112,13 +112,9 @@ export default {
data
:
function
()
{
return
{
qtabs
:
'os-tab'
,
selectOS
:
selectOS
,
selectOS
:
this
.
getSupportedOS
()
,
machines
:
[],
allSelected
:
false
,
oses
:
{
'JESSIE'
:
[],
'CENTOS7'
:
[]
},
form
:
{
os
:
''
,
machines
:
[]
...
...
@@ -192,12 +188,28 @@ export default {
Toast
.
create
.
negative
(
'서버 정보 수신 실패'
)
return
})
},
getSupportedOS
:
function
()
{
const
url
=
API_URL
+
'/machine/supported_os'
const
token
=
this
.
$store
.
state
.
token
const
headers
=
{
headers
:
{
'Authorization'
:
`Bearer
${
token
}
`
}
}
let
selectOS
=
[]
this
.
$http
.
get
(
url
,
headers
).
then
(
response
=>
{
response
.
body
.
forEach
(
function
(
el
)
{
selectOS
.
push
({
'label'
:
el
,
'value'
:
el
})
})
},
response
=>
{
Toast
.
create
.
negative
(
'지원 OS 정보 수신 실패'
)
})
return
selectOS
}
},
mounted
:
function
()
{
if
(
!
this
.
$store
.
state
.
login
)
{
this
.
$router
.
push
(
'/'
)
}
},
destroyed
:
function
()
{
this
.
getSupportedOS
()
}
}
</
script
>
...
...
quasar/src/components/play/List.vue
View file @
e3f189c2
...
...
@@ -65,6 +65,12 @@
<div
class=
"card-content"
>
<div
class=
"card"
v-for=
"(machines, section) in this.sections"
>
<div
class=
"card-title"
>
<input
type=
"checkbox"
@
click=
"toggle"
v-model=
"groupSelected"
v-bind:value=
"section"
>
그룹
{{
section
}}
</div>
<div
class=
"card-content"
>
...
...
@@ -140,7 +146,7 @@ export default {
tags
:
[],
sections
:
{
'b'
:
[]},
machines
:
[],
all
Selected
:
false
,
group
Selected
:
false
,
playlog
:
''
,
dLog
:
{},
sameAsBefore
:
0
,
...
...
@@ -192,12 +198,14 @@ export default {
},
toggle
:
function
()
{
let
selected
=
[]
if
(
this
.
allSelected
)
{
console
.
log
(
this
.
groupSelected
)
if
(
this
.
groupSelected
)
{
this
.
machines
.
forEach
(
function
(
machine
)
{
selected
.
push
(
machine
)
})
}
this
.
form
.
machines
=
selected
console
.
log
(
selected
)
},
radioVal
:
function
()
{
// get tags when app is selected.
...
...
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