Skip to content

Commit 2c1c299

Browse files
author
Suszyński Krzysztof
committed
Merge branch 'release/v0.8.0'
2 parents cd6262e + 360f81a commit 2c1c299

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+610
-106
lines changed

Diff for: MANIFEST.in

+3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
# Include the license file
22
include LICENSE
33

4+
# Include automated install scripts
5+
include setup.sh
6+
47
# Include the data files
58
recursive-include puppeter *.py
69
recursive-include puppeter *.pyi

Diff for: README.rst

+28
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,32 @@ Puppeter - an automatic puppet installer
1515

1616
A commandline tool to ease the installation of typical puppetserver - agent installation. It uses a interactive mode and batch mode as well. Batch mode utilizes a answer files for full automatic operation.
1717

18+
Installation
19+
------------
20+
21+
To install Puppeter simple use PIP:
22+
23+
.. code-block:: bash
24+
25+
pip install puppeter
26+
27+
If you like to install puppeter on clean operating system with automatic installer execute:
28+
29+
.. code-block:: bash
30+
31+
curl https://raw.githubusercontent.com/coi-gov-pl/puppeter/master/setup.sh | bash
32+
33+
It will install PIP and compatibile Python (2.7+)
34+
35+
The installer script is supported for:
36+
37+
* Debian 8
38+
* Debian 9
39+
* Ubuntu 14.04
40+
* Ubuntu 16.04
41+
* CentOS 6
42+
* CentOS 7
43+
* OracleLinux 6
44+
* OracleLinux 7
45+
1846
**TODO: Write more later**

Diff for: integration_tests/acceptance.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,6 @@ def run_puppeter(self, answers):
2828
assert exitcode == 0
2929

3030
def __script(self, script, arg=''):
31-
command = 'bash -e %s/integration_tests/scripts/%s %s' % (remote_dir, script, arg)
31+
command = 'bash -leo pipefail %s/integration_tests/scripts/%s %s' % (remote_dir, script, arg)
3232
exitcode, out, err = self.__phial.exec(command.strip())
3333
return exitcode
File renamed without changes.
File renamed without changes.
File renamed without changes.

Diff for: integration_tests/answers/agent-system.yml

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
installer:
2+
mode: Agent
3+
type: system

Diff for: integration_tests/phial.py

+19-17
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,8 @@ def err(self, data):
139139

140140
class CaptureOutputHandler(OutputHandler):
141141
def __init__(self):
142-
self.outbuf = ''
143-
self.errbuf = ''
142+
self.outbuf = b''
143+
self.errbuf = b''
144144

145145
def out(self, data):
146146
self.outbuf += data
@@ -149,10 +149,10 @@ def err(self, data):
149149
self.errbuf += data
150150

151151
def collected_output(self):
152-
return self.outbuf
152+
return self.outbuf.decode(errors='ignore')
153153

154154
def collected_error_output(self):
155-
return self.errbuf
155+
return self.errbuf.decode(errors='ignore')
156156

157157
class PrintOutputHandler(OutputHandler):
158158
def __init__(self):
@@ -183,35 +183,37 @@ def read_all(self):
183183

184184
def read_chunk(self, size=32):
185185
if self.__channel.recv_stderr_ready():
186-
data = self.__channel.recv_stderr(size).decode(errors="ignore")
186+
data = self.__channel.recv_stderr(size)
187187
self.__handler.err(data)
188188
if self.__channel.recv_ready():
189-
data = self.__channel.recv(size).decode(errors="ignore")
189+
data = self.__channel.recv(size)
190190
self.__handler.out(data)
191191

192192
class OutputBuffer:
193193
def __init__(self):
194-
self.buf = ''
194+
self.buf = b''
195195

196196
def recv(self, data):
197197
self.buf += data
198198

199199
def lines_collected(self):
200200
# type: () -> Sequence[str]
201-
splited = self.buf.splitlines(keepends=True)
201+
splited = self.buf\
202+
.decode(errors='ignore')\
203+
.splitlines(keepends=True)
202204
collected = []
203205
newbuf = ''
204206
for line in splited:
205207
if line.endswith(('\n', '\r\n')):
206208
collected.append(line.rstrip())
207209
else:
208210
newbuf += line
209-
self.buf = newbuf
211+
self.buf = newbuf.encode()
210212
return collected
211213

212214
def _bashify(self, command):
213215
filtered = command.replace("'", "\\'")
214-
return "bash -lc '{command}'".format(command=filtered)
216+
return "bash -leo pipefail -c '{command}'".format(command=filtered)
215217

216218

217219
@pytest.fixture
@@ -249,7 +251,7 @@ def execute(command, success_codes=(0,)):
249251
output = error.output or b''
250252
status = error.returncode
251253
command = error.cmd
252-
output = output.decode('utf-8')
254+
output = output.decode(errors='ignore')
253255
if status not in success_codes:
254256
raise Exception(
255257
'Command %r returned %d: """%s""".' % (command, status, output)
@@ -267,15 +269,15 @@ def execute_streaming(command, success_codes=(0,)):
267269
while True:
268270
retcode = p.poll()
269271
if retcode is not None:
270-
handler.err(p.stderr.read().decode(errors='ignore'))
271-
handler.out(p.stdout.read().decode(errors='ignore'))
272+
handler.err(p.stderr.read())
273+
handler.out(p.stdout.read())
272274
break
273275
while len(select.select([p.stderr], [], [], 0)[0]) == 1:
274-
contents = p.stderr.read(1).decode(errors='ignore')
275-
handler.err(contents)
276+
data = p.stderr.read(1)
277+
handler.err(data)
276278
while len(select.select([p.stdout], [], [], 0)[0]) == 1:
277-
contents = p.stdout.read(1).decode(errors='ignore')
278-
handler.out(contents)
279+
data = p.stdout.read(1)
280+
handler.out(data)
279281
time.sleep(0.01)
280282
if retcode not in success_codes:
281283
raise Exception(

Diff for: integration_tests/system-under-tests/debian/debian-8/Dockerfile

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
FROM debian:8
22

3-
RUN apt-get update && apt-get install -y openssh-server python-pip python-dev
3+
RUN apt-get update && apt-get install -y openssh-server
44
RUN mkdir /var/run/sshd
55
RUN echo 'root:phial' | chpasswd
66
RUN sed -i 's/PermitRootLogin without-password/PermitRootLogin yes/' /etc/ssh/sshd_config
@@ -11,5 +11,10 @@ RUN sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so
1111
ENV NOTVISIBLE "in users profile"
1212
RUN echo "export VISIBLE=now" >> /etc/profile
1313

14+
COPY ./setup.sh /puppeter-setup.sh
15+
RUN chmod +x /puppeter-setup.sh
16+
ENV MODE dependencies
17+
RUN /puppeter-setup.sh
18+
1419
EXPOSE 22
1520
CMD ["/usr/sbin/sshd", "-D"]

Diff for: integration_tests/system-under-tests/debian/debian-8/docker-compose.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
version: '3'
33
services:
44
sut:
5-
build: ./
5+
build:
6+
context: ../../../..
7+
dockerfile: integration_tests/system-under-tests/debian/debian-8/Dockerfile
68
ports:
79
- 22

Diff for: integration_tests/system-under-tests/debian/debian-9/Dockerfile

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
FROM debian:9
22

3-
RUN apt-get update && apt-get install -y openssh-server python-pip
3+
RUN apt-get update && apt-get install -y openssh-server
44
RUN mkdir /var/run/sshd
55
RUN echo 'root:phial' | chpasswd
66
RUN sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config
@@ -11,5 +11,10 @@ RUN sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so
1111
ENV NOTVISIBLE "in users profile"
1212
RUN echo "export VISIBLE=now" >> /etc/profile
1313

14+
COPY ./setup.sh /puppeter-setup.sh
15+
RUN chmod +x /puppeter-setup.sh
16+
ENV MODE dependencies
17+
RUN /puppeter-setup.sh
18+
1419
EXPOSE 22
1520
CMD ["/usr/sbin/sshd", "-D"]

Diff for: integration_tests/system-under-tests/debian/debian-9/docker-compose.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
version: '3'
33
services:
44
sut:
5-
build: ./
5+
build:
6+
context: ../../../..
7+
dockerfile: integration_tests/system-under-tests/debian/debian-9/Dockerfile
68
ports:
79
- 22

Diff for: integration_tests/system-under-tests/debian/ubuntu-1404/Dockerfile

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
FROM ubuntu:14.04
22

3-
RUN apt-get update && apt-get install -y openssh-server python-pip python-dev
3+
RUN apt-get update && apt-get install -y openssh-server
44
RUN mkdir /var/run/sshd
55
RUN echo 'root:phial' | chpasswd
66
RUN sed -i 's/PermitRootLogin without-password/PermitRootLogin yes/' /etc/ssh/sshd_config
@@ -11,5 +11,10 @@ RUN sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so
1111
ENV NOTVISIBLE "in users profile"
1212
RUN echo "export VISIBLE=now" >> /etc/profile
1313

14+
COPY ./setup.sh /puppeter-setup.sh
15+
RUN chmod +x /puppeter-setup.sh
16+
ENV MODE dependencies
17+
RUN /puppeter-setup.sh
18+
1419
EXPOSE 22
1520
CMD ["/usr/sbin/sshd", "-D"]

Diff for: integration_tests/system-under-tests/debian/ubuntu-1404/docker-compose.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
version: '3'
33
services:
44
sut:
5-
build: ./
5+
build:
6+
context: ../../../..
7+
dockerfile: integration_tests/system-under-tests/debian/ubuntu-1404/Dockerfile
68
ports:
79
- 22

Diff for: integration_tests/system-under-tests/debian/ubuntu-1604/Dockerfile

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
FROM ubuntu:16.04
22

3-
RUN apt-get update && apt-get install -y openssh-server python-pip
3+
RUN apt-get update && apt-get install -y openssh-server
44
RUN mkdir /var/run/sshd
55
RUN echo 'root:phial' | chpasswd
66
RUN sed -i 's/PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config
@@ -11,5 +11,10 @@ RUN sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so
1111
ENV NOTVISIBLE "in users profile"
1212
RUN echo "export VISIBLE=now" >> /etc/profile
1313

14+
COPY ./setup.sh /puppeter-setup.sh
15+
RUN chmod +x /puppeter-setup.sh
16+
ENV MODE dependencies
17+
RUN /puppeter-setup.sh
18+
1419
EXPOSE 22
1520
CMD ["/usr/sbin/sshd", "-D"]

Diff for: integration_tests/system-under-tests/debian/ubuntu-1604/docker-compose.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
version: '3'
33
services:
44
sut:
5-
build: ./
5+
build:
6+
context: ../../../..
7+
dockerfile: integration_tests/system-under-tests/debian/ubuntu-1604/Dockerfile
68
ports:
79
- 22
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
FROM centos:6
22

3-
RUN yum install -y centos-release-scl
4-
RUN yum install -y openssh-server python27-python-pip
5-
ADD enablepython27.sh /etc/profile.d/enablepython27.sh
6-
3+
RUN yum install -y openssh-server
74
RUN mkdir /var/run/sshd
85
RUN ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key -N ''
96
RUN echo 'root:phial' | chpasswd
@@ -15,5 +12,10 @@ RUN sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so
1512
ENV NOTVISIBLE "in users profile"
1613
RUN echo "export VISIBLE=now" >> /etc/profile
1714

15+
COPY ./setup.sh /puppeter-setup.sh
16+
RUN chmod +x /puppeter-setup.sh
17+
ENV MODE dependencies
18+
RUN /puppeter-setup.sh
19+
1820
EXPOSE 22
1921
CMD ["/usr/sbin/sshd", "-D"]

Diff for: integration_tests/system-under-tests/redhat/centos-6/docker-compose.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
version: '3'
33
services:
44
sut:
5-
build: ./
5+
build:
6+
context: ../../../..
7+
dockerfile: integration_tests/system-under-tests/redhat/centos-6/Dockerfile
68
ports:
79
- 22

Diff for: integration_tests/system-under-tests/redhat/centos-6/enablepython27.sh

-2
This file was deleted.

Diff for: integration_tests/system-under-tests/redhat/centos-7/Dockerfile

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
FROM centos:7
22

3-
RUN yum install -y epel-release
4-
RUN yum install -y openssh-server python-pip
3+
RUN yum install -y openssh-server
54
RUN mkdir /var/run/sshd
65
RUN ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key -N ''
76
RUN echo 'root:phial' | chpasswd
@@ -13,5 +12,10 @@ RUN sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so
1312
ENV NOTVISIBLE "in users profile"
1413
RUN echo "export VISIBLE=now" >> /etc/profile
1514

15+
COPY ./setup.sh /puppeter-setup.sh
16+
RUN chmod +x /puppeter-setup.sh
17+
ENV MODE dependencies
18+
RUN /puppeter-setup.sh
19+
1620
EXPOSE 22
1721
CMD ["/usr/sbin/sshd", "-D"]

Diff for: integration_tests/system-under-tests/redhat/centos-7/docker-compose.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
version: '3'
33
services:
44
sut:
5-
build: ./
5+
build:
6+
context: ../../../..
7+
dockerfile: integration_tests/system-under-tests/redhat/centos-7/Dockerfile
68
ports:
79
- 22
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
FROM oraclelinux:6
22

3-
RUN yum-config-manager --enable public_ol6_software_collections
4-
RUN yum install -y openssh-server python27-python-pip
5-
ADD enablepython27.sh /etc/profile.d/enablepython27.sh
6-
3+
RUN yum install -y openssh-server
74
RUN mkdir /var/run/sshd
85
RUN ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key -N ''
96
RUN echo 'root:phial' | chpasswd
@@ -15,5 +12,10 @@ RUN sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so
1512
ENV NOTVISIBLE "in users profile"
1613
RUN echo "export VISIBLE=now" >> /etc/profile
1714

15+
COPY ./setup.sh /puppeter-setup.sh
16+
RUN chmod +x /puppeter-setup.sh
17+
ENV MODE dependencies
18+
RUN /puppeter-setup.sh
19+
1820
EXPOSE 22
1921
CMD ["/usr/sbin/sshd", "-D"]

Diff for: integration_tests/system-under-tests/redhat/oraclelinux-6/docker-compose.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
version: '3'
33
services:
44
sut:
5-
build: ./
5+
build:
6+
context: ../../../..
7+
dockerfile: integration_tests/system-under-tests/redhat/oraclelinux-6/Dockerfile
68
ports:
79
- 22

Diff for: integration_tests/system-under-tests/redhat/oraclelinux-6/enablepython27.sh

-2
This file was deleted.

Diff for: integration_tests/system-under-tests/redhat/oraclelinux-7/Dockerfile

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
FROM oraclelinux:7
22

3-
RUN yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
4-
RUN yum install -y openssh-server python-pip
3+
RUN yum install -y openssh-server
54
RUN mkdir /var/run/sshd
65
RUN ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key -N ''
76
RUN echo 'root:phial' | chpasswd
@@ -15,5 +14,10 @@ RUN echo "export VISIBLE=now" >> /etc/profile
1514

1615
ENV LANG en_US.UTF-8
1716

17+
COPY ./setup.sh /puppeter-setup.sh
18+
RUN chmod +x /puppeter-setup.sh
19+
ENV MODE dependencies
20+
RUN /puppeter-setup.sh
21+
1822
EXPOSE 22
1923
CMD ["/usr/sbin/sshd", "-D"]

Diff for: integration_tests/system-under-tests/redhat/oraclelinux-7/docker-compose.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
version: '3'
33
services:
44
sut:
5-
build: ./
5+
build:
6+
context: ../../../..
7+
dockerfile: integration_tests/system-under-tests/redhat/oraclelinux-7/Dockerfile
68
ports:
79
- 22

0 commit comments

Comments
 (0)