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

fix(snap): fix initial configuration file install #368

Merged
merged 1 commit into from
Jan 21, 2021

Conversation

tonyespy
Copy link
Member

Signed-off-by: Tony Espy espy@canonical.com

PR Checklist

Please check if your PR fulfills the following requirements:

  • [NA] Tests for the changes have been added (for bug fixes / features)
  • [NA] Docs have been added / updated (for bug fixes / features)

If your build fails due to your commit message not passing the build checks, please review the guidelines here: https://github.com/edgexfoundry/edgex-cli/blob/master/.github/Contributing.md.

What is the current behavior?

After installing the snap, the first time edgex-cli is run, it will fail due to the client looking for sample-configuration.toml via a relative path. I missed this while testing because I built the snap and installed it from the root directory of the git repository, from which the relative path works.

Issue Number:

What is the new behavior?

Whenever the client is run via the snap, a wrapper script checks for existence of configuration.toml, and it not found, will use the sample-configuration.toml to initialize it. The wrapper will also display a message that says the configuration.toml file has been initialized and display it's full pathname (/home/<user>/snap/edge-cli/current/.edgex-cli/configuration.toml).

Does this PR introduce a breaking change?

  • Yes
  • No

New Imports

  • Yes
  • No

Specific Instructions

Are there any specific instructions or things that should be known prior to reviewing?
No

Other information

Signed-off-by: Tony Espy <espy@canonical.com>
@codecov-io
Copy link

Codecov Report

Merging #368 (63f3b1c) into master (8abde03) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #368   +/-   ##
=======================================
  Coverage   24.71%   24.71%           
=======================================
  Files           3        3           
  Lines          89       89           
=======================================
  Hits           22       22           
  Misses         62       62           
  Partials        5        5           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8abde03...63f3b1c. Read the comment docs.

Copy link

@siggiskulason siggiskulason left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM
I can confirm that the previous version fails:

$ snap install edgex-cli --edge
edgex-cli (edge) v2.0.0-dev.11 from Canonical✓ installed
sidar@siggi-xps:~$ edgex-cli
failed to create configuration file '/home/sidar/snap/edgex-cli/132/.edgex-cli/configuration.toml'. 
 stat ../res/sample-configuration.toml: no such file or directory
 stat ./res/sample-configuration.toml: no such file or directory
$ cd ~/go/src/github.com/edgexfoundry/edgex-cli/
$ edgex-cli
Configuration file /home/sidar/snap/edgex-cli/132/.edgex-cli/configuration.toml created

With this update however it works:

$ snap remove edgex-cli
edgex-cli removed
$ snap install --dangerous ./edgex-cli_local-dev_amd64.snap 
edgex-cli local-dev installed
$ cd
$ edgex-cli
Created /home/sidar/snap/edgex-cli/x1/.edgex-cli/configuration.toml from sample configuration file.

@difince difince self-requested a review January 21, 2021 09:00
Copy link
Contributor

@difince difince left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tonyespy Thank you for the fix
I have validated the fix
LGTM

@difince difince merged commit 1f3ac9c into edgexfoundry:master Jan 21, 2021
@tonyespy tonyespy deleted the fix-snap-config branch March 2, 2021 15:59
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.

4 participants