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
Arnaud Véron
slapos.package
Commits
4e1ba863
Commit
4e1ba863
authored
Jun 05, 2014
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Follow up change on slapos.libnetworkcache
parent
ea6c7286
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
4 deletions
+29
-4
setup.py
setup.py
+2
-2
slapos/package/signature.py
slapos/package/signature.py
+27
-2
No files found.
setup.py
View file @
4e1ba863
from
setuptools
import
setup
,
find_packages
from
setuptools
import
setup
,
find_packages
version
=
'0.1.
1
'
version
=
'0.1.
2
'
name
=
'slapos.package'
name
=
'slapos.package'
long_description
=
open
(
"README.txt"
).
read
()
+
"
\
n
"
+
\
long_description
=
open
(
"README.txt"
).
read
()
+
"
\
n
"
+
\
open
(
"CHANGES.txt"
).
read
()
+
"
\
n
"
open
(
"CHANGES.txt"
).
read
()
+
"
\
n
"
...
@@ -20,7 +20,7 @@ setup(name=name,
...
@@ -20,7 +20,7 @@ setup(name=name,
packages
=
find_packages
(),
packages
=
find_packages
(),
include_package_data
=
True
,
include_package_data
=
True
,
install_requires
=
[
install_requires
=
[
'slapos.libnetworkcache'
,
'slapos.libnetworkcache
>=0.14.1
'
,
'iniparse'
,
'iniparse'
,
],
],
zip_safe
=
False
,
zip_safe
=
False
,
...
...
slapos/package/signature.py
View file @
4e1ba863
...
@@ -36,9 +36,34 @@ import tempfile
...
@@ -36,9 +36,34 @@ import tempfile
import
datetime
import
datetime
from
slapos.networkcachehelper
import
helper_download_network_cached_to_file
from
slapos.networkcachehelper
import
helper_download_network_cached_to_file
from
slapos.networkcachehelper
import
helper_upload_network_cached_from_file
from
slapos.networkcachehelper
import
NetworkcacheClient
def
helper_upload_network_cached_from_file
(
dir_url
,
cache_url
,
path
,
directory_key
,
metadata_dict
,
signature_private_key_file
,
shacache_cert_file
,
shacache_key_file
,
shadir_cert_file
,
shadir_key_file
):
"""
Upload an existing file, using a file_descriptor.
"""
file_descriptor
=
open
(
path
,
'r'
)
if
not
(
dir_url
and
cache_url
):
return
False
# backward compatibility
metadata_dict
.
setdefault
(
'file'
,
'notused'
)
metadata_dict
.
setdefault
(
'urlmd5'
,
'notused'
)
# convert '' into None in order to call nc nicely
with
NetworkcacheClient
(
cache_url
,
dir_url
,
signature_private_key_file
=
signature_private_key_file
or
None
,
shacache_cert_file
=
shacache_cert_file
or
None
,
shacache_key_file
=
shacache_key_file
or
None
,
shadir_cert_file
=
shadir_cert_file
or
None
,
shadir_key_file
=
shadir_key_file
or
None
,
)
as
nc
:
return
nc
.
upload
(
file_descriptor
,
directory_key
,
**
metadata_dict
)
class
NetworkCache
:
class
NetworkCache
:
def
__init__
(
self
,
configuration_path
):
def
__init__
(
self
,
configuration_path
):
if
not
os
.
path
.
exists
(
configuration_path
):
if
not
os
.
path
.
exists
(
configuration_path
):
...
...
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