Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.package
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ivan Tyagov
slapos.package
Commits
5b282b11
Commit
5b282b11
authored
Nov 09, 2021
by
Thomas Gambier
🚴🏼
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
playbook: convert vm-bootstrap scripts to python3
Also make vm-bootstrap role depends on python3
parent
c454260c
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
12 additions
and
9 deletions
+12
-9
playbook/roles/vm-bootstrap/files/file_cmp
playbook/roles/vm-bootstrap/files/file_cmp
+2
-2
playbook/roles/vm-bootstrap/files/format_hosts
playbook/roles/vm-bootstrap/files/format_hosts
+3
-3
playbook/roles/vm-bootstrap/files/ping
playbook/roles/vm-bootstrap/files/ping
+4
-4
playbook/roles/vm-bootstrap/meta/main.yml
playbook/roles/vm-bootstrap/meta/main.yml
+3
-0
No files found.
playbook/roles/vm-bootstrap/files/file_cmp
View file @
5b282b11
#!/usr/bin/python
#!/usr/bin/python
3
import
os
import
os
import
sys
import
sys
...
@@ -6,7 +6,7 @@ import sys
...
@@ -6,7 +6,7 @@ import sys
if
__name__
==
"__main__"
:
if
__name__
==
"__main__"
:
if
len
(
sys
.
argv
)
<
4
:
if
len
(
sys
.
argv
)
<
4
:
print
"Use: %s FILE1 FILE2 DEST_FILE"
%
sys
.
argv
[
0
]
print
(
"Use: %s FILE1 FILE2 DEST_FILE"
%
sys
.
argv
[
0
])
exit
(
1
)
exit
(
1
)
file1
=
sys
.
argv
[
1
]
file1
=
sys
.
argv
[
1
]
...
...
playbook/roles/vm-bootstrap/files/format_hosts
View file @
5b282b11
#!/usr/bin/python
#!/usr/bin/python
3
import
sys
import
sys
print
sys
.
argv
[
1
:]
print
(
sys
.
argv
[
1
:])
host_content
=
open
(
'/etc/hosts'
,
'r'
).
read
()
host_content
=
open
(
'/etc/hosts'
,
'r'
).
read
()
hpath
=
sys
.
argv
[
1
]
hpath
=
sys
.
argv
[
1
]
...
@@ -13,7 +13,7 @@ for content in open(hpath, 'r').readlines():
...
@@ -13,7 +13,7 @@ for content in open(hpath, 'r').readlines():
if
content
:
if
content
:
items
=
content
.
strip
().
split
(
' '
)
items
=
content
.
strip
().
split
(
' '
)
entry
=
"%s %s.%s %s"
%
(
items
[
1
],
items
[
0
],
domain
,
items
[
0
])
entry
=
"%s %s.%s %s"
%
(
items
[
1
],
items
[
0
],
domain
,
items
[
0
])
print
entry
print
(
entry
)
if
not
entry
in
host_content
:
if
not
entry
in
host_content
:
lines_entry
+=
entry
+
"
\
n
"
lines_entry
+=
entry
+
"
\
n
"
...
...
playbook/roles/vm-bootstrap/files/ping
View file @
5b282b11
#!/usr/bin/python
#!/usr/bin/python
3
import
os
import
os
import
sys
import
sys
...
@@ -24,9 +24,9 @@ def ping_cluster(hpath):
...
@@ -24,9 +24,9 @@ def ping_cluster(hpath):
if
__name__
==
"__main__"
:
if
__name__
==
"__main__"
:
if
len
(
sys
.
argv
)
<
3
:
if
len
(
sys
.
argv
)
<
3
:
print
"Use: %s TYPE [HOST LIST] OR [HOST-FILE]"
%
sys
.
argv
[
0
]
print
(
"Use: %s TYPE [HOST LIST] OR [HOST-FILE]"
%
sys
.
argv
[
0
])
print
"ex: %s host google.com slapos.org; %s cluster /tmp/hosts"
%
(
print
(
"ex: %s host google.com slapos.org; %s cluster /tmp/hosts"
%
(
sys
.
argv
[
0
],
sys
.
argv
[
0
])
sys
.
argv
[
0
],
sys
.
argv
[
0
])
)
exit
(
1
)
exit
(
1
)
if
sys
.
argv
[
1
]
==
'host'
:
if
sys
.
argv
[
1
]
==
'host'
:
check_ping
(
sys
.
argv
[
2
:])
check_ping
(
sys
.
argv
[
2
:])
...
...
playbook/roles/vm-bootstrap/meta/main.yml
0 → 100644
View file @
5b282b11
---
dependencies
:
-
{
role
:
package
,
package_name
:
python3
,
package_state
:
present
}
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