Project

Profile

Help

Task #7374

create script for relevance check given *network_config file

Added by Mark Zaslavskiy about 4 years ago. Updated about 4 years ago.

Status:
Closed
Priority:
High
Assignee:
Timofey Turenko
Category:
mdbci features
Sprint/Milestone:
Start date:
11.08.2016
Due date:
% Done:

100%

Estimated time:
2:00 h
Spent time:
Target branch:
Test scenario:

https://github.com/OSLL/mdbci/tree/7374_check_relevance_network_config_file
https://github.com/OSLL/mdbci/pull/282
# 1. Generate node (echo $? => 0)
./mdbci --template confs/docker_lite.json generate SOME_DIR

# 2. Up nodes (echo $? => 0).
./mdbci up SOME_DIR

# 3. It will be SOME_DIR_network_config file In repo directory.

# 4. Run script:
scripts/check_network_config.sh SOME_DIR_network_config

OR

./mdbci check_relevance SOME_DIR_network_config

# Variants and results
0) not created machines\network config file missed:
SOME_DIR_network_config not found!

1) ./mdbci up SOME_DIR
SOME_DIR_network_config is relevant
echo &? =>0

2) vagrant up node0
SOME_DIR_network_config is NOT relevant
echo $? =>1

3) ./mdbci up SOME_DIR | vagrant destroy node0
SOME_DIR_network_config is relevant
echo &? =>0

4) ./mdbci up SOME_DIR | vagrant destroy node0 | vagrant up node0
SOME_DIR_network_config is NOT relevant
echo $? =>1

5) ./mdbci up SOME_DIR | vagrant destroy -f
SOME_DIR_network_config is NOT relevant: all nodes destroyed
echo $? =>1


Description

- arguments: *network_config file full name
- output:
-- If <config>/.vagrant update date is not older than update date for *network_config then
--- echo "<file name> is relevant" and return exit code 0
-- else
--- echo "<file name> is not relevant " and return exit code 1

History

#1 Updated by Mark Zaslavskiy about 4 years ago

  • Priority changed from Normal to High

#2 Updated by Ilfat Kinyaev about 4 years ago

  • Estimated time set to 2:00 h

NOTE: Up nodes with mdbci up and vagrant up and check .vagrant file update time.

#3 Updated by Ilfat Kinyaev about 4 years ago

  • Status changed from New to Active / In progress

#4 Updated by Ilfat Kinyaev about 4 years ago

It only some files in .vagrant/machines/node0/docker/ will change when node ups. For example chose file "id".
./mdbci up SOME_DIR
stat --format=%y SOME_DIR/.vagrant/machines/*/*/id
2016-08-14 17:08:06.089068659 +0200
2016-08-14 17:09:39.913069436 +0200
2016-08-14 17:05:38.721067440 +0200

stat --format=%y SOME_DIR_network_config
2016-08-14 17:11:06.833070155 +0200

#5 Updated by Ilfat Kinyaev about 4 years ago

  • Status changed from Active / In progress to Review
  • Assignee changed from Ilfat Kinyaev to Mark Zaslavskiy
  • % Done changed from 0 to 100
  • Test scenario updated (diff)

#6 Updated by Ilfat Kinyaev about 4 years ago

  • Test scenario updated (diff)

#7 Updated by Ilfat Kinyaev about 4 years ago

  • Test scenario updated (diff)

#8 Updated by Mark Zaslavskiy about 4 years ago

  • Status changed from Review to New
  • Assignee changed from Mark Zaslavskiy to Ilfat Kinyaev

Comments in pull-request.

#9 Updated by Ilfat Kinyaev about 4 years ago

  • Status changed from New to Active / In progress

#10 Updated by Ilfat Kinyaev about 4 years ago

  • Status changed from Active / In progress to Review
  • Assignee changed from Ilfat Kinyaev to Mark Zaslavskiy

Fixed by comments.
NOTE: when all nodes destroyed, script can write:
find: ‘SOME_DIR/.vagrant/machines/*/*/id’: No such file or directory
SOME_DIR_network_config is NOT relevant: all nodes destroyed

#11 Updated by Mark Zaslavskiy about 4 years ago

  • Status changed from Review to Testing
  • Assignee changed from Mark Zaslavskiy to Timofey Turenko

#12 Updated by Timofey Turenko about 4 years ago

  • Status changed from Testing to Review
  • Assignee changed from Timofey Turenko to Mark Zaslavskiy

test:

cd aug06
vagrant halt
vagrant up
cd ..
./scripts/check_network_config.sh aug06_network_config

result:
aug06_network_config is relevant

Manual checking of .vagrant directory: all files except 'synced_folders' have old date and only 'synced_folders' has new date

#13 Updated by Mark Zaslavskiy about 4 years ago

Add this script call as mdbci command "check_relevance"

#14 Updated by Mark Zaslavskiy about 4 years ago

  • Status changed from Review to New
  • Assignee changed from Mark Zaslavskiy to Ilfat Kinyaev

#15 Updated by Ilfat Kinyaev about 4 years ago

  • Status changed from New to Active / In progress

#16 Updated by Ilfat Kinyaev about 4 years ago

  • Test scenario updated (diff)

Timofey Turenko wrote:

test:

cd aug06
vagrant halt
vagrant up
cd ..
./scripts/check_network_config.sh aug06_network_config

result:
aug06_network_config is relevant

Manual checking of .vagrant directory: all files except 'synced_folders' have old date and only 'synced_folders' has new date

'synced_folders' and 'action_provision' folders will have new date of acess time at halt\up.
For clear results, check access and modify time.
NOTE: Maybe it not correct compare with access time?
https://github.com/OSLL/mdbci/pull/282

#17 Updated by Ilfat Kinyaev about 4 years ago

  • Status changed from Active / In progress to Review
  • Assignee changed from Ilfat Kinyaev to Mark Zaslavskiy

#18 Updated by Mark Zaslavskiy about 4 years ago

  • Status changed from Review to Testing
  • Assignee changed from Mark Zaslavskiy to Timofey Turenko

#19 Updated by Timofey Turenko about 4 years ago

script works, but mdbci command does not:


turenko@turenko-home:~/mdbci$ ./mdbci validate_template --template aug06
 INFO:  MariaDb CI CLI
 INFO:  mdbci called with: ["validate_template"]
 INFO:  Checking this machine configuration requirments
 INFO:  .....NOT IMPLEMENTED YET
 INFO:  Load Boxes from ./BOXES
 INFO:  Loaded boxes: 49
 INFO:  Load AWS config from aws-config.yml
 INFO:  Load Repos from ./repo.d
 INFO:  Looking up for repos ./repo.d
 INFO:  Loaded repos: 754
ERROR:  /home/turenko/mdbci/core/session.rb:372:in `read'
/home/turenko/mdbci/core/session.rb:372:in `validate_template'
/home/turenko/mdbci/core/session.rb:447:in `commands'
./mdbci:128:in `<main>'
ERROR:  Is a directory @ io_fread - aug06
turenko@turenko-home:~/mdbci$ ./mdbci validate_template --template aug06_network_config
 INFO:  MariaDb CI CLI
 INFO:  mdbci called with: ["validate_template"]
 INFO:  Checking this machine configuration requirments
 INFO:  .....NOT IMPLEMENTED YET
 INFO:  Load Boxes from ./BOXES
 INFO:  Loaded boxes: 49
 INFO:  Load AWS config from aws-config.yml
 INFO:  Load Repos from ./repo.d
 INFO:  Looking up for repos ./repo.d
 INFO:  Loaded repos: 754
ERROR:  /usr/lib/ruby/2.3.0/json/common.rb:156:in `parse'
/usr/lib/ruby/2.3.0/json/common.rb:156:in `parse'
/home/turenko/mdbci/core/session.rb:372:in `validate_template'
/home/turenko/mdbci/core/session.rb:447:in `commands'
./mdbci:128:in `<main>'
ERROR:  784: unexpected token at 'node_000_network=192.168.121.105
node_000_keyfile="/home/turenko/mdbci/aug06/.vagrant/machines/node_000/libvirt/private_key" 
node_000_private_ip=192.168.121.105
node_000_whoami=vagrant
node_000_hostname=node000
node_001_network=192.168.121.173
node_001_keyfile="/home/turenko/mdbci/aug06/.vagrant/machines/node_001/libvirt/private_key" 
node_001_private_ip=192.168.121.173
node_001_whoami=vagrant
node_001_hostname=node001
node_002_network=192.168.121.190
node_002_keyfile="/home/turenko/mdbci/aug06/.vagrant/machines/node_002/libvirt/private_key" 
node_002_private_ip=192.168.121.190
node_002_whoami=vagrant
node_002_hostname=node002
node_003_network=192.168.121.31
node_003_keyfile="/home/turenko/mdbci/aug06/.vagrant/machines/node_003/libvirt/private_key" 
node_003_private_ip=192.168.121.31
node_003_whoami=vagrant
node_003_hostname=node003
galera_000_network=192.168.121.136
galera_000_keyfile="/home/turenko/mdbci/aug06/.vagrant/machines/galera_000/libvirt/private_key" 
galera_000_private_ip=192.168.121.136
galera_000_whoami=vagrant
galera_000_hostname=galera000
galera_001_network=192.168.121.19
galera_001_keyfile="/home/turenko/mdbci/aug06/.vagrant/machines/galera_001/libvirt/private_key" 
galera_001_private_ip=192.168.121.19
galera_001_whoami=vagrant
galera_001_hostname=galera001
galera_002_network=192.168.121.150
galera_002_keyfile="/home/turenko/mdbci/aug06/.vagrant/machines/galera_002/libvirt/private_key" 
galera_002_private_ip=192.168.121.150
galera_002_whoami=vagrant
galera_002_hostname=galera002
galera_003_network=192.168.121.32
galera_003_keyfile="/home/turenko/mdbci/aug06/.vagrant/machines/galera_003/libvirt/private_key" 
galera_003_private_ip=192.168.121.32
galera_003_whoami=vagrant
galera_003_hostname=galera003
maxscale_network=192.168.121.33
maxscale_keyfile="/home/turenko/mdbci/aug06/.vagrant/machines/maxscale/libvirt/private_key" 
maxscale_private_ip=192.168.121.33
maxscale_whoami=vagrant
maxscale_hostname=maxscale
'
turenko@turenko-home:~/mdbci$ 

#20 Updated by Timofey Turenko about 4 years ago

  • Assignee changed from Timofey Turenko to Mark Zaslavskiy

#21 Updated by Mark Zaslavskiy about 4 years ago

  • Assignee changed from Mark Zaslavskiy to Timofey Turenko
  • Test scenario updated (diff)

MDBCI command for checking relevance of the network_config works in the following way:

./mdbci check_relevance aug06_network_config

#22 Updated by Timofey Turenko about 4 years ago

  • Status changed from Testing to Closed

Also available in: Atom PDF