Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package python-redfish for openSUSE:Factory 
checked in at 2021-10-26 20:13:56
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-redfish (Old)
 and      /work/SRC/openSUSE:Factory/.python-redfish.new.1890 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-redfish"

Tue Oct 26 20:13:56 2021 rev:7 rq:927423 version:3.0.3

Changes:
--------
--- /work/SRC/openSUSE:Factory/python-redfish/python-redfish.changes    
2021-09-02 23:20:21.444556669 +0200
+++ /work/SRC/openSUSE:Factory/.python-redfish.new.1890/python-redfish.changes  
2021-10-26 20:14:40.314040808 +0200
@@ -1,0 +2,6 @@
+Mon Oct 25 21:00:45 UTC 2021 - Martin Hauke <mar...@gmx.de>
+
+- Update to version 3.0.3
+  * Added support for performing multi-part HTTP POST requests
+
+-------------------------------------------------------------------

Old:
----
  redfish-3.0.2.tar.gz

New:
----
  redfish-3.0.3.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-redfish.spec ++++++
--- /var/tmp/diff_new_pack.nRVLVZ/_old  2021-10-26 20:14:40.786041058 +0200
+++ /var/tmp/diff_new_pack.nRVLVZ/_new  2021-10-26 20:14:40.790041060 +0200
@@ -19,7 +19,7 @@
 
 %{?!python_module:%define python_module() python-%{**} python3-%{**}}
 Name:           python-redfish
-Version:        3.0.2
+Version:        3.0.3
 Release:        0
 Summary:        Redfish Python Library
 License:        BSD-3-Clause
@@ -39,6 +39,7 @@
 BuildRequires:  %{python_module jsonpointer}
 BuildRequires:  %{python_module mock}
 BuildRequires:  %{python_module pytest}
+BuildRequires:  %{python_module requests-toolbelt}
 # /SECTION
 %python_subpackages
 

++++++ redfish-3.0.2.tar.gz -> redfish-3.0.3.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-redfish-library-3.0.2/CHANGELOG.md 
new/python-redfish-library-3.0.3/CHANGELOG.md
--- old/python-redfish-library-3.0.2/CHANGELOG.md       2021-08-30 
15:43:03.000000000 +0200
+++ new/python-redfish-library-3.0.3/CHANGELOG.md       2021-10-15 
22:51:22.000000000 +0200
@@ -1,5 +1,8 @@
 # Change Log
 
+## [3.0.3] - 2021-10-15
+- Added support for performing multi-part HTTP POST requests
+
 ## [3.0.2] - 2021-08-30
 - Added support for prepending 'https://' when the provided URI of the service 
does not contain a scheme
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-redfish-library-3.0.2/CONTRIBUTING.md 
new/python-redfish-library-3.0.3/CONTRIBUTING.md
--- old/python-redfish-library-3.0.2/CONTRIBUTING.md    1970-01-01 
01:00:00.000000000 +0100
+++ new/python-redfish-library-3.0.3/CONTRIBUTING.md    2021-10-15 
22:51:22.000000000 +0200
@@ -0,0 +1,64 @@
+# Contributing
+
+## Overview
+
+This repository is maintained by the [DMTF](https://www.dmtf.org/ 
"https://www.dmtf.org/";).  All contributions are reviewed and approved by 
members of the organization.
+
+## Submitting Issues
+
+Bugs, feature requests, and questions are all submitted in the "Issues" 
section for the project.  DMTF members are responsible for triaging and 
addressing issues.
+
+## Contribution Process
+
+1. Fork the repository.
+2. Make and commit changes.
+3. Make a pull request.
+
+All contributions must adhere to the BSD 3-Clause License described in the 
LICENSE.md file, and the [Developer Certificate of 
Origin](#developer-certificate-of-origin).
+
+Pull requests are reviewed and approved by DMTF members.
+
+## Developer Certificate of Origin
+
+All contributions must adhere to the [Developer Certificate of Origin 
(DCO)](http://developercertificate.org "http://developercertificate.org";).
+
+The DCO is an attestation attached to every contribution made by every 
developer.  In the commit message of the contribution, the developer adds a 
"Signed-off-by" statement and thereby agrees to the DCO.  This can be added by 
using the `--signoff` parameter with `git commit`.
+
+Full text of the DCO:
+
+```
+Developer Certificate of Origin
+Version 1.1
+
+Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
+
+Everyone is permitted to copy and distribute verbatim copies of this
+license document, but changing it is not allowed.
+
+
+Developer's Certificate of Origin 1.1
+
+By making a contribution to this project, I certify that:
+
+(a) The contribution was created in whole or in part by me and I
+    have the right to submit it under the open source license
+    indicated in the file; or
+
+(b) The contribution is based upon previous work that, to the best
+    of my knowledge, is covered under an appropriate open source
+    license and I have the right under that license to submit that
+    work with modifications, whether created in whole or in part
+    by me, under the same open source license (unless I am
+    permitted to submit under a different license), as indicated
+    in the file; or
+
+(c) The contribution was provided directly to me by some other
+    person who certified (a), (b) or (c) and I have not modified
+    it.
+
+(d) I understand and agree that this project and the contribution
+    are public and that a record of the contribution (including all
+    personal information I submit with it, including my sign-off) is
+    maintained indefinitely and may be redistributed consistent with
+    this project or the open source license(s) involved.
+```
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/python-redfish-library-3.0.2/examples/multipart_push.py 
new/python-redfish-library-3.0.3/examples/multipart_push.py
--- old/python-redfish-library-3.0.2/examples/multipart_push.py 1970-01-01 
01:00:00.000000000 +0100
+++ new/python-redfish-library-3.0.3/examples/multipart_push.py 2021-10-15 
22:51:22.000000000 +0200
@@ -0,0 +1,43 @@
+# Copyright Notice:
+# Copyright 2016-2021 DMTF. All rights reserved.
+# License: BSD 3-Clause License. For full text see link:
+# https://github.com/DMTF/python-redfish-library/blob/master/LICENSE.md
+
+import sys
+import json
+import redfish
+
+# When running remotely connect using the address, account name, 
+# and password to send https requests
+login_host = "https://192.168.1.100";
+login_account = "admin"
+login_password = "password"
+
+## Create a REDFISH object
+REDFISH_OBJ = redfish.redfish_client(base_url=login_host, 
username=login_account,
+                          password=login_password, 
default_prefix='/redfish/v1')
+
+# Login into the server and create a session
+REDFISH_OBJ.login(auth="session")
+
+# Format parts of the Update
+headers = {'Content-Type': 'multipart/form-data'}
+body = {}
+body['UpdateParameters'] = (None, json.dumps({'Targets': 
['/redfish/v1/Managers/1'], 'Oem': {}}), 'application/json')
+body['UpdateFile'] = ('flash.bin', open('flash.bin', 'rb'), 
'application/octet-stream')
+
+# The "OemXXX" part is optional in the specification
+# Must be formatted as 3-tuple:
+# ('filename' or None, content, content-type),
+body['OemXXX'] = (None, '{"test": "value"}', 'application/json')
+body['OemXXX'] = ('extra.bin', open('extra.txt', 'rb'), 
'application/octet-stream')
+body['OemXXX'] = ('optional.txt', open('optional.txt', 'r').read(), 
'text/plain')
+
+# Perform the POST operation
+response = REDFISH_OBJ.post('/redfish/v1/upload', body=body, headers=headers)
+
+# Print out the response
+sys.stdout.write("%s\n" % response)
+
+# Logout of the current session
+REDFISH_OBJ.logout()
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-redfish-library-3.0.2/release.sh 
new/python-redfish-library-3.0.3/release.sh
--- old/python-redfish-library-3.0.2/release.sh 2021-08-30 15:43:03.000000000 
+0200
+++ new/python-redfish-library-3.0.3/release.sh 2021-10-15 22:51:22.000000000 
+0200
@@ -30,7 +30,7 @@
 
 # Commit and push changes
 git add CHANGELOG.md setup.py src/redfish/__init__.py
-git commit -m "$1 versioning"
+git commit -s -m "$1 versioning"
 git push origin master
 
 # Make new release in GitHub
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-redfish-library-3.0.2/requirements.txt 
new/python-redfish-library-3.0.3/requirements.txt
--- old/python-redfish-library-3.0.2/requirements.txt   2021-08-30 
15:43:03.000000000 +0200
+++ new/python-redfish-library-3.0.3/requirements.txt   2021-10-15 
22:51:22.000000000 +0200
@@ -2,3 +2,5 @@
 jsonpatch ; python_version >= '3.5'
 jsonpath_rw
 jsonpointer
+urllib3
+requests-toolbelt
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-redfish-library-3.0.2/setup.py 
new/python-redfish-library-3.0.3/setup.py
--- old/python-redfish-library-3.0.2/setup.py   2021-08-30 15:43:03.000000000 
+0200
+++ new/python-redfish-library-3.0.3/setup.py   2021-10-15 22:51:22.000000000 
+0200
@@ -12,7 +12,7 @@
     long_description = f.read()
 
 setup(name='redfish',
-      version='3.0.2',
+      version='3.0.3',
       description='Redfish Python Library',
       long_description=long_description,
       long_description_content_type='text/x-rst',
@@ -31,6 +31,7 @@
       install_requires=[
           'jsonpath_rw',
           'jsonpointer',
+          'requests_toolbelt',
       ],
       extras_require={
           ':python_version == "3.4"': [
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-redfish-library-3.0.2/src/redfish/__init__.py 
new/python-redfish-library-3.0.3/src/redfish/__init__.py
--- old/python-redfish-library-3.0.2/src/redfish/__init__.py    2021-08-30 
15:43:03.000000000 +0200
+++ new/python-redfish-library-3.0.3/src/redfish/__init__.py    2021-10-15 
22:51:22.000000000 +0200
@@ -6,7 +6,7 @@
 """ Redfish restful library """
 
 __all__ = ['rest', 'ris', 'discovery']
-__version__ = "3.0.2"
+__version__ = "3.0.3"
 
 from redfish.rest.v1 import redfish_client
 from redfish.rest.v1 import AuthMethod
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-redfish-library-3.0.2/src/redfish/rest/v1.py 
new/python-redfish-library-3.0.3/src/redfish/rest/v1.py
--- old/python-redfish-library-3.0.2/src/redfish/rest/v1.py     2021-08-30 
15:43:03.000000000 +0200
+++ new/python-redfish-library-3.0.3/src/redfish/rest/v1.py     2021-10-15 
22:51:22.000000000 +0200
@@ -26,6 +26,8 @@
 from io import StringIO
 from io import BytesIO
 
+from requests_toolbelt import MultipartEncoder
+
 #---------End of imports---------
 
 #---------Debug logger---------
@@ -801,8 +803,31 @@
 
         if body is not None:
             if isinstance(body, dict) or isinstance(body, list):
-                headers['Content-Type'] = 'application/json'
-                body = json.dumps(body)
+                if headers.get('Content-Type', None) == 'multipart/form-data':
+                    # Body contains part values, either as
+                    # - dict (where key is part name, and value is string)
+                    # - list of tuples (if the order is important)
+                    # - dict (where values are tuples as they would
+                    #   be provided to requests' `files` parameter)
+                    # See 
https://toolbelt.readthedocs.io/en/latest/uploading-data.html#requests_toolbelt.multipart.encoder.MultipartEncoder
+                    #
+                    # Redfish specification requires two parts:
+                    # (1) UpdateParameters (JSON formatted,
+                    #     adhering to the UpdateService Schema)
+                    # (2) UpdateFile (binary file to use for this update)
+                    #
+                    # The third part is optional: OemXXX
+                    encoder = MultipartEncoder(body)
+                    body = encoder.to_string()
+
+                    # Overwrite Content-Type, because we have to include
+                    # the boundary that the encoder generated.
+                    # Will be of the form: "multipart/form-data; boundary=abc'
+                    # where the boundary value is a UUID.
+                    headers['Content-Type'] = encoder.content_type
+                else:
+                    headers['Content-Type'] = 'application/json'
+                    body = json.dumps(body)
             elif isinstance(body, bytes):
                 headers['Content-Type'] = 'application/octet-stream'
                 body = body
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-redfish-library-3.0.2/tox.ini 
new/python-redfish-library-3.0.3/tox.ini
--- old/python-redfish-library-3.0.2/tox.ini    2021-08-30 15:43:03.000000000 
+0200
+++ new/python-redfish-library-3.0.3/tox.ini    2021-10-15 22:51:22.000000000 
+0200
@@ -9,6 +9,7 @@
     fixtures
     nose
     nose-timer
+    -rrequirements.txt
 commands =
     nosetests \
     --with-timer \
@@ -21,6 +22,7 @@
     nose
     nose-timer
     testtools >= 0.9.22, <= 2.3.0
+    -rrequirements.txt
 
 [testenv:pep8]
 basepython = python3.6

Reply via email to