Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add high-level add_target_and_write_to_live() functions to demo code #42

Merged
merged 2 commits into from
Apr 10, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions demo/demo_director.py
Original file line number Diff line number Diff line change
@@ -465,6 +465,29 @@ def clear_vehicle_targets(vin):



def add_target_and_write_to_live(filename, file_content, vin, ecu_serial):
"""
High-level version of add_target_to_director() that creates 'filename'
and writes the changes to the live directory repository.
"""

# Create 'filename' in the current working directory, but it should
# ideally be to a temporary destination. The demo code will eventually
# be modified to use temporary directories (which will cleaned up after
# running the demo code).
with open(filename, 'w') as file_object:
file_object.write(file_content.decode('utf-8'))

# The path that will identify the file in the repository.
filepath_in_repo = filename

add_target_to_director(filename, filepath_in_repo, vin, ecu_serial)
write_to_live()





def kill_server():

global repo_server_process
21 changes: 21 additions & 0 deletions demo/demo_oem_repo.py
Original file line number Diff line number Diff line change
@@ -274,6 +274,27 @@ def listen():



def add_target_and_write_to_live(filename, file_content):
"""
High-level version of add_target_to_oemrepo() that creates the target
file, and writes the changes to the live repository.
"""

# Create 'filename' in the current working directory, but it should
# ideally be to a temporary destination. The demo code will eventually
# be modified to use temporary directories (which will cleaned up after
# running demo code).
with open(filename, 'w') as file_object:
file_object.write(file_content.decode('utf-8'))

filepath_in_repo = filename
add_target_to_oemrepo(filename, filepath_in_repo)
write_to_live()





def kill_server():
global server_process
if server_process is None: