summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniil Baturin <daniil@baturin.org>2018-06-08 20:50:12 +0200
committerDaniil Baturin <daniil@baturin.org>2018-06-08 20:50:12 +0200
commite916c9a55ffdff970c1796829d1bee319802b353 (patch)
tree85288e18fa3d93e6031472bb2ca66528f6778db1
parent6acc5f6cb03f553141b0442f5e01cbf47b8e7833 (diff)
downloadvyos-1x-e916c9a55ffdff970c1796829d1bee319802b353.tar.gz
vyos-1x-e916c9a55ffdff970c1796829d1bee319802b353.zip
Move the version.json file used by newer code to /usr/share/vyos
-rw-r--r--python/vyos/defaults.py3
-rw-r--r--python/vyos/version.py7
2 files changed, 9 insertions, 1 deletions
diff --git a/python/vyos/defaults.py b/python/vyos/defaults.py
new file mode 100644
index 000000000..43f222cc7
--- /dev/null
+++ b/python/vyos/defaults.py
@@ -0,0 +1,3 @@
+directories = {
+ "data": "/usr/share/vyos/"
+}
diff --git a/python/vyos/version.py b/python/vyos/version.py
index 5d32d878d..545d4e76b 100644
--- a/python/vyos/version.py
+++ b/python/vyos/version.py
@@ -17,9 +17,14 @@
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
# IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+import os
import json
-def get_version_data(file='/opt/vyatta/etc/version.json'):
+import vyos.defaults
+
+version_file = os.path.join(vyos.defaults.directories['data'], 'version.json')
+
+def get_version_data(file=version_file):
with open(file, 'r') as f:
version_data = json.load(f)
return version_data