Skip to content
This repository has been archived by the owner on Oct 23, 2023. It is now read-only.

Move env file to parent directory to avoid conflict with config provider #83

Merged
merged 2 commits into from
Mar 14, 2023

Conversation

farshidtz
Copy link
Member

@farshidtz farshidtz commented Mar 13, 2023

Testing instructions

Reproduce the error

Install device virtual (edge) and connect the config provider.
Set a snap option (example: snap set edgex-device-virtual config.writable-loglevel=DEBUG)
Look for expected error: could not process config options: failed to remove env file: unlinkat /var/snap/edgex-device-mqtt/2762/config/device-mqtt/res/device-virtual.env: read-only file system

Test

Build from edgexfoundry/device-virtual-go#354
Connect the config provider.

Use:

$ snap set edgex-device-virtual config.writable-loglevel=DEBUG
$ cat /var/snap/edgex-device-virtual/current/config/device-virtual/overrides.env 
# System-generated list of environment variables from snap options
WRITABLE_LOGLEVEL="DEBUG"

@farshidtz farshidtz requested a review from MonicaisHer March 13, 2023 16:03
@MonicaisHer
Copy link
Contributor

I have installed the device virtual build with the PR's snap hook and connected it to the config provider. However, the files from the config provider have not been copied to the device-virtual:

$ snap install ./edgex-device-virtual_3.0.0-dev.21_amd64.snap --dangerous
$ tree /var/snap/edgex-device-virtual/current
/var/snap/edgex-device-virtual/current
└── config
    └── device-virtual
        └── res
            ├── configuration.toml
            ├── devices
            │   └── devices.toml
            └── profiles
                ├── device.virtual.binary.yaml
                ├── device.virtual.bool.yaml
                ├── device.virtual.float.yaml
                ├── device.virtual.int.yaml
                └── device.virtual.uint.yaml

5 directories, 7 files

$ snap install edgex-config-provider-example --edge
$ sudo snap connect edgex-device-virtual:device-virtual-config edgex-config-provider-example:device-virtual-config
$ tree /var/snap/edgex-device-virtual/current
/var/snap/edgex-device-virtual/current
└── config
    └── device-virtual
        └── res
            ├── configuration.toml
            ├── devices
            │   └── devices.toml
            └── profiles
                ├── device.virtual.binary.yaml
                ├── device.virtual.bool.yaml
                ├── device.virtual.float.yaml
                ├── device.virtual.int.yaml
                └── device.virtual.uint.yaml

5 directories, 7 files

@farshidtz
Copy link
Member Author

I have installed the device virtual build with the PR's snap hook and connected it to the config provider. However, the files from the config provider have not been copied to the device-virtual:

The mounted files are only visible to the snap. See https://github.com/canonical/edgex-config-provider#list-mounted-files

@farshidtz farshidtz merged commit c475cb7 into main Mar 14, 2023
@farshidtz farshidtz deleted the change-env-file-path branch March 14, 2023 12:45
MonicaisHer added a commit to MonicaisHer/device-mqtt-go that referenced this pull request Mar 17, 2023
…directory

Changes to incorporate the following fixes:
- canonical/edgex-snap-hooks#83
- canonical/edgex-snap-hooks#82

Signed-off-by: Mengyi Wang <mengyi.wang@canonical.com>
MonicaisHer added a commit to MonicaisHer/app-rfid-llrp-inventory that referenced this pull request Mar 17, 2023
…directory

Changes to incorporate the following fixes:
- canonical/edgex-snap-hooks#83
- canonical/edgex-snap-hooks#82

Signed-off-by: Mengyi Wang <mengyi.wang@canonical.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants