-
Notifications
You must be signed in to change notification settings - Fork 152
add zypper arguments to snapshot description #315
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
base: master
Are you sure you want to change the base?
Changes from 5 commits
c6f8ab5
38f1673
13a1439
ed2c422
e1e0bac
c58c282
1243596
d952d2c
5015c03
02130c5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -56,6 +56,9 @@ class Config: | |
|
|
||
| def __init__(self): | ||
| self.solvables = [] | ||
| self.zypper_extended_description = [] | ||
| self.zypper_extended_description.append("false") | ||
| self.zypper_extended_description.append("0") | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't use an array to store two values of different type and meaning. Just use e.g. |
||
| self.load_file("/etc/snapper/zypp-plugin.conf") | ||
|
|
||
|
|
||
|
|
@@ -90,6 +93,19 @@ def load_dom(self, dom): | |
|
|
||
| except: | ||
| pass | ||
| try: | ||
| for tmp3 in dom.getElementsByTagName("description"): | ||
| for tmp4 in tmp3.getElementsByTagName("zypper-extended-description"): | ||
| string_size = tmp4.childNodes[0].data | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Convert to int here instead of below. |
||
| description_enabled = tmp4.getAttribute("enabled") | ||
| if not description_enabled in [ "true", "false" ]: | ||
| loggin.error("unknown extended-config enabled attribute %s" % description_enabled) | ||
| continue | ||
| if description_enabled == "true": | ||
| self.zypper_extended_description[0] = "true" | ||
| self.zypper_extended_description[1] = string_size | ||
| except: | ||
| pass | ||
|
|
||
|
|
||
|
|
||
|
|
@@ -145,15 +161,27 @@ def match_solvables(self, names): | |
| if found and important: | ||
| return True, True | ||
| return found, important | ||
|
|
||
| def zypper_arguments(self): | ||
| if basename(readlink("/proc/%d/exe" % getppid())) == "zypper": | ||
| argument = " " + " ".join(open("/proc/%s/cmdline" % getppid()).read().split('\x00')[1:]) | ||
| else: | ||
| return "" | ||
| if config.zypper_extended_description[1] == "0": | ||
| return argument | ||
| else: | ||
| return argument[0:int(config.zypper_extended_description[1])] | ||
|
|
||
|
|
||
| def PLUGINBEGIN(self, headers, body): | ||
|
|
||
| logging.info("PLUGINBEGIN") | ||
|
|
||
| logging.debug("headers: %s" % headers) | ||
|
|
||
| self.description = "zypp(%s)" % basename(readlink("/proc/%d/exe" % getppid())) | ||
| if config.zypper_extended_description[0] != "true": | ||
| self.description = "zypp(%s)" % basename(readlink("/proc/%d/exe" % getppid())) | ||
| elif config.zypper_extended_description[0] == "true": | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A simple |
||
| self.description = "zypp(%s)%s" % (basename(readlink("/proc/%d/exe" % getppid())), self.zypper_arguments()) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
| self.userdata = self.get_userdata(headers) | ||
|
|
||
| self.ack() | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo in arguments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks