[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Creation of AWS images



On 30 June 2014 20:33, Tomasz Rybak <tomasz.rybak@post.pl> wrote:
Hello.
I've opened two PRs, both related to creation of images,
but none related to HVM images.

When playing with creation of images for unstable I've noticed
two problems in development branch.
(Sorry for inlining patches - mailing list rejects attachments).

One is related to checking whether image of that name already
exists; get_all_images() accepts named parameter owners, not owner:

diff --git a/bootstrapvz/providers/ec2/tasks/ami.py
b/bootstrapvz/providers/ec2/tasks/ami.py
index 61ef26e..dcf90ae 100644
--- a/bootstrapvz/providers/ec2/tasks/ami.py
+++ b/bootstrapvz/providers/ec2/tasks/ami.py
@@ -21,7 +21,7 @@ class AMIName(Task):
                ami_name = info.manifest.image['name'].format(**info.manifest_vars)
                ami_description =
info.manifest.image['description'].format(**info.manifest_vars)

-               images = info._ec2['connection'].get_all_images(owner=['self'])
+               images = info._ec2['connection'].get_all_images(owners=['self'])
                for image in images:
                        if ami_name == image.name:
                                msg = 'An image by the name {ami_name} already
exists.'.format(ami_name=ami_name)


Another is related to change of name of packages.
EC2 image tries to install dhcpcd package; unstable (and Jessie)
contains dhcpcd5. Wheezy also contains dhcpcd5 - maybe we should
change package to avoid problems for the next stable.
Here's the small, ad-hoc patch fixing it:
diff --git a/bootstrapvz/providers/ec2/tasks/network.py
b/bootstrapvz/providers/ec2/tasks/network.py
index 8d3f695..7e2b770 100644
--- a/bootstrapvz/providers/ec2/tasks/network.py
+++ b/bootstrapvz/providers/ec2/tasks/network.py
@@ -14,7 +14,8 @@ class EnableDHCPCDDNS(Task):
                # For dhcpcd we need to configure it to do that.
                from bootstrapvz.common.tools import sed_i
                dhcpcd = os.path.join(info.root, 'etc/default/dhcpcd')
-               sed_i(dhcpcd, '^#*SET_DNS=.*', 'SET_DNS=\'yes\'')
+               if info.release_codename != 'sid':
+                       sed_i(dhcpcd, '^#*SET_DNS=.*', 'SET_DNS=\'yes\'')


 class AddBuildEssentialPackage(Task):
diff --git a/bootstrapvz/providers/ec2/tasks/packages.py
b/bootstrapvz/providers/ec2/tasks/packages.py
index 596d3fb..98cd973 100644
--- a/bootstrapvz/providers/ec2/tasks/packages.py
+++ b/bootstrapvz/providers/ec2/tasks/packages.py
@@ -11,7 +11,10 @@ class DefaultPackages(Task):
        @classmethod
        def run(cls, info):
                info.packages.add('file')  # Needed for the init scripts
-               info.packages.add('dhcpcd')  # isc-dhcp-client doesn't work properly
with ec2
+               if info.release_codename == 'sid':
+                       info.packages.add('dhcpcd5')  # isc-dhcp-client doesn't work
properly with ec2
+               else:
+                       info.packages.add('dhcpcd')  # isc-dhcp-client doesn't work properly
with ec2

                info.exclude_packages.add('isc-dhcp-client')
                info.exclude_packages.add('isc-dhcp-common')



Best regards.

--
Tomasz Rybak  GPG/PGP key ID: 2AD5 9860
Fingerprint A481 824E 7DD3 9C0E C40A  488E C654 FB33 2AD5 9860
http://member.acm.org/~tomaszrybak



> One is related to checking whether image of that name already
> exists; get_all_images() accepts named parameter owners, not owner:
You're right. I have fixed that in the dev branch.

> EC2 image tries to install dhcpcd package; unstable (and Jessie) contains dhcpcd5.
> Wheezy also contains dhcpcd5 - maybe we should change package to avoid problems for the next stable.
I don't think we should change what software is installed between AMI releases of the same Debian version.
Changing it for > wheezy is however a good idea.

> -               sed_i(dhcpcd, '^#*SET_DNS=.*', 'SET_DNS=\'yes\'')
> +               if info.release_codename != 'sid':
> +                       sed_i(dhcpcd, '^#*SET_DNS=.*', 'SET_DNS=\'yes\'')
Is this option turned on per default in dhcpcd5?

The patch looks good. Could you send a pull request for that? (Maybe add a little comment explaining why an old dhcpcd is chosen for wheezy and below).

Kind regards
Anders

Reply to: