Skip to content

Commit

Permalink
3.0 fix some bugs (#641)
Browse files Browse the repository at this point in the history
* fix: conf path

* fix: conf path

* remote_client support strict_host_key_checking

* Clean rca old *scene.py files

* fix some bugs
  • Loading branch information
wayyoungboy authored Dec 19, 2024
1 parent 9df94b7 commit 8cbe96f
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 15 deletions.
2 changes: 1 addition & 1 deletion rpm/init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ mkdir -p ${OBDIAG_HOME}/log
mkdir -p ${OBDIAG_HOME}/display

# Clean rca old *scene.py files
find "$SOURCE_DIR/rca" -maxdepth 1 -name "*_scene.py" -type f -exec rm -f {} \;
find ${OBDIAG_HOME}/rca -maxdepth 1 -name "*_scene.py" -type f -exec rm -f {} \;

cp -rf ${WORK_DIR}/plugins/* ${OBDIAG_HOME}/

Expand Down
4 changes: 0 additions & 4 deletions src/common/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,6 @@ def gather_function(self, function_type, opt):
since=Util.get_option(options, 'since'),
scope=Util.get_option(options, 'scope'),
grep=Util.get_option(options, 'grep'),
encrypt=Util.get_option(options, 'encrypt'),
store_dir=Util.get_option(options, 'store_dir'),
temp_dir=Util.get_option(options, 'temp_dir'),
redact=Util.get_option(options, 'redact'),
Expand Down Expand Up @@ -304,7 +303,6 @@ def gather_function(self, function_type, opt):
since=Util.get_option(options, 'since'),
scope=Util.get_option(options, 'scope'),
grep=Util.get_option(options, 'grep'),
encrypt=Util.get_option(options, 'encrypt'),
store_dir=Util.get_option(options, 'store_dir'),
temp_dir=Util.get_option(options, 'temp_dir'),
redact=Util.get_option(options, 'redact'),
Expand All @@ -319,7 +317,6 @@ def gather_function(self, function_type, opt):
since=Util.get_option(options, 'since'),
scope=Util.get_option(options, 'scope'),
grep=Util.get_option(options, 'grep'),
encrypt=Util.get_option(options, 'encrypt'),
store_dir=Util.get_option(options, 'store_dir'),
temp_dir=Util.get_option(options, 'temp_dir'),
redact=Util.get_option(options, 'redact'),
Expand Down Expand Up @@ -364,7 +361,6 @@ def gather_obproxy_log(self, opt):
since=Util.get_option(options, 'since'),
scope=Util.get_option(options, 'scope'),
grep=Util.get_option(options, 'grep'),
encrypt=Util.get_option(options, 'encrypt'),
store_dir=Util.get_option(options, 'store_dir'),
temp_dir=Util.get_option(options, 'temp_dir'),
redact=Util.get_option(options, 'redact'),
Expand Down
6 changes: 0 additions & 6 deletions src/common/diag_cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -433,9 +433,7 @@ def __init__(self):
self.parser.add_option('--from', type='string', help="specify the start of the time range. format: 'yyyy-mm-dd hh:mm:ss'")
self.parser.add_option('--to', type='string', help="specify the end of the time range. format: 'yyyy-mm-dd hh:mm:ss'")
self.parser.add_option('--since', type='string', help="Specify time range that from 'n' [d]ays, 'n' [h]ours or 'n' [m]inutes. before to now. format: <n> <m|h|d>. example: 1h.", default='30m')
self.parser.add_option('--scope', type='string', help="log type constrains, choices=[observer, election, rootservice, all]", default='all')
self.parser.add_option('--grep', action="append", type='string', help="specify keywords constrain")
self.parser.add_option('--encrypt', type='string', help="Whether the returned results need to be encrypted, choices=[true, false]", default="false")
self.parser.add_option('--store_dir', type='string', help='the dir to store gather result, current dir by default.', default='./')
self.parser.add_option('--temp_dir', type='string', help='the dir for temporarily storing files on nodes', default='/tmp')
self.parser.add_option('-c', type='string', help='obdiag custom config', default=os.path.expanduser('~/.obdiag/config.yml'))
Expand All @@ -459,7 +457,6 @@ def __init__(self):
self.parser.add_option('--since', type='string', help="Specify time range that from 'n' [d]ays, 'n' [h]ours or 'n' [m]inutes. before to now. format: <n> <m|h|d>. example: 1h.", default='30m')
self.parser.add_option('--scope', type='string', help="log type constrains, choices=[observer, election, rootservice, all]", default='all')
self.parser.add_option('--grep', action="append", type='string', help="specify keywords constrain")
self.parser.add_option('--encrypt', type='string', help="Whether the returned results need to be encrypted, choices=[true, false]", default="false")
self.parser.add_option('--store_dir', type='string', help='the dir to store gather result, current dir by default.', default='./')
self.parser.add_option('--temp_dir', type='string', help='the dir for temporarily storing files on nodes', default='/tmp')
self.parser.add_option('-c', type='string', help='obdiag custom config', default=os.path.expanduser('~/.obdiag/config.yml'))
Expand Down Expand Up @@ -570,7 +567,6 @@ def __init__(self):
self.parser.add_option('--from', type='string', help="specify the start of the time range. format: 'yyyy-mm-dd hh:mm:ss'")
self.parser.add_option('--to', type='string', help="specify the end of the time range. format: 'yyyy-mm-dd hh:mm:ss'")
self.parser.add_option('--since', type='string', help="Specify time range that from 'n' [d]ays, 'n' [h]ours or 'n' [m]inutes. before to now. format: <n> <m|h|d>. example: 1h.", default='30m')
self.parser.add_option('--encrypt', type='string', help="Whether the returned results need to be encrypted, choices=[true, false]", default="false")
self.parser.add_option('--store_dir', type='string', help='the dir to store gather result, current dir by default.', default='./')
self.parser.add_option('-c', type='string', help='obdiag custom config', default=os.path.expanduser('~/.obdiag/config.yml'))
self.parser.add_option('--config', action="append", type="string", help='config options Format: --config key=value')
Expand All @@ -591,7 +587,6 @@ def __init__(self):
self.parser.add_option('--from', type='string', help="specify the start of the time range. format: 'yyyy-mm-dd hh:mm:ss'")
self.parser.add_option('--to', type='string', help="specify the end of the time range. format: 'yyyy-mm-dd hh:mm:ss'")
self.parser.add_option('--since', type='string', help="Specify time range that from 'n' [d]ays, 'n' [h]ours or 'n' [m]inutes. before to now. format: <n> <m|h|d>. example: 1h.", default='30m')
self.parser.add_option('--encrypt', type='string', help="Whether the returned results need to be encrypted, choices=[true, false]", default="false")
self.parser.add_option('--store_dir', type='string', help='the dir to store gather result, current dir by default.', default='./')
self.parser.add_option('-c', type='string', help='obdiag custom config', default=os.path.expanduser('~/.obdiag/config.yml'))
self.parser.add_option('--config', action="append", type="string", help='config options Format: --config key=value')
Expand Down Expand Up @@ -655,7 +650,6 @@ def __init__(self):
self.parser.add_option('--since', type='string', help="Specify time range that from 'n' [d]ays, 'n' [h]ours or 'n' [m]inutes. before to now. format: <n> <m|h|d>. example: 1h.", default='30m')
self.parser.add_option('--scope', type='string', help="log type constrains, choices=[obproxy, obproxy_limit, obproxy_stat, obproxy_digest, obproxy_slow, obproxy_diagnosis, obproxy_error, all]", default='all')
self.parser.add_option('--grep', action="append", type='string', help="specify keywords constrain")
self.parser.add_option('--encrypt', type='string', help="Whether the returned results need to be encrypted, choices=[true, false]", default="false")
self.parser.add_option('--store_dir', type='string', help='the dir to store gather result, current dir by default.', default='./')
self.parser.add_option('-c', type='string', help='obdiag custom config', default=os.path.expanduser('~/.obdiag/config.yml'))
self.parser.add_option('--config', action="append", type="string", help='config options Format: --config key=value')
Expand Down
6 changes: 2 additions & 4 deletions src/handler/gather/gather_component_log.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ def __init__(self, *args, **kwargs):
self.since_option = None
self.scope = None
self.grep = None
self.encrypt = None
self.store_dir = None
self.temp_dir = None
self.redact = None
Expand All @@ -83,7 +82,6 @@ def init(self, context, *args, **kwargs):
self.since_option = kwargs.get('since', None)
self.scope = kwargs.get('scope', None)
self.grep = kwargs.get('grep', None)
self.encrypt = kwargs.get('encrypt', None)
self.store_dir = kwargs.get('store_dir', None)
self.temp_dir = kwargs.get('temp_dir', None)
self.redact = kwargs.get('redact', None)
Expand All @@ -99,7 +97,6 @@ def init(self, context, *args, **kwargs):
"tmp_dir": const.GATHER_LOG_TEMPORARY_DIR_DEFAULT,
"scope": self.scope,
"grep": self.grep,
"encrypt": self.encrypt,
"store_dir": self.store_dir,
"from_time": self.from_time_str,
"to_time": self.to_time_str,
Expand All @@ -126,7 +123,8 @@ def __check_option(self):

# check store_dir
if not os.path.exists(self.store_dir):
raise Exception("store_dir: {0} is not exist".format(self.store_dir))
self.stdio.warn('args --store_dir [{0}] incorrect: No such directory, Now create it'.format(os.path.abspath(self.store_dir)))
os.makedirs(os.path.abspath(self.store_dir))
if self.is_scene is False:
target_dir = os.path.join("obdiag_gather_pack_{0}".format(TimeUtils.timestamp_to_filename_time(TimeUtils.get_current_us_timestamp())))
self.store_dir = os.path.join(self.store_dir or "./", target_dir)
Expand Down

0 comments on commit 8cbe96f

Please sign in to comment.