Skip to content
This repository has been archived by the owner on Aug 9, 2024. It is now read-only.

Commit

Permalink
Merge pull request #33 from fedora-infra/feature/more-alerting
Browse files Browse the repository at this point in the history
Rearrange image.test fedmsg alerts.
  • Loading branch information
ralphbean committed Aug 7, 2015
2 parents 49f421e + 99f51c9 commit 8399318
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 18 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,4 @@ docs/_build/

# Config file (containing secret keys and whatnot)
fedimg.cfg
.eggs
45 changes: 27 additions & 18 deletions fedimg/services/ec2.py
Original file line number Diff line number Diff line change
Expand Up @@ -433,18 +433,34 @@ def upload(self):
# Select the appropriate size for the instance
size = [s for s in sizes if s.id == test_size_id][0]

# Alert the fedmsg bus that an image test is starting
fedimg.messenger.message('image.test', self.build_name,
self.destination, 'started',
extra={'id': self.images[0].id,
'virt_type': self.virt_type,
'vol_type': self.vol_type})

# Actually deploy the test instance
self.test_node = driver.deploy_node(
name=name, image=self.images[0], size=size,
ssh_username=fedimg.AWS_TEST_USER,
ssh_alternate_usernames=['root'],
ssh_key=fedimg.AWS_KEYPATH,
deploy=msd,
kernel_id=registration_aki,
ex_metadata={'build': self.build_name},
ex_keyname=fedimg.AWS_KEYNAME,
ex_security_groups=['ssh'],
)
try:
self.test_node = driver.deploy_node(
name=name, image=self.images[0], size=size,
ssh_username=fedimg.AWS_TEST_USER,
ssh_alternate_usernames=['root'],
ssh_key=fedimg.AWS_KEYPATH,
deploy=msd,
kernel_id=registration_aki,
ex_metadata={'build': self.build_name},
ex_keyname=fedimg.AWS_KEYNAME,
ex_security_groups=['ssh'],
)
except Exception as e:
fedimg.messenger.message('image.test', self.build_name,
self.destination, 'failed',
extra={'id': self.images[0].id,
'virt_type': self.virt_type,
'vol_type': self.vol_type})

raise EC2AMITestException("Failed to boot test node %r." % e)

# Wait until the test node has SSH running
while not ssh_connection_works(fedimg.AWS_TEST_USER,
Expand All @@ -454,13 +470,6 @@ def upload(self):

log.info('Starting AMI tests')

# Alert the fedmsg bus that an image test has started
fedimg.messenger.message('image.test', self.build_name,
self.destination, 'started',
extra={'id': self.images[0].id,
'virt_type': self.virt_type,
'vol_type': self.vol_type})

client = paramiko.SSHClient()
client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
client.connect(self.test_node.public_ips[0],
Expand Down

0 comments on commit 8399318

Please sign in to comment.