@@ -228,7 +228,7 @@ def in_session(self):
228228 except VyOSError :
229229 return False
230230
231- def show_config (self , path = [], default = None ):
231+ def show_config (self , path = [], default = None , effective = False ):
232232 """
233233 Args:
234234 path (str list): Configuration tree path, or empty
@@ -237,6 +237,18 @@ def show_config(self, path=[], default=None):
237237 Returns:
238238 str: working configuration
239239 """
240+
241+ # FIXUP: by default, showConfig will give you a diff
242+ # if there are uncommitted changes.
243+ # The config parser obviously cannot work with diffs,
244+ # so we need to supress diff production using appropriate
245+ # options for getting either running (active)
246+ # or proposed (working) config.
247+ if effective :
248+ path = ['--show-active-only' ] + path
249+ else :
250+ path = ['--show-working-only' ] + path
251+
240252 if isinstance (path , list ):
241253 path = " " .join (path )
242254 try :
@@ -250,7 +262,7 @@ def get_config_dict(self, path=[], effective=False):
250262 Args: path (str list): Configuration tree path, can be empty
251263 Returns: a dict representation of the config
252264 """
253- res = self .show_config (self ._make_path (path ))
265+ res = self .show_config (self ._make_path (path ), effective = effective )
254266 config_tree = vyos .configtree .ConfigTree (res )
255267 config_dict = json .loads (config_tree .to_json ())
256268 return config_dict
0 commit comments