<feed xmlns='http://www.w3.org/2005/Atom'>
<title>delta/python-packages/targetcli.git/daemon/targetclid, branch master</title>
<subtitle>github.com: agrover/targetcli-fb.git
</subtitle>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/python-packages/targetcli.git/'/>
<entry>
<title>uds: set right permissions at bind() time</title>
<updated>2020-05-29T13:10:03+00:00</updated>
<author>
<name>Prasanna Kumar Kalever</name>
<email>prasanna.kalever@redhat.com</email>
</author>
<published>2020-05-29T13:01:21+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/python-packages/targetcli.git/commit/?id=e347f7ea20547052e8fc1b65cba5e3f3ef2bf3d8'/>
<id>e347f7ea20547052e8fc1b65cba5e3f3ef2bf3d8</id>
<content type='text'>
We fixed it earlier with commit 6e4f39357a90a914d11bac21cc2d2b52c07c213d
but that fixes the issue when someone run the targetclid with systemd
only.

If we don't use targetclid.socket and want to run `targetclid` from
command line, then socket.bind() will create the file with default
permissions.

Hence its good if we can guard the permissions right at the time of .bind()

Signed-off-by: Prasanna Kumar Kalever &lt;prasanna.kalever@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
We fixed it earlier with commit 6e4f39357a90a914d11bac21cc2d2b52c07c213d
but that fixes the issue when someone run the targetclid with systemd
only.

If we don't use targetclid.socket and want to run `targetclid` from
command line, then socket.bind() will create the file with default
permissions.

Hence its good if we can guard the permissions right at the time of .bind()

Signed-off-by: Prasanna Kumar Kalever &lt;prasanna.kalever@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Use temp file objects for temporary storage area</title>
<updated>2020-04-03T18:28:23+00:00</updated>
<author>
<name>Prasanna Kumar Kalever</name>
<email>prasanna.kalever@redhat.com</email>
</author>
<published>2020-04-03T14:36:48+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/python-packages/targetcli.git/commit/?id=4f6611ed208b6029b4523ca7760a802e82b6a199'/>
<id>4f6611ed208b6029b4523ca7760a802e82b6a199</id>
<content type='text'>
happen to see yet another issue after we switch to stringIO/bytesIO:

$ targetcli ls
'unicode' does not have the buffer interface

After which I felt like dealing with StringIO/BytesIO is like a
wild goose chase and we are after all attempting to deal with python
incompatible apis.

Technically speaking, the rtslib and configshell libraries are expecting a
string IO stream, but then for python2 with ByteIO() we are passing a
bytestream, and stringIO() is behaving a bit different in python2 than
expected as explained in my previous patch.

Lets simply switch to temporary file in the most secure manner possible,
opening files in string mode will assure the compatibility across the platforms.

At the end we wish to have a consistent behaviour across all python versions.

Signed-off-by: Prasanna Kumar Kalever &lt;prasanna.kalever@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
happen to see yet another issue after we switch to stringIO/bytesIO:

$ targetcli ls
'unicode' does not have the buffer interface

After which I felt like dealing with StringIO/BytesIO is like a
wild goose chase and we are after all attempting to deal with python
incompatible apis.

Technically speaking, the rtslib and configshell libraries are expecting a
string IO stream, but then for python2 with ByteIO() we are passing a
bytestream, and stringIO() is behaving a bit different in python2 than
expected as explained in my previous patch.

Lets simply switch to temporary file in the most secure manner possible,
opening files in string mode will assure the compatibility across the platforms.

At the end we wish to have a consistent behaviour across all python versions.

Signed-off-by: Prasanna Kumar Kalever &lt;prasanna.kalever@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix StringIO/BytesIO stuck issue</title>
<updated>2020-04-02T11:36:59+00:00</updated>
<author>
<name>Prasanna Kumar Kalever</name>
<email>prasanna.kalever@redhat.com</email>
</author>
<published>2020-04-02T10:33:57+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/python-packages/targetcli.git/commit/?id=0157f74a31adc1bd999ea5e5bc3a9c34af90b98c'/>
<id>0157f74a31adc1bd999ea5e5bc3a9c34af90b98c</id>
<content type='text'>
We all know the way python3 handles strings is a bit different.

$ python2
Python 2.7.16 (default, Apr 30 2019, 15:54:43)
[GCC 9.0.1 20190312 (Red Hat 9.0.1-0.10)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
&gt;&gt;&gt; import io
&gt;&gt;&gt; s=io.BytesIO()
&gt;&gt;&gt; s.write('hello')
5L
&gt;&gt;&gt; s.getvalue()
'hello'
&gt;&gt;&gt; s=io.StringIO()
&gt;&gt;&gt; s.write('hello')
Traceback (most recent call last):
  File "&lt;stdin&gt;", line 1, in &lt;module&gt;
TypeError: unicode argument expected, got 'str'
&gt;&gt;&gt; s.write(u'hello')
5L
&gt;&gt;&gt; s.getvalue()
u'hello'
&gt;&gt;&gt;

$ python3
Python 3.6.8 (default, Dec  5 2019, 15:45:45)
[GCC 8.3.1 20191121 (Red Hat 8.3.1-5)] on linux
Type "help", "copyright", "credits" or "license" for more information.
&gt;&gt;&gt; import io
&gt;&gt;&gt; s=io.BytesIO()
&gt;&gt;&gt; s.write('hello')
Traceback (most recent call last):
  File "&lt;stdin&gt;", line 1, in &lt;module&gt;
TypeError: a bytes-like object is required, not 'str'
&gt;&gt;&gt; s.write(b'hello')
5
&gt;&gt;&gt; s.getvalue()
b'hello'
&gt;&gt;&gt; s=io.StringIO()
&gt;&gt;&gt; s.write('hello')
5
&gt;&gt;&gt; s.getvalue()
'hello'
&gt;&gt;&gt;

The way Python2 and Python3 handles String and Bytes IO is different.
* In Python2 BytesIO() accepts text format syntax, and StringIO() expects unicodes
* While in Python3 StringIO() accepts text format syntax, and BytesIO() expects bytes like objects

I think the compatibility of using both the IO streams with python2 and python3 is compromised.

Hence this patch, uses BytesIO() and StringIO() based on python version.

Signed-off-by: Prasanna Kumar Kalever &lt;prasanna.kalever@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
We all know the way python3 handles strings is a bit different.

$ python2
Python 2.7.16 (default, Apr 30 2019, 15:54:43)
[GCC 9.0.1 20190312 (Red Hat 9.0.1-0.10)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
&gt;&gt;&gt; import io
&gt;&gt;&gt; s=io.BytesIO()
&gt;&gt;&gt; s.write('hello')
5L
&gt;&gt;&gt; s.getvalue()
'hello'
&gt;&gt;&gt; s=io.StringIO()
&gt;&gt;&gt; s.write('hello')
Traceback (most recent call last):
  File "&lt;stdin&gt;", line 1, in &lt;module&gt;
TypeError: unicode argument expected, got 'str'
&gt;&gt;&gt; s.write(u'hello')
5L
&gt;&gt;&gt; s.getvalue()
u'hello'
&gt;&gt;&gt;

$ python3
Python 3.6.8 (default, Dec  5 2019, 15:45:45)
[GCC 8.3.1 20191121 (Red Hat 8.3.1-5)] on linux
Type "help", "copyright", "credits" or "license" for more information.
&gt;&gt;&gt; import io
&gt;&gt;&gt; s=io.BytesIO()
&gt;&gt;&gt; s.write('hello')
Traceback (most recent call last):
  File "&lt;stdin&gt;", line 1, in &lt;module&gt;
TypeError: a bytes-like object is required, not 'str'
&gt;&gt;&gt; s.write(b'hello')
5
&gt;&gt;&gt; s.getvalue()
b'hello'
&gt;&gt;&gt; s=io.StringIO()
&gt;&gt;&gt; s.write('hello')
5
&gt;&gt;&gt; s.getvalue()
'hello'
&gt;&gt;&gt;

The way Python2 and Python3 handles String and Bytes IO is different.
* In Python2 BytesIO() accepts text format syntax, and StringIO() expects unicodes
* While in Python3 StringIO() accepts text format syntax, and BytesIO() expects bytes like objects

I think the compatibility of using both the IO streams with python2 and python3 is compromised.

Hence this patch, uses BytesIO() and StringIO() based on python version.

Signed-off-by: Prasanna Kumar Kalever &lt;prasanna.kalever@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix targetclid daemon infinite stuck</title>
<updated>2020-03-30T14:16:07+00:00</updated>
<author>
<name>Prasanna Kumar Kalever</name>
<email>prasanna.kalever@redhat.com</email>
</author>
<published>2020-03-30T14:06:26+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/python-packages/targetcli.git/commit/?id=5349bc9d1105c71158fce8dfd6a4733eb90dbb1a'/>
<id>5349bc9d1105c71158fce8dfd6a4733eb90dbb1a</id>
<content type='text'>
We need to open a byte IO stream because we are actually dealing with
binary data in memory.

Signed-off-by: Prasanna Kumar Kalever &lt;prasanna.kalever@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
We need to open a byte IO stream because we are actually dealing with
binary data in memory.

Signed-off-by: Prasanna Kumar Kalever &lt;prasanna.kalever@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Use StringIO as a buffer instead of a file</title>
<updated>2019-11-08T00:15:27+00:00</updated>
<author>
<name>Matt Coleman</name>
<email>matt@datto.com</email>
</author>
<published>2019-11-07T23:21:32+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/python-packages/targetcli.git/commit/?id=3db75315b7e436e57943efb132f7b331a7a7744c'/>
<id>3db75315b7e436e57943efb132f7b331a7a7744c</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>daemon: load the prefs on every new connection</title>
<updated>2019-10-30T10:30:11+00:00</updated>
<author>
<name>Prasanna Kumar Kalever</name>
<email>prasanna.kalever@redhat.com</email>
</author>
<published>2019-10-22T09:47:37+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/python-packages/targetcli.git/commit/?id=8f9ee9159d576167ba6c71d2be4098709e424244'/>
<id>8f9ee9159d576167ba6c71d2be4098709e424244</id>
<content type='text'>
Problem:
-------
Noticing inconsistency with prefs when switching between cli mode and
daemon mode

Solution:
-------
Makesure to read/load the prefs on every new connection

Thanks to 'Xiubo Li &lt;xiubli@redhat.com&gt;' for reporting the problem

Signed-off-by: Prasanna Kumar Kalever &lt;prasanna.kalever@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Problem:
-------
Noticing inconsistency with prefs when switching between cli mode and
daemon mode

Solution:
-------
Makesure to read/load the prefs on every new connection

Thanks to 'Xiubo Li &lt;xiubli@redhat.com&gt;' for reporting the problem

Signed-off-by: Prasanna Kumar Kalever &lt;prasanna.kalever@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Do not print err msg when signal closes socket.</title>
<updated>2019-10-10T21:03:00+00:00</updated>
<author>
<name>Lee Duncan</name>
<email>lduncan@suse.com</email>
</author>
<published>2019-10-07T22:27:46+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/python-packages/targetcli.git/commit/?id=a93c8fb860fc11261a5fb11afcd94c66ab865344'/>
<id>a93c8fb860fc11261a5fb11afcd94c66ab865344</id>
<content type='text'>
Before, we would get a "Bad File Descriptor" message when
a signal causes closure of the socket while waiting on a
socket message.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Before, we would get a "Bad File Descriptor" message when
a signal causes closure of the socket while waiting on a
socket message.
</pre>
</div>
</content>
</entry>
<entry>
<title>Handle systemd socket activation, when present.</title>
<updated>2019-10-10T21:01:45+00:00</updated>
<author>
<name>Lee Duncan</name>
<email>lduncan@suse.com</email>
</author>
<published>2019-10-10T21:01:45+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/python-packages/targetcli.git/commit/?id=42f12c32063b35c44d70ab9c6c4845dc1366c313'/>
<id>42f12c32063b35c44d70ab9c6c4845dc1366c313</id>
<content type='text'>
Regular socket communications are fallen back to when
no systemd socket is present.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Regular socket communications are fallen back to when
no systemd socket is present.
</pre>
</div>
</content>
</entry>
<entry>
<title>Close socket when receiving a signal to interrupt connection.</title>
<updated>2019-10-10T20:46:36+00:00</updated>
<author>
<name>Lee Duncan</name>
<email>lduncan@suse.com</email>
</author>
<published>2019-10-10T20:46:36+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/python-packages/targetcli.git/commit/?id=f889c2dc80e7c18dea51d321ee3176d14c10d89d'/>
<id>f889c2dc80e7c18dea51d321ee3176d14c10d89d</id>
<content type='text'>
This allows the main loop to get an exception in its wait loop
when a signal arrives, rather than block forever. Before this,
topping the daemon required sending a KILL signal or sending one last
command, so that the loop could check the "received a signal" flag.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This allows the main loop to get an exception in its wait loop
when a signal arrives, rather than block forever. Before this,
topping the daemon required sending a KILL signal or sending one last
command, so that the loop could check the "received a signal" flag.
</pre>
</div>
</content>
</entry>
<entry>
<title>Exit with success when getting a signal.</title>
<updated>2019-10-10T20:35:52+00:00</updated>
<author>
<name>Lee Duncan</name>
<email>lduncan@suse.com</email>
</author>
<published>2019-10-07T22:03:12+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/python-packages/targetcli.git/commit/?id=f9b54dda4a1193c1d8acd7422e64bbc2400d3875'/>
<id>f9b54dda4a1193c1d8acd7422e64bbc2400d3875</id>
<content type='text'>
Save the error exit for unknown exits. This makes
systemd happier, since it stops us with a signal.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Save the error exit for unknown exits. This makes
systemd happier, since it stops us with a signal.
</pre>
</div>
</content>
</entry>
</feed>
