Skip to content

Commit

Permalink
Docs improvements, fix camelCasing of the tls validation option in O…
Browse files Browse the repository at this point in the history
…nedata file source plugin
  • Loading branch information
lopiola authored and bwalkowi committed Mar 6, 2024
1 parent bf8db0c commit cdca217
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 28 deletions.
4 changes: 3 additions & 1 deletion lib/galaxy/config/sample/file_sources_conf.yml.sample
Original file line number Diff line number Diff line change
Expand Up @@ -207,10 +207,12 @@
label: Invenio RDM Demo Repository
url: https://inveniordm.web.cern.ch/

# Note for developers: you can easily set up a minimal, dockerized Onedata environment
# using the so-called "demo-mode": https://onedata.org/#/home/documentation/topic/stable/demo-mode
- type: onedata
id: onedata1
label: Onedata
doc: Your Onedata files - configure an access token via user preferences
accessToken: ${user.preferences['onedata|access_token']}
onezoneDomain: ${user.preferences['onedata|onezone_domain']}
disable_tls_certificate_validation: ${user.preferences['onedata|disable_tls_certificate_validation']}
disableTlsCertificateValidation: ${user.preferences['onedata|disable_tls_certificate_validation']}
24 changes: 14 additions & 10 deletions lib/galaxy/config/sample/object_store_conf.xml.sample
Original file line number Diff line number Diff line change
Expand Up @@ -157,29 +157,33 @@
<!--
Sample Onedata Object Store
Note for developers: you can easily set up a minimal, dockerized Onedata environment
using the so-called "demo-mode": https://onedata.org/#/home/documentation/topic/stable/demo-mode
Onedata specific options:
//auth/@access_token - an access token suitable for data access
(allowing calls to the Oneprovider REST API).
//auth/@access_token -
an access token suitable for data access (allowing calls to the Oneprovider REST API).
//connection/@onezone_domain - Domain of the Onezone service
(e.g. "demo.onedata.org").
//connection/@onezone_domain -
the domain of the Onezone service (e.g. "demo.onedata.org"), or its IP address for
devel instances (see above).
//connection/@disable_tls_certificate_validation -
Allows connection to Onedata servers that do not present trusted SSL certificates.
SHOULD NOT be used unless you really know what you are doing.
//space/@name - name of the Onedata space where the Galaxy data will
be stored.
//space/@name -
the name of the Onedata space where the Galaxy data will be stored.
//space/@path - relative directory path in space under which the Galaxy data
will be stored. Optional, if not provided, data will be stored
in the root of space.
//space/@path -
the relative directory path in the space under which the Galaxy data will be stored.
Optional, if not provided, the data will be stored in the root of space.
-->
<!--
<object_store type="onedata">
<auth access_token="..." />
<connection onezone_domain="demo.onedata.org" disable_tls_certificate_validation="False"/>
<space name="krk-p" path="galaxy-data" />
<space name="demo-space" path="galaxy-data" />
<cache path="database/object_store_cache" size="1000" cache_updated_data="True" />
<extra_dir type="job_work" path="database/job_working_directory_onedata"/>
<extra_dir type="temp" path="database/tmp_onedata"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ preferences:
type: password
required: False
- name: disable_tls_certificate_validation
label: Allows connection to Onedata servers that do not present trusted SSL certificates. SHOULD NOT be used unless you really know what you are doing.
label: Allow connection to Onedata servers that do not present trusted SSL certificates. SHOULD NOT be used unless you really know what you are doing.
type: boolean
required: False
value: False
4 changes: 2 additions & 2 deletions lib/galaxy/dependencies/conditional-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ fs.googledrivefs # type: googledrive
fs-gcsfs # type: googlecloudstorage
# fs-gcsfs doesn't pin google-cloud-storage, and old versions log noisy exceptions and break test discovery
google-cloud-storage>=2.8.0 # type: googlecloudstorage
fs.onedatarestfs # type: onedata
fs.onedatarestfs # type: onedata, depends on onedatafilerestclient
fs-basespace # type: basespace

# Vault backend
Expand All @@ -40,7 +40,7 @@ pykube-ng==21.3.0
# Synnefo / Pithos+ object store client
kamaki

# Onedata object store client
# Onedata REST-based client for data access, required by the Onedata object store
onedatafilerestclient

watchdog
Expand Down
2 changes: 1 addition & 1 deletion lib/galaxy/files/sources/onedata.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def _open_fs(self, user_context=None, opts: Optional[FilesSourceOptions] = None)
onezone_domain = remove_prefix("http://", remove_prefix("https://", onezone_domain))
access_token = props.pop("accessToken", "") or ""
disable_tls_certificate_validation = (
props.pop("disable_tls_certificate_validation", False) or False)
props.pop("disableTlsCertificateValidation", False) or False)
handle = OnedataRESTFS(onezone_domain,
access_token,
verify_ssl=not disable_tls_certificate_validation)
Expand Down
28 changes: 15 additions & 13 deletions test/integration/objectstore/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@
"""
)

# Onedata setup for the test is done according to this documentation:
# https://onedata.org/#/home/documentation/topic/stable/demo-mode
ONEDATA_DEMO_SPACE_NAME = "demo-space"
ONEDATA_OBJECT_STORE_CONFIG = string.Template("""
<object_store type="onedata">
Expand Down Expand Up @@ -235,7 +237,7 @@ def setUpClass(cls):

start_onezone(cls.oz_container_name)

oz_ip_address = get_onezone_ip_address(cls.oz_container_name)
oz_ip_address = docker_ip_address(cls.oz_container_name)
start_oneprovider(cls.op_container_name, oz_ip_address)
await_oneprovider_demo_readiness(cls.op_container_name)

Expand Down Expand Up @@ -264,7 +266,7 @@ def handle_galaxy_config_kwds(cls, config):
{
"temp_directory": temp_directory,
"access_token": get_onedata_access_token(cls.oz_container_name),
"onezone_domain": get_onezone_ip_address(cls.oz_container_name),
"onezone_domain": docker_ip_address(cls.oz_container_name),
"space_name": ONEDATA_DEMO_SPACE_NAME,
"optional_space_params": random.choice([
'',
Expand Down Expand Up @@ -295,17 +297,6 @@ def start_onezone(oz_container_name):
docker_run("onedata/onezone:21.02.5-dev", oz_container_name, "demo")


def get_onezone_ip_address(oz_container_name):
cmd = [
"docker",
"inspect",
'-f',
'{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}',
oz_container_name,
]
return subprocess.check_output(cmd).decode('utf-8').strip()


def start_oneprovider(op_container_name, oz_ip_address):
docker_run("onedata/oneprovider:21.02.5-dev", op_container_name, "demo", oz_ip_address)

Expand Down Expand Up @@ -349,5 +340,16 @@ def docker_exec(container_name, *args, output=True):
subprocess.check_call(cmd)


def docker_ip_address(container_name):
cmd = [
"docker",
"inspect",
'-f',
'{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}',
container_name,
]
return subprocess.check_output(cmd).decode('utf-8').strip()


def docker_rm(container_name):
subprocess.check_call(["docker", "rm", "-f", container_name])

0 comments on commit cdca217

Please sign in to comment.