Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

232 micka accepted version #514

Merged
merged 2 commits into from
Nov 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
### Changes
- [#169](https://github.com/LayerManager/layman/issues/169) [POST Workspace Layers](doc/rest.md#post-workspace-layers) accepts also compressed data files in ZIP format (`*.zip`) in `file` parameter. [PATCH Workspace Layer](doc/rest.md#patch-workspace-layer) accepts also data file in ZIP format (`*.zip`) in `file` parameter.
- [#503](https://github.com/LayerManager/layman/issues/503) Normalized GeoTIFF for raster files are also compressed.
- [#232](https://github.com/LayerManager/layman/issues/232) Prefixes '>=' or '==' can be used in [MICKA_ACCEPTED_VERSION](doc/env-settings.md#micka_accepted_version).
- [#169](https://github.com/LayerManager/layman/issues/169) [GET Workspace Layer](doc/rest.md#get-workspace-layer) returns path to main file inside archive if zipped file was sent (key `file.path`).
- [#465](https://github.com/LayerManager/layman/issues/465) Fix situation, when Layman does not start if *.qgis file of the first layer with QML style does not exist. It was already fixed in v1.14.1.
- [#464](https://github.com/LayerManager/layman/issues/464) Fix publishing layers with unusual attribute names (e.g. `x,` or `Číslo`) and QML styles. It was already fixed in v1.14.1.
Expand Down
2 changes: 1 addition & 1 deletion doc/env-settings.md
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ Internal URL of [OGC Catalogue Service v2.0.2](https://www.opengeospatial.org/st
Public URL of [OGC Catalogue Service v2.0.2](https://www.opengeospatial.org/standards/cat) endpoint. Tested with [Micka](http://micka.bnhelp.cz/).

### MICKA_ACCEPTED_VERSION
Version of Micka that Layman will accept on startup encoded as `version:revision`, e.g. `2020.014:2020-04-15.01`. If it is not set, a version defined in [LAYMAN_SETTINGS_MODULE](#LAYMAN_SETTINGS_MODULE) will be accepted.
Version of Micka that Layman will accept on startup encoded as `version:revision`, e.g. `2020.014:2020-04-15.01`. Also, on one of '>=' or '==' prefixes can be used with obvious meaning, `e.g. >=2020.014:2020-04-15.01`. For prefix '>=', version and revision are compared independently as strings. If the variable is not set, a version defined in [LAYMAN_SETTINGS_MODULE](#LAYMAN_SETTINGS_MODULE) will be accepted. If none prefix is used, value is compared as with '=='.

### MICKA_HOSTPORT
String with public domain and optionally port, e.g. `<domain>` or `<domain>:<port>`. Passed as configuration to Micka for demo purposes.
Expand Down
11 changes: 6 additions & 5 deletions src/layman_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,11 +203,12 @@
CSW_RECORD_URL = os.getenv('CSW_RECORD_URL', None)

# # tuples like (version, revision)
MICKA_ACCEPTED_VERSIONS = [
('2020.014', '2020-04-15.01'),
] if ':' not in os.getenv('MICKA_ACCEPTED_VERSION', '') else [
tuple(os.environ['MICKA_ACCEPTED_VERSION'].split(':'))
]
MICKA_REGEXP = r"^(?P<operation>==|>=|)(?P<version>[0-9.]+):(?P<revision>[0-9-.]+)$"
MICKA_REGEXP_MATCH = re.search(MICKA_REGEXP, os.getenv('MICKA_ACCEPTED_VERSION', None) or '==2020.014:2020-04-15.01')
assert MICKA_REGEXP_MATCH, f'os.getenv(MICKA_ACCEPTED_VERSION)={os.getenv("MICKA_ACCEPTED_VERSION", "")}, MICKA_REGEXP_MATCH={MICKA_REGEXP_MATCH}'
assert len(
MICKA_REGEXP_MATCH.groups()) == 3, f'os.getenv(MICKA_ACCEPTED_VERSION)={os.getenv("MICKA_ACCEPTED_VERSION", "")}, MICKA_REGEXP_MATCH={MICKA_REGEXP_MATCH}'
MICKA_ACCEPTED_VERSION = MICKA_REGEXP_MATCH.groups()

LAYMAN_PUBLIC_URL_SCHEME = urlparse(LAYMAN_CLIENT_PUBLIC_URL).scheme

Expand Down
8 changes: 7 additions & 1 deletion src/wait_for_deps.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,13 @@ def main():
version_match = re.search(MICKA_VERSION_RE, response)
assert (version_match and len(version_match.groups()) == 2), 'Unknown version of Micka!'
found_version = version_match.groups()
assert found_version in settings.MICKA_ACCEPTED_VERSIONS, f"Found Micka version {found_version}, but expecting one of {settings.MICKA_ACCEPTED_VERSIONS}. Please use one of expected version, e.g. by upgrading/downgrading Micka. Take special care about Micka's database."
err_message = f"Found Micka version {found_version}, but expecting version fulfilling {settings.MICKA_ACCEPTED_VERSION}. Please use one of expected version, e.g. by upgrading/downgrading Micka. Take special care about Micka's database."
if settings.MICKA_ACCEPTED_VERSION[0] == '>=':
assert found_version[0] >= settings.MICKA_ACCEPTED_VERSION[1] and found_version[1] >= settings.MICKA_ACCEPTED_VERSION[2], err_message
elif settings.MICKA_ACCEPTED_VERSION[0] in ('==', ''):
assert found_version == settings.MICKA_ACCEPTED_VERSION[1:], err_message
else:
raise NotImplementedError(f"Unknown Micka version comparision: {settings.MICKA_ACCEPTED_VERSION[0]}")
print(f"Found Micka version {found_version}.")

print(f"Attempt {attempt}/{MAX_ATTEMPTS} successful.")
Expand Down