diff --git a/rpm/init.sh b/rpm/init.sh index 16f993a..451a054 100755 --- a/rpm/init.sh +++ b/rpm/init.sh @@ -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}/ diff --git a/src/common/core.py b/src/common/core.py index 805b6af..8b1726f 100644 --- a/src/common/core.py +++ b/src/common/core.py @@ -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'), @@ -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'), @@ -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'), @@ -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'), diff --git a/src/common/diag_cmd.py b/src/common/diag_cmd.py index 64d96d2..0df9468 100644 --- a/src/common/diag_cmd.py +++ b/src/common/diag_cmd.py @@ -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: . 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')) @@ -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: . 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')) @@ -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: . 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') @@ -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: . 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') @@ -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: . 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') diff --git a/src/handler/gather/gather_component_log.py b/src/handler/gather/gather_component_log.py index 7e08f10..edd1e5c 100644 --- a/src/handler/gather/gather_component_log.py +++ b/src/handler/gather/gather_component_log.py @@ -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 @@ -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) @@ -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, @@ -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)