Commit 16357fc3 by Karsa Zoltán István

cloud-init clean, fix typo

parent 14291839
...@@ -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;
}
...@@ -23,6 +23,10 @@ ...@@ -23,6 +23,10 @@
<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>
</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 +43,7 @@ users: ...@@ -39,7 +43,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>
......
...@@ -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
...@@ -86,7 +86,6 @@ CI_USER_DATA_DEF = """ ...@@ -86,7 +86,6 @@ 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
...@@ -259,6 +258,14 @@ class CITemplate: ...@@ -259,6 +258,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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment