Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
K
kedifa
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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Łukasz Nowak
kedifa
Commits
617fb154
Commit
617fb154
authored
Apr 25, 2023
by
Łukasz Nowak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updater: Prepare state for more
parent
4ad201cd
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
12 deletions
+19
-12
kedifa/test.py
kedifa/test.py
+10
-10
kedifa/updater.py
kedifa/updater.py
+9
-2
No files found.
kedifa/test.py
View file @
617fb154
...
...
@@ -1386,14 +1386,14 @@ class KedifaUpdaterUpdateCertificateTest(
certificate
=
''
,
fetch
=
'content'
,
master_content
=
None
)
self
.
assertEqual
(
'content'
,
certificate
)
self
.
assertTrue
(
update
)
self
.
assertState
({
self
.
certificate_file_name
:
True
})
self
.
assertState
({
self
.
certificate_file_name
:
{
'overridden'
:
True
}
})
def
test_cert_fetch_nomaster_nofallback
(
self
):
certificate
,
update
=
self
.
_update
(
certificate
=
'old content'
,
fetch
=
'content'
,
master_content
=
None
)
self
.
assertEqual
(
'content'
,
certificate
)
self
.
assertTrue
(
update
)
self
.
assertState
({
self
.
certificate_file_name
:
True
})
self
.
assertState
({
self
.
certificate_file_name
:
{
'overridden'
:
True
}
})
def
test_nocert_nofetch_master_nofallback
(
self
):
certificate
,
update
=
self
.
_update
(
...
...
@@ -1414,14 +1414,14 @@ class KedifaUpdaterUpdateCertificateTest(
certificate
=
''
,
fetch
=
'content'
,
master_content
=
'master'
)
self
.
assertEqual
(
'content'
,
certificate
)
self
.
assertTrue
(
update
)
self
.
assertState
({
self
.
certificate_file_name
:
True
})
self
.
assertState
({
self
.
certificate_file_name
:
{
'overridden'
:
True
}
})
def
test_cert_fetch_master_nofallback
(
self
):
certificate
,
update
=
self
.
_update
(
certificate
=
'old content'
,
fetch
=
'content'
,
master_content
=
'master'
)
self
.
assertEqual
(
'content'
,
certificate
)
self
.
assertTrue
(
update
)
self
.
assertState
({
self
.
certificate_file_name
:
True
})
self
.
assertState
({
self
.
certificate_file_name
:
{
'overridden'
:
True
}
})
def
test_nocert_nofetch_nomaster_fallback
(
self
):
certificate
,
update
=
self
.
_update
(
...
...
@@ -1446,7 +1446,7 @@ class KedifaUpdaterUpdateCertificateTest(
fallback
=
'fallback'
)
self
.
assertEqual
(
'old content'
,
certificate
)
self
.
assertFalse
(
update
)
self
.
assertState
({
self
.
certificate_file_name
:
True
})
self
.
assertState
({
self
.
certificate_file_name
:
{
'overridden'
:
True
}
})
def
test_nocert_fetch_nomaster_fallback
(
self
):
certificate
,
update
=
self
.
_update
(
...
...
@@ -1454,7 +1454,7 @@ class KedifaUpdaterUpdateCertificateTest(
fallback
=
'fallback'
)
self
.
assertEqual
(
'content'
,
certificate
)
self
.
assertTrue
(
update
)
self
.
assertState
({
self
.
certificate_file_name
:
True
})
self
.
assertState
({
self
.
certificate_file_name
:
{
'overridden'
:
True
}
})
def
test_cert_fetch_nomaster_fallback
(
self
):
certificate
,
update
=
self
.
_update
(
...
...
@@ -1462,7 +1462,7 @@ class KedifaUpdaterUpdateCertificateTest(
fallback
=
'fallback'
)
self
.
assertEqual
(
'content'
,
certificate
)
self
.
assertTrue
(
update
)
self
.
assertState
({
self
.
certificate_file_name
:
True
})
self
.
assertState
({
self
.
certificate_file_name
:
{
'overridden'
:
True
}
})
def
test_nocert_nofetch_master_fallback
(
self
):
certificate
,
update
=
self
.
_update
(
...
...
@@ -1488,7 +1488,7 @@ class KedifaUpdaterUpdateCertificateTest(
fallback
=
'fallback'
)
self
.
assertEqual
(
'old content'
,
certificate
)
self
.
assertFalse
(
update
)
self
.
assertState
({
self
.
certificate_file_name
:
True
})
self
.
assertState
({
self
.
certificate_file_name
:
{
'overridden'
:
True
}
})
def
test_nocert_fetch_master_fallback
(
self
):
certificate
,
update
=
self
.
_update
(
...
...
@@ -1496,7 +1496,7 @@ class KedifaUpdaterUpdateCertificateTest(
fallback
=
'fallback'
)
self
.
assertEqual
(
'content'
,
certificate
)
self
.
assertTrue
(
update
)
self
.
assertState
({
self
.
certificate_file_name
:
True
})
self
.
assertState
({
self
.
certificate_file_name
:
{
'overridden'
:
True
}
})
def
test_cert_fetch_master_fallback
(
self
):
certificate
,
update
=
self
.
_update
(
...
...
@@ -1504,7 +1504,7 @@ class KedifaUpdaterUpdateCertificateTest(
fallback
=
'fallback'
)
self
.
assertEqual
(
'content'
,
certificate
)
self
.
assertTrue
(
update
)
self
.
assertState
({
self
.
certificate_file_name
:
True
})
self
.
assertState
({
self
.
certificate_file_name
:
{
'overridden'
:
True
}
})
class
KedifaUpdaterUpdateCertificatePrepareTest
(
...
...
kedifa/updater.py
View file @
617fb154
...
...
@@ -71,7 +71,14 @@ class Updater(object):
url
,
fallback_file
=
self
.
mapping
[
certificate_file
]
certificate
=
self
.
fetchCertificate
(
url
,
certificate_file
)
fallback_overridden
=
self
.
state_dict
.
get
(
certificate_file
,
False
)
fallback_overridden
=
self
.
state_dict
.
get
(
certificate_file
,
{})
if
isinstance
(
fallback_overridden
,
dict
):
# Support new improved mapping certificate --> information mapping
fallback_overridden
=
fallback_overridden
.
get
(
'overridden'
,
False
)
elif
certificate_file
in
self
.
state_dict
:
# Migrate to new version ASAP
self
.
state_dict
[
certificate_file
]
=
{
'overridden'
:
fallback_overridden
}
fallback
=
''
if
fallback_file
:
try
:
...
...
@@ -95,7 +102,7 @@ class Updater(object):
else
:
return
False
else
:
self
.
state_dict
[
certificate_file
]
=
True
self
.
state_dict
[
certificate_file
]
=
{
'overridden'
:
True
}
if
current
!=
certificate
:
with
open
(
certificate_file
,
'w'
)
as
fh
:
...
...
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