예제 #1
0
파일: config.py 프로젝트: m0wfo/lighthouse
def save_configuration():
	global _data_dir

	# Don't write if there's no destination
	if _data_dir is None:
		return False

	rm_old_files()

	snapshot = {}
	# Get a raw copy of all data
	snapshot[ 'copy'] = data.get_copy()
	# Get current system state
	snapshot[ 'cluster'] = sync.cluster_state.get_state()

	# Write this configuration
	file_name = _data_dir + '/' +helpers.now().strftime( DATA_DIR_STRFTIME)
	with open(file_name, 'w') as f:
		f.write( helpers.dump_json( snapshot))
	return True
예제 #2
0
def save_configuration():
    global _data_dir

    # Don't write if there's no destination
    if _data_dir is None:
        return False

    rm_old_files()

    snapshot = {}
    # Get a raw copy of all data
    snapshot['copy'] = data.get_copy()
    # Get current system state
    snapshot['cluster'] = sync.cluster_state.get_state()

    # Write this configuration
    file_name = _data_dir + '/' + helpers.now().strftime(DATA_DIR_STRFTIME)
    with open(file_name, 'w') as f:
        f.write(helpers.dump_json(snapshot))
    return True
예제 #3
0
파일: server.py 프로젝트: m0wfo/lighthouse
	def get_state(self):
		""" Returns version information and cluster state. """
		response = data.get_copy( get_data=False)
		response[ 'cluster'] = sync.cluster_state.get_state()
		response[ 'Me'] = sync.cluster_state.me
		return self._response_json( response)
예제 #4
0
파일: server.py 프로젝트: m0wfo/lighthouse
	def get_copy(self):
		""" Returns raw data copy. """
		return self._response_json( data.get_copy())
예제 #5
0
 def get_state(self):
     """ Returns version information and cluster state. """
     response = data.get_copy(get_data=False)
     response['cluster'] = sync.cluster_state.get_state()
     response['Me'] = sync.cluster_state.me
     return self._response_json(response)
예제 #6
0
 def get_copy(self):
     """ Returns raw data copy. """
     return self._response_json(data.get_copy())