Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
CIRCLE3
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
5
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
1caf8013
authored
Aug 17, 2022
by
Szeberényi Imre
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'ci-integration' into 'master'
Bugfix - JS See merge request
!12
parents
7739d371
bdb49d44
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
31 additions
and
9 deletions
+31
-9
circle/dashboard/static/dashboard/dashboard.css
+10
-2
circle/dashboard/static/dashboard/vm-details.js
+2
-3
circle/dashboard/templates/dashboard/_ci-data-help.html
+6
-1
circle/dashboard/templates/dashboard/_template-create.html
+1
-0
circle/vm/models/instance.py
+12
-3
No files found.
circle/dashboard/static/dashboard/dashboard.css
View file @
1caf8013
...
@@ -1364,5 +1364,13 @@ textarea[name="new_members"] {
...
@@ -1364,5 +1364,13 @@ textarea[name="new_members"] {
height
:
18px
;
height
:
18px
;
margin-right
:
8px
;
margin-right
:
8px
;
}
}
#ace-meta-data
{
position
:
absolute
;
width
:
95%
;
height
:
150px
;
}
#ace-user-data
{
position
:
absolute
;
width
:
95%
;
height
:
350px
;
}
circle/dashboard/static/dashboard/vm-details.js
View file @
1caf8013
var
Websock_native
;
// not sure
var
Websock_native
;
// not sure
$
(
function
()
{
$
(
function
()
{
if
(
$
(
"#ace-meta-data"
).
length
&&
$
(
"#ace-user-data"
).
length
)
{
var
meta_data
=
ace
.
edit
(
'ace-meta-data'
,
{
var
meta_data
=
ace
.
edit
(
'ace-meta-data'
,
{
mode
:
"ace/mode/yaml"
,
useWorker
:
false
,
mode
:
"ace/mode/yaml"
,
useWorker
:
false
,
selectionStyle
:
"text"
});
selectionStyle
:
"text"
});
...
@@ -26,7 +26,6 @@ $(function() {
...
@@ -26,7 +26,6 @@ $(function() {
document
.
getElementById
(
'ace-user-data'
).
style
.
fontSize
=
'14px'
;
document
.
getElementById
(
'ace-user-data'
).
style
.
fontSize
=
'14px'
;
/* */
/* */
$
(
'#vm-details-cidata-save'
).
click
(
function
(
e
)
{
$
(
'#vm-details-cidata-save'
).
click
(
function
(
e
)
{
$
.
ajax
({
$
.
ajax
({
type
:
'POST'
,
type
:
'POST'
,
url
:
$
(
this
).
parents
(
"form"
).
prop
(
'action'
),
url
:
$
(
this
).
parents
(
"form"
).
prop
(
'action'
),
...
@@ -48,9 +47,9 @@ $(function() {
...
@@ -48,9 +47,9 @@ $(function() {
}
}
}
}
});
});
e
.
preventDefault
()
e
.
preventDefault
()
})
})
}
/* save resources */
/* save resources */
$
(
'#vm-details-resources-save'
).
click
(
function
(
e
)
{
$
(
'#vm-details-resources-save'
).
click
(
function
(
e
)
{
var
error
=
false
;
var
error
=
false
;
...
...
circle/dashboard/templates/dashboard/_ci-data-help.html
View file @
1caf8013
...
@@ -21,8 +21,13 @@
...
@@ -21,8 +21,13 @@
<li>
{% trans "
<code>
net.vlans
</code>
- associated vlans: list of objects (name: vlan name, ipv4/ipv6: host ip in vlan)" %}
</li>
<li>
{% trans "
<code>
net.vlans
</code>
- associated vlans: list of objects (name: vlan name, ipv4/ipv6: host ip in vlan)" %}
</li>
<li>
{% trans "
<code>
ssh.keys
</code>
- owner's ssh-keys dictionary: the key is the ssh-key's name" %}
</li>
<li>
{% trans "
<code>
ssh.keys
</code>
- owner's ssh-keys dictionary: the key is the ssh-key's name" %}
</li>
<li>
{% trans "
<code>
ci.rndstr(len: int)
</code>
- function: make random string with 'len' charachters lenght" %}
</li>
<li>
{% trans "
<code>
ci.rndstr(len: int)
</code>
- function: make random string with 'len' charachters lenght" %}
</li>
<li>
{% trans "
<code>
ci.loadjson(url: str)
</code>
- load json object from remote url" %}
</li>
</ul>
</ul>
<p>
{% trans "Filters: hash - sha512 hash method" %}
</p>
<p>
{% trans "Filters: hash - sha512 hash method" %}
</p>
<p>
{% trans "Use this commands, to clean cloud-init setup (for save as template example):" %}
</p>
<pre>
cloud-init clean
userdel -p -f cloud # delete default user
</pre>
<b>
Example:
</b>
<b>
Example:
</b>
<pre>
{% verbatim %}
<pre>
{% verbatim %}
#cloud-config
#cloud-config
...
@@ -39,7 +44,7 @@ users:
...
@@ -39,7 +44,7 @@ users:
ssh_authorized_keys:
ssh_authorized_keys:
- {{ ssh.keys['my-key'] }}
- {{ ssh.keys['my-key'] }}
{% for u in acl.operators %}
{% for u in acl.operators %}
- name: {{
i
}}
- name: {{
u
}}
shell: /bin/bash
shell: /bin/bash
{% endfor %}
{% endfor %}
{% endverbatim %}
</pre>
{% endverbatim %}
</pre>
...
...
circle/dashboard/templates/dashboard/_template-create.html
View file @
1caf8013
...
@@ -26,6 +26,7 @@
...
@@ -26,6 +26,7 @@
{{ form.req_traits|as_crispy_field }}
{{ form.req_traits|as_crispy_field }}
{{ form.description|as_crispy_field }}
{{ form.description|as_crispy_field }}
{{ form.system|as_crispy_field }}
{{ form.system|as_crispy_field }}
{{ form.has_agent|as_crispy_field }}
<hr/>
<hr/>
{% include "dashboard/_ci-data-help.html" %}
{% include "dashboard/_ci-data-help.html" %}
<div
class=
"alert alert-warning"
>
<div
class=
"alert alert-warning"
>
...
...
circle/vm/models/instance.py
View file @
1caf8013
...
@@ -43,7 +43,7 @@ import jinja2
...
@@ -43,7 +43,7 @@ import jinja2
from
passlib.hash
import
sha512_crypt
from
passlib.hash
import
sha512_crypt
import
yaml
import
yaml
import
re
import
urllib3
,
json
from
model_utils
import
Choices
from
model_utils
import
Choices
from
model_utils.managers
import
QueryManager
from
model_utils.managers
import
QueryManager
...
@@ -80,13 +80,14 @@ ACCESS_METHODS = [(key, name) for key, (name, port, transport)
...
@@ -80,13 +80,14 @@ ACCESS_METHODS = [(key, name) for key, (name, port, transport)
CI_META_DATA_DEF
=
"""
CI_META_DATA_DEF
=
"""
instance-id: {{ hostname }}
instance-id: {{ hostname }}
local-hostname: {{ hostname }}
local-hostname: {{ hostname }}
cloud-name: circle3
platform: circle3
"""
.
strip
()
"""
.
strip
()
CI_USER_DATA_DEF
=
"""
CI_USER_DATA_DEF
=
"""
#cloud-config
#cloud-config
users:
users:
- default
- name: {{ sysuser }}
- name: {{ sysuser }}
sudo: ['ALL=(ALL) NOPASSWD:ALL']
sudo: ['ALL=(ALL) NOPASSWD:ALL']
groups: sudo
groups: sudo
...
@@ -158,7 +159,7 @@ class VirtualMachineDescModel(BaseResourceConfigModel):
...
@@ -158,7 +159,7 @@ class VirtualMachineDescModel(BaseResourceConfigModel):
help_text
=
(
_
(
'Name of operating system in format like '
help_text
=
(
_
(
'Name of operating system in format like '
'"Ubuntu 12.04 LTS Desktop amd64".'
)))
'"Ubuntu 12.04 LTS Desktop amd64".'
)))
tags
=
TaggableManager
(
blank
=
True
,
verbose_name
=
_
(
"tags"
))
tags
=
TaggableManager
(
blank
=
True
,
verbose_name
=
_
(
"tags"
))
has_agent
=
BooleanField
(
verbose_name
=
_
(
'has agent'
),
default
=
Tru
e
,
has_agent
=
BooleanField
(
verbose_name
=
_
(
'has agent'
),
default
=
Fals
e
,
help_text
=
_
(
help_text
=
_
(
'If the machine has agent installed, and '
'If the machine has agent installed, and '
'the manager should wait for its start.'
))
'the manager should wait for its start.'
))
...
@@ -259,6 +260,14 @@ class CITemplate:
...
@@ -259,6 +260,14 @@ class CITemplate:
def
rndstr
(
self
,
len
):
def
rndstr
(
self
,
len
):
return
''
.
join
(
random
.
choice
(
string
.
ascii_letters
)
for
i
in
range
(
int
(
len
)))
return
''
.
join
(
random
.
choice
(
string
.
ascii_letters
)
for
i
in
range
(
int
(
len
)))
def
jsonload
(
self
,
url
):
http
=
urllib3
.
PoolManager
()
r
=
http
.
request
(
'GET'
,
url
)
if
r
.
status
!=
200
:
raise
forms
.
ValidationError
(
f
'Status code: {r.status}'
)
myjson
=
r
.
data
.
decode
(
'utf8'
)
return
json
.
loads
(
myjson
)
def
j2_hash
(
value
,
hash
=
'sha512'
):
def
j2_hash
(
value
,
hash
=
'sha512'
):
return
sha512_crypt
.
hash
(
value
)
return
sha512_crypt
.
hash
(
value
)
...
...
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