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
1b87f093
Commit
1b87f093
authored
Dec 11, 2012
by
Cédric de Saint Martin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleanup
parent
710b0387
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
14 deletions
+8
-14
slapprepare/slapprepare/slapupdate.py
slapprepare/slapprepare/slapupdate.py
+5
-11
upload-update.py
upload-update.py
+3
-3
No files found.
slapprepare/slapprepare/slapupdate.py
100644 → 100755
View file @
1b87f093
...
@@ -39,7 +39,7 @@ import sys
...
@@ -39,7 +39,7 @@ import sys
import
tempfile
import
tempfile
# create console handler and set level to
debu
g
# create console handler and set level to
warnin
g
ch
=
logging
.
StreamHandler
()
ch
=
logging
.
StreamHandler
()
ch
.
setLevel
(
logging
.
WARNING
)
ch
.
setLevel
(
logging
.
WARNING
)
# create formatter
# create formatter
...
@@ -60,10 +60,10 @@ class Parser(OptionParser):
...
@@ -60,10 +60,10 @@ class Parser(OptionParser):
option_list
=
[
option_list
=
[
Option
(
"--slapos-configuration"
,
Option
(
"--slapos-configuration"
,
default
=
'/etc/opt/slapos/slapos.cfg'
,
default
=
'/etc/opt/slapos/slapos.cfg'
,
help
=
"Path to slapos configuration file"
),
help
=
"Path to slapos configuration file"
),
Option
(
"--srv-file"
,
Option
(
"--srv-file"
,
default
=
'/srv/slapupdate'
,
default
=
'/srv/slapupdate'
,
help
=
"Server status file."
),
help
=
"Server status file."
),
Option
(
"-v"
,
"--verbose"
,
Option
(
"-v"
,
"--verbose"
,
default
=
False
,
default
=
False
,
action
=
"store_true"
,
action
=
"store_true"
,
...
@@ -190,7 +190,7 @@ def download_info_from_networkcache(path,slapos_conf):
...
@@ -190,7 +190,7 @@ def download_info_from_networkcache(path,slapos_conf):
if
entry
[
'timestamp'
]
>
timestamp
:
if
entry
[
'timestamp'
]
>
timestamp
:
best_entry
=
entry
best_entry
=
entry
return
best_entry
return
best_entry
return
helper_download_network_cached_to_file
(
return
helper_download_network_cached_to_file
(
path
=
path
,
path
=
path
,
directory_key
=
'slapos-upgrade'
,
directory_key
=
'slapos-upgrade'
,
...
@@ -243,7 +243,7 @@ def update_machine(config):
...
@@ -243,7 +243,7 @@ def update_machine(config):
# add ch to logger
# add ch to logger
logger
.
addHandler
(
ch
)
logger
.
addHandler
(
ch
)
# Get configuration
# Get configuration
current_state
=
ConfigParser
.
RawConfigParser
()
current_state
=
ConfigParser
.
RawConfigParser
()
current_state
.
read
(
config
.
srv_file
)
current_state
.
read
(
config
.
srv_file
)
next_state
=
ConfigParser
.
RawConfigParser
()
next_state
=
ConfigParser
.
RawConfigParser
()
...
@@ -289,10 +289,6 @@ def update_machine(config):
...
@@ -289,10 +289,6 @@ def update_machine(config):
current_state
.
set
(
'system'
,
'reboot'
,
config
.
today
.
isoformat
())
current_state
.
set
(
'system'
,
'reboot'
,
config
.
today
.
isoformat
())
save_current_state
(
current_state
,
config
)
save_current_state
(
current_state
,
config
)
os
.
system
(
'reboot'
)
os
.
system
(
'reboot'
)
# Class containing all parameters needed for configuration
# Class containing all parameters needed for configuration
...
@@ -347,8 +343,6 @@ class Config:
...
@@ -347,8 +343,6 @@ class Config:
self
.
logger
.
debug
(
"Last reboot : %s"
%
self
.
last_reboot
)
self
.
logger
.
debug
(
"Last reboot : %s"
%
self
.
last_reboot
)
self
.
logger
.
debug
(
"Last upgrade : %s"
%
self
.
last_upgrade
)
self
.
logger
.
debug
(
"Last upgrade : %s"
%
self
.
last_upgrade
)
def
main
():
def
main
():
"""Update computer and slapos"""
"""Update computer and slapos"""
...
...
upload-update.py
100644 → 100755
View file @
1b87f093
...
@@ -95,7 +95,7 @@ def upload_network_cached_from_file(path, networkcache_options):
...
@@ -95,7 +95,7 @@ def upload_network_cached_from_file(path, networkcache_options):
'timestamp'
:
time
.
time
(),
'timestamp'
:
time
.
time
(),
}
}
try
:
try
:
helper_upload_network_cached_from_file
(
if
helper_upload_network_cached_from_file
(
path
=
path
,
path
=
path
,
directory_key
=
'slapos-upgrade'
,
directory_key
=
'slapos-upgrade'
,
metadata_dict
=
metadata_dict
,
metadata_dict
=
metadata_dict
,
...
@@ -108,8 +108,8 @@ def upload_network_cached_from_file(path, networkcache_options):
...
@@ -108,8 +108,8 @@ def upload_network_cached_from_file(path, networkcache_options):
shacache_key_file
=
networkcache_options
.
get
(
'shacache-key-file'
),
shacache_key_file
=
networkcache_options
.
get
(
'shacache-key-file'
),
shadir_cert_file
=
networkcache_options
.
get
(
'shadir-cert-file'
),
shadir_cert_file
=
networkcache_options
.
get
(
'shadir-cert-file'
),
shadir_key_file
=
networkcache_options
.
get
(
'shadir-key-file'
),
shadir_key_file
=
networkcache_options
.
get
(
'shadir-key-file'
),
)
)
:
print
'Uploaded git repository
to cache.'
print
'Uploaded update file
to cache.'
except
Exception
:
except
Exception
:
print
'Unable to upload to cache:
\
n
%s.'
%
traceback
.
format_exc
()
print
'Unable to upload to cache:
\
n
%s.'
%
traceback
.
format_exc
()
...
...
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