mirror of
https://github.com/lubuntu-team/ci-tooling.git
synced 2025-06-04 12:31:30 +00:00
Multiple issues fixed.
- Variable use before assignment - Unhandled edge cases where variables referenced may not have the subdata/indexes requested - try/catch fixes where 'finally' references a variable that might not exist - Unnecessary imports - Added requirements.txt file with base module requirements (without version specificity at this time)
This commit is contained in:
parent
b379ebb20d
commit
f7e731faae
@ -46,6 +46,7 @@ class Generator:
|
|||||||
if not metadata_url or not metadata_repo_name:
|
if not metadata_url or not metadata_repo_name:
|
||||||
raise ValueError("METADATA_URL and METADATA_REPO_NAME must be set")
|
raise ValueError("METADATA_URL and METADATA_REPO_NAME must be set")
|
||||||
|
|
||||||
|
metadata_loc = None
|
||||||
# Create a temporary directory in the most secure manner possible and
|
# Create a temporary directory in the most secure manner possible and
|
||||||
# clone the metadata, throwing the directory away when we're done
|
# clone the metadata, throwing the directory away when we're done
|
||||||
try:
|
try:
|
||||||
@ -59,7 +60,10 @@ class Generator:
|
|||||||
with open(config_file) as metadata_conf_file:
|
with open(config_file) as metadata_conf_file:
|
||||||
metadata_conf = yaml_load(metadata_conf_file, Loader=CLoader)
|
metadata_conf = yaml_load(metadata_conf_file, Loader=CLoader)
|
||||||
finally:
|
finally:
|
||||||
rmtree(metadata_loc)
|
if metadata_loc:
|
||||||
|
rmtree(metadata_loc)
|
||||||
|
else:
|
||||||
|
pass
|
||||||
|
|
||||||
return metadata_conf
|
return metadata_conf
|
||||||
|
|
||||||
@ -127,12 +131,14 @@ class Generator:
|
|||||||
template += text
|
template += text
|
||||||
template = Template(template)
|
template = Template(template)
|
||||||
|
|
||||||
if data:
|
if data is not None:
|
||||||
url = data["packaging_url"]
|
url = data["packaging_url"]
|
||||||
u_branch = data["packaging_branch_unstable"]
|
u_branch = data["packaging_branch_unstable"]
|
||||||
s_branch = data["packaging_branch_stable"]
|
s_branch = data["packaging_branch_stable"]
|
||||||
u_upload_target = data["upload_target_unstable"]
|
u_upload_target = data["upload_target_unstable"]
|
||||||
s_upload_target = data["upload_target_stable"]
|
s_upload_target = data["upload_target_stable"]
|
||||||
|
else:
|
||||||
|
raise AttributeError("Data cannot be empty, cannot parse job data.")
|
||||||
|
|
||||||
if job_type.startswith("package"):
|
if job_type.startswith("package"):
|
||||||
upstream = data["upstream_url"]
|
upstream = data["upstream_url"]
|
||||||
|
@ -16,7 +16,6 @@
|
|||||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
import launchpadlib
|
|
||||||
from time import sleep
|
from time import sleep
|
||||||
from launchpadlib.launchpad import Launchpad
|
from launchpadlib.launchpad import Launchpad
|
||||||
|
|
||||||
@ -49,10 +48,14 @@ class LaunchpadCheck:
|
|||||||
lp = self.login()
|
lp = self.login()
|
||||||
|
|
||||||
# Grab the correct PPA object
|
# Grab the correct PPA object
|
||||||
|
ppa = None
|
||||||
for ippa in lp.people[self.lp_person].ppas:
|
for ippa in lp.people[self.lp_person].ppas:
|
||||||
if ippa.name == self.ppa_name:
|
if ippa.name == self.ppa_name:
|
||||||
ppa = ippa
|
ppa = ippa
|
||||||
|
|
||||||
|
if ppa is None:
|
||||||
|
raise ValueError("No PPA information available for package or package version.")
|
||||||
|
|
||||||
# We're verifying every five minutes; never go to more than two hours
|
# We're verifying every five minutes; never go to more than two hours
|
||||||
# (60 minutes × 2 hours) ÷ 5 minutes = 24 max iterations
|
# (60 minutes × 2 hours) ÷ 5 minutes = 24 max iterations
|
||||||
for i in range(0, 24):
|
for i in range(0, 24):
|
||||||
@ -126,5 +129,6 @@ class LaunchpadCheck:
|
|||||||
# If we've timed out, raise an error
|
# If we've timed out, raise an error
|
||||||
raise ValueError("Timed out, contact Launchpad admins")
|
raise ValueError("Timed out, contact Launchpad admins")
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
lpcheck = LaunchpadCheck()
|
lpcheck = LaunchpadCheck()
|
||||||
|
5
requirements.txt
Normal file
5
requirements.txt
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
launchpadlib
|
||||||
|
jinja2
|
||||||
|
jenkinsapi
|
||||||
|
GitPython
|
||||||
|
PyYAML
|
Loading…
x
Reference in New Issue
Block a user