diff --git a/.travis.yml b/.travis.yml index e0165e83..6ae1dd82 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,5 +2,5 @@ language: python python: - 2.7 install: - - pip install . + - pip install . --pre script: nosetests diff --git a/README.md b/README.md index 9bac841f..9a794c42 100644 --- a/README.md +++ b/README.md @@ -11,13 +11,9 @@ Hammr supports the following platforms and machine image formats: * Docker * Google Compute Engine * Fujitsu K5 -* Flexiant * SuseCloud * CloudStack * OpenStack - para-virt and full-girt images -* Eucalyptus (EMI) -* Abiquo -* Nimbula * Citrix Xen Server * Hyper-V * ISO diff --git a/documentation/en/source/changelog.rst b/documentation/en/source/changelog.rst index 0b7a9976..222b6cca 100644 --- a/documentation/en/source/changelog.rst +++ b/documentation/en/source/changelog.rst @@ -1,8 +1,67 @@ -.. Copyright (c) 2007-2016 UShareSoft, All rights reserved +.. Copyright (c) 2007-2019 UShareSoft, All rights reserved Changelog ========= +hammr 3.8.0.7 (2019-04-19) +-------------------------- + +Evolutions: + +* Compatibility with UForge AppCenter 3.8-7 only + +hammr 3.8.0.6 (2019-01-07) +-------------------------- + +Evolutions: + +* Compatibility with UForge AppCenter 3.8-6 only + +hammr 3.8.0.5 (2018-07-20) +-------------------------- + +Evolutions: + +* Compatibility with UForge AppCenter 3.8-5 only + +hammr 3.8.0.4 (2018-05-22) +-------------------------- + +Evolutions: + +* Compatibility with UForge AppCenter 3.8-4 only + +hammr 3.8.0.3 (2018-04-04) +-------------------------- + +Evolutions: + +* Compatibility with UForge AppCenter 3.8-3 only + + +hammr 3.8.0.2 (2018-03-05) +-------------------------- + +Evolutions: + +* Compatibility with UForge AppCenter 3.8-2 only + + +hammr 3.8.0.1 (2018-02-10) +-------------------------- + +Evolutions: + +* Compatibility with UForge AppCenter 3.8-1 only + +hammr 3.8.0.0 (2018-02-01) +-------------------------- + +Evolutions: + +* Compatibility with UForge AppCenter 3.8-0 only + + hammr 3.7.8 (2017-10-16) -------------------------- diff --git a/documentation/en/source/pages/getting-started/install-compatibility.rst b/documentation/en/source/pages/getting-started/install-compatibility.rst index d53f77f3..1abc5459 100644 --- a/documentation/en/source/pages/getting-started/install-compatibility.rst +++ b/documentation/en/source/pages/getting-started/install-compatibility.rst @@ -34,6 +34,16 @@ The following table lists the compatibility between versions of Hammr, UForge_py +-----------------+-----------------------------+------------------+ | 3.7.8 | 3.7.8 | 3.7.8 | +-----------------+-----------------------------+------------------+ + | 3.8.0.1 | 3.8.0.1 | 3.8-1 | + +-----------------+-----------------------------+------------------+ + | 3.8.0.2 | 3.8.0.2 | 3.8-2 | + +-----------------+-----------------------------+------------------+ + | 3.8.0.3 | 3.8.0.3 | 3.8-3 | + +-----------------+-----------------------------+------------------+ + | 3.8.0.4 | 3.8.0.4 | 3.8-4 | + +-----------------+-----------------------------+------------------+ + | 3.8.0.5 | 3.8.0.5 | 3.8-5 | + +-----------------+-----------------------------+------------------+ If your hammr version is not compatible with the UForge version that you want to reach, hammr will raise an error message with the UForge version: diff --git a/documentation/en/source/pages/machine-images/machine-image-build.rst b/documentation/en/source/pages/machine-images/machine-image-build.rst index 70cafce8..bb116000 100644 --- a/documentation/en/source/pages/machine-images/machine-image-build.rst +++ b/documentation/en/source/pages/machine-images/machine-image-build.rst @@ -38,20 +38,12 @@ The following tables list if the machine image will be compressed by default or +------------------+---------------------+-----------------------+ | Cloud Format | Compressed | Not Compressed | +==================+=====================+=======================+ -| Nimbula | X | | -+------------------+---------------------+-----------------------+ | Openstack | | X | +------------------+---------------------+-----------------------+ | Suse Cloud | | X | +------------------+---------------------+-----------------------+ -| Eucalyptus | | X | -+------------------+---------------------+-----------------------+ -| Flexiant | X | | -+------------------+---------------------+-----------------------+ | CloudStack | X | | +------------------+---------------------+-----------------------+ -| Abiquo | | X | -+------------------+---------------------+-----------------------+ | Azure | | X | +------------------+---------------------+-----------------------+ | AWS | | X | diff --git a/documentation/en/source/pages/templates-spec/builders/builders-abiquo.rst b/documentation/en/source/pages/templates-spec/builders/builders-abiquo.rst deleted file mode 100644 index 816c7e5b..00000000 --- a/documentation/en/source/pages/templates-spec/builders/builders-abiquo.rst +++ /dev/null @@ -1,273 +0,0 @@ -.. Copyright (c) 2007-2016 UShareSoft, All rights reserved - -.. _builder-abiquo: - -Abiquo -====== - -Default builder type: ``Abiquo`` - -Require Cloud Account: Yes - -`www.abiquo.com `_ - -The ``Abiquo`` builder provides information for building and publishing the machine image for the Abiquo cloud platform. The Abiquo builder requires cloud account information to upload and register the machine image to the Abiquo platform. -This builder type is the default name provided by UForge AppCenter. - -.. note:: This builder type name can be changed by your UForge administrator. To get the available builder types, please refer to :ref:`command-line-format` - -The Abiquo builder section has the following definition when using YAML: - -.. code-block:: yaml - - --- - builders: - - type: Abiquo - account: - type: Abiquo - -If you are using JSON: - -.. code-block:: javascript - - { - "builders": [ - { - "type": "Abiquo", - ...the rest of the definition goes here. - } - ] - } - -Building a Machine Image ------------------------- - -For building an image, the valid keys are: - -* ``type`` (mandatory): a string providing the machine image type to build. Default builder type for Abiquo: ``Abiquo``. To get the available builder type, please refer to :ref:`command-line-format` -* ``hardwareSettings`` (mandatory): an object providing hardware settings to be used for the machine image. The following valid keys for hardware settings are: - * ``memory`` (mandatory): an integer providing the amount of RAM to provide to an instance provisioned from the machine image (in MB). - * ``hwType`` (optional): an integer providing the hardware type for the machine image. This is the VMware hardware type: 4 (ESXi>3.x), 7 (ESXi>4.x) or 9 (ESXi>5.x) -* ``installation`` (optional): an object providing low-level installation or first boot options. These override any installation options in the :ref:`template-stack` section. The following valid keys for installation are: - * ``diskSize`` (mandatory): an integer providing the disk size of the machine image to create. Note, this overrides any disk size information in the stack. This cannot be used if an advanced partitioning table is defined in the stack. - -.. note:: When building from a scan, your yaml or json file must contain an ``installation`` section in ``builders``. This is mandatory when you create a new template, but might be missing when you build from a scan. Make sure it is present or your build will fail. - -Publishing a Machine Image --------------------------- - -To publish an image, the valid keys are: - -* ``type`` (mandatory): a string providing the machine image type to build. Default builder type for Abiquo, ``Abiquo``. To get the available builder type, please refer to :ref:`command-line-format` -* ``account`` (mandatory): an object providing the abiquo cloud account information required to publish the built machine image. -* ``category`` (mandatory): a string providing the category this machine image. The category name must already be present in the abiquo platform. -* ``datacenter`` (mandatory): a string providing the datacenter name. The datacenter must already be present in the abiquo platform, and the cloud account must have access to the datacenter. -* ``description`` (mandatory): a string providing the description of what the machine image does. -* ``enterprise`` (mandatory): a string providing the enterprise resource name where to publish the machine image to. The enterprise resource must already exists in the abiquo platform, and the cloud account must have access to the enterprise resource. -* ``productName`` (mandatory): a string providing the name to be displayed for machine image. The name cannot exceed 32 characters - -Abiquo Cloud Account --------------------- - -Key: ``account`` - -Used to authenticate the abiquo platform. - -The Abiquo cloud account has the following valid keys: - -* ``type`` (mandatory): a string providing the cloud account type. Default platform type for Abiquo: ``Abiquo``. To get the available platform type, please refer to :ref:`command-line-platform` -* ``file`` (optional): a string providing the location of the account information. This can be a pathname (relative or absolute) or an URL. -* ``hostname`` (mandatory): a string providing the hostname or IP address where the abiquo cloud platform is running -* ``name`` (mandatory): a string providing the name of the cloud account. This name can be used in a builder section to reference the rest of the cloud account information. -* ``password`` (mandatory): a string providing the password to use to authenticate -* ``username`` (mandatory): a string providing the username to use to authenticate - -.. note:: In the case where ``name`` or ``file`` is used to reference a cloud account, all the other keys are no longer required in the account definition for the builder. - -Examples --------- - -Basic Example -~~~~~~~~~~~~~ - -The following example shows an abiquo builder with all the information to build and publish a machine image to the Abiquo Cloud platform. - -If you are using YAML: - -.. code-block:: yaml - - --- - builders: - - type: Abiquo - account: - type: Abiquo - name: My Abiquo Account - hostname: test.abiquo.com - username: myLogin - password: myPassWD - hardwareSettings: - memory: 1024 - installation: - diskSize: 2000 - enterprise: UShareSoft - datacenter: London - productName: CentOS Core - category: OS - description: CentOS Core template. - -If you are using JSON: - -.. code-block:: json - - { - "builders": [ - { - "type": "Abiquo", - "account": { - "type": "Abiquo", - "name": "My Abiquo Account", - "hostname": "test.abiquo.com", - "username": "myLogin", - "password": "myPassWD" - }, - "hardwareSettings": { - "memory": 1024 - }, - "installation": { - "diskSize": 2000 - }, - "enterprise": "UShareSoft", - "datacenter": "London", - "productName": "CentOS Core", - "category": "OS", - "description": "CentOS Core template." - } - ] - } - -Referencing the Cloud Account ------------------------------ - -To help with security, the cloud account information can be referenced by the builder section. This example is the same as the previous example but with the account information in another file. Create a YAML file ``abiquo-account.yml``. - -.. code-block:: yaml - - --- - account: - type: Abiquo - name: My Abiquo Account - hostname: test.abiquo.com - username: myLogin - password: myPassWD - -If you are using JSON, create a JSON file ``abiquo-account.json``: - -.. code-block:: json - - { - "accounts": [ - { - "type": "Abiquo", - "name": "My Abiquo Account" - "hostname": "test.abiquo.com", - "username": "myLogin", - "password": "myPassWD" - } - ] - } - -The builder section can either reference by using ``file`` or ``name``. - -Reference by file: - -If you are using YAML: - -.. code-block:: yaml - - --- - builders: - - type: Abiquo - account: - file: "/home/joris/accounts/abiquo-account.yml" - hardwareSettings: - memory: 1024 - installation: - diskSize: 2000 - enterprise: UShareSoft - datacenter: London - productName: CentOS Core - category: OS - description: CentOS Core template. - -If you are using JSON: - -.. code-block:: json - - { - "builders": [ - { - "type": "Abiquo", - "account": { - "file": "/home/joris/accounts/abiquo-account.json" - }, - "hardwareSettings": { - "memory": 1024 - }, - "installation": { - "diskSize": 2000 - }, - "enterprise": "UShareSoft", - "datacenter": "London", - "productName": "CentOS Core", - "category": "OS", - "description": "CentOS Core template." - } - ] - } - -Reference by name, note the cloud account must already be created by using ``account create``. - -If you are using YAML: - -.. code-block:: yaml - - --- - builders: - - type: Abiquo - account: - name: My Abiquo Account - hardwareSettings: - memory: 1024 - installation: - diskSize: 2000 - enterprise: UShareSoft - datacenter: London - productName: CentOS Core - category: OS - description: CentOS Core template. - -If you are using JSON: - -.. code-block:: json - - { - "builders": [ - { - "type": "Abiquo", - "account": { - "name": "My Abiquo Account" - }, - "hardwareSettings": { - "memory": 1024 - }, - "installation": { - "diskSize": 2000 - }, - "enterprise": "UShareSoft", - "datacenter": "London", - "productName": "CentOS Core", - "category": "OS", - "description": "CentOS Core template." - } - ] - } \ No newline at end of file diff --git a/documentation/en/source/pages/templates-spec/builders/builders-euca.rst b/documentation/en/source/pages/templates-spec/builders/builders-euca.rst deleted file mode 100644 index 05316f84..00000000 --- a/documentation/en/source/pages/templates-spec/builders/builders-euca.rst +++ /dev/null @@ -1,247 +0,0 @@ -.. Copyright (c) 2007-2016 UShareSoft, All rights reserved - -.. _builder-euca: - -Eucalyptus -========== - -Default builder type: ``Eucalyptus KVM`` or ``Eucalyptus XEN`` - -Require Cloud Account: Yes - -`www.eucalyptus.com `_ - -The Eucalyptus builder provides information for building and publishing the machine image for Eucalyptus. This builder supports KVM (``Eucalyptus KVM``) and Xen (``Eucalyptus XEN``) based images for Eucalyptus. -These builder types are the default names provided by UForge AppCenter. - -.. note:: These builder type names can be changed by your UForge administrator. To get the available builder types, please refer to :ref:`command-line-format` - -The Eucalyptus builder requires cloud account information to upload and register the machine image to an Eucalyptus cloud platform. - -The Eucalyptus builder section has the following definition when using YAML: - -.. code-block:: yaml - - --- - builders: - - type: Eucalyptus KVM - # the rest of the definition goes here. - -If you are using JSON: - -.. code-block:: javascript - - { - "builders": [ - { - "type": "Eucalyptus KVM", - ...the rest of the definition goes here. - } - ] - } - -Building a Machine Image ------------------------- - -For building an image, the valid keys are: - -* ``type`` (mandatory): a string providing the machine image type to build. Default builder type for Eucalyptus: ``Eucalyptus KVM`` or ``Eucalyptus XEN``. To get the available builder type, please refer to :ref:`command-line-format` -* ``account`` (mandatory): an object providing the Eucalyptus cloud account information required to publish the built machine image. -* ``installation`` (optional): an object providing low-level installation or first boot options. These override any installation options in the :ref:`template-stack` section. The following valid keys for installation are: - * ``diskSize`` (mandatory): an integer providing the disk size of the machine image to create. Note, this overrides any disk size information in the stack. This cannot be used if an advanced partitioning table is defined in the stack. -* ``disableRootLogin`` (optional): a boolean flag to determine if root login access should be disabled for any instance provisioned from the machine image. - -.. note:: When building from a scan, your yaml or json file must contain an ``installation`` section in ``builders``. This is mandatory when you create a new template, but might be missing when you build from a scan. Make sure it is present or your build will fail. - -Publishing a Machine Image --------------------------- - -To publish an image, the valid keys are: - -* ``type`` (mandatory): a string providing the machine image type to build. Default builder type for Eucalyptus: ``Eucalyptus KVM`` or ``Eucalyptus XEN``. To get the available builder type, please refer to :ref:`command-line-format` -* ``account`` (mandatory): an object providing the Eucalyptus cloud account information required to publish the built machine image. -* ``bucket`` (mandatory): a string providing the bucket where to store the machine image. Note, bucket names are global to everyone, so you must choose a unique bucket name that is not used by another user. The bucket name should not include spaces. -* ``description`` (mandatory): a string providing a description of what the machine image does. The description of the machine image is displayed in the console. The description can only be up to 255 characters long. Descriptions longer than 255 characters will be truncated. -* ``imageName`` (mandatory): a string providing the displayed name for the machine image. -* ``kernelId`` (optional): a string providing the kernel Id when booting an instance from the machine image. Note that the kernel id must be already present on the cloud environment. If a kernel Id is not specified, then the default kernel Id registered on the cloud platform will be used. -* ``ramdisk`` (optional): a string providing the ramdisk Id when booting an instance from the machine image. Note that the ramdisk Id must be already present on the cloud environment. If a ramdisk Id is not specified, then the default ramdisk Id registered on the cloud platform will be used. - -Eucalyptus Cloud Account ------------------------- - -Key: ``account`` -Used to authenticate to Eucalyptus. - -The Eucalyptus cloud account has the following valid keys: - -* ``type`` (mandatory): a string providing the cloud account type. Default platform type for Eucalyptus is ``Eucalyptus``. To get the available platform type, please refer to :ref:`command-line-platform` -* ``accountNumber`` (mandatory): a string providing the User ID or Eucalyptus account number of the user who is bundling the image. This value can be found in the eucarc file. -* ``cloudCert`` (mandatory): a string providing the location of the cloud certificate. This may be a path or URL. To get the cloud certificate, login into your Eucalyptus admin console (for example https://myserver.domain.com:8443). Go to the Credentials ZIP-file and click on the button Download credentials. Unzip this file, you should find the certificate with the name cloud-cert.pem -* ``file`` (optional): a string providing the location of the account information. This can be a pathname (relative or absolute) or an URL. -* ``endpoint`` (mandatory): a string providing the URL of the Eucalyptus Walrus server. To get the walrus server information, login into your Eucalyptus admin console and click on the Configuration tab -* ``name``: (mandatory) a string providing the name of the cloud account. This name can be used in a builder section to reference the rest of the cloud account information. -* ``queryId`` (mandatory): a string providing your Eucalyptus query id. To get this key, login into your Eucalyptus admin console (for example https://myserver.domain.com:8443). Go to Query Interface Credentials > Show keys, the query id will be displayed. -* ``secretKey`` (mandatory): a string of your your Eucalyptus secret key. To get this key, login into your Eucalyptus admin console (for example https://myserver.domain.com:8443). Go to Query Interface Credentials > Show keys, the secret key will be displayed -* ``x509PrivateKey`` (mandatory): a string providing the location of the X.509 certificate private key. This may be a path or URL. This is the private key of the X.509 certificate. To get an X.509 private key, login into your Eucalyptus admin console, go to Credentials ZIP-file and click on the button Download credentials. Unzip this file, you should find the private key with the name XXXX-XXXX-XXXX-pk.pem. -* ``x509Cert`` (mandatory): a string providing the location of the X.509 certificate public key. This may be a path or URL. To get a X.509 certificate, login into your Eucalyptus admin console, go to the Credentials ZIP-file and click on the button Download credentials. Unzip this file, you should find the certificate with the name XXXX-XXXX-XXXX-cert.pem - -.. note:: In the case where ``name`` or ``file`` is used to reference a cloud account, all the other keys are no longer required in the account definition for the builder. - -Example -------- - -The following example shows an Eucalyptus builder with all the information to build and publish a machine image to Eucalyptus. - -If you are using YAML: - -.. code-block:: yaml - - --- - builders: - - type: Eucalyptus KVM - account: - type: Eucalyptus - name: My Eucalyptus Account - accountNumber: '111122223333' - x509PrivateKey: "/home/joris/accounts/euca/euca-pk.pem" - x509Cert: "/home/joris/accounts/euca/euca-cert.pem" - cloudCert: "/home/joris/accounts/euca/cloud-cert.pem" - endpoint: http://127.0.0.1/8773 - queryId: WkVpyXXZ77rXcdeSbds3lkXcr5Jc4GeUtkA - secretKey: ir9CKRvOXXTHJXXj8VPRXX7PgxxY9DY0VLng - imageName: CentOS Core - description: CentOS Base Image - bucket: ussprodbucket - -If you are using JSON: - -.. code-block:: json - - { - "builders": [ - { - "type": "Eucalyptus KVM", - "account": { - "type": "Eucalyptus", - "name": "My Eucalyptus Account", - "accountNumber": "111122223333", - "x509PrivateKey": "/home/joris/accounts/euca/euca-pk.pem", - "x509Cert": "/home/joris/accounts/euca/euca-cert.pem", - "cloudCert": "/home/joris/accounts/euca/cloud-cert.pem", - "endpoint": "http://127.0.0.1/8773", - "queryId": "WkVpyXXZ77rXcdeSbds3lkXcr5Jc4GeUtkA", - "secretKey": "ir9CKRvOXXTHJXXj8VPRXX7PgxxY9DY0VLng" - }, - "imageName": "CentOS Core", - "description": "CentOS Base Image", - "bucket": "ussprodbucket" - } - ] - } - -Referencing the Cloud Account ------------------------------ - -To help with security, the cloud account information can be referenced by the builder section. This example is the same as the previous example but with the account information in another file. Create a YAML file ``euca-account.yml``. - -.. code-block:: yaml - - --- - accounts: - - type: Eucalyptus - name: My Eucalyptus Account - accountNumber: '111122223333' - x509PrivateKey: "/home/joris/accounts/euca/euca-pk.pem" - x509Cert: "/home/joris/accounts/euca/euca-cert.pem" - cloudCert: "/home/joris/accounts/euca/cloud-cert.pem" - endpoint: http://127.0.0.1/8773 - queryId: WkVpyXXZ77rXcdeSbds3lkXcr5Jc4GeUtkA - secretKey: ir9CKRvOXXTHJXXj8VPRXX7PgxxY9DY0VLng - -If you are using JSON, create a JSON file ``euca-account.json``: - -.. code-block:: json - - { - "accounts": [ - { - "type": "Eucalyptus", - "name": "My Eucalyptus Account", - "accountNumber": "111122223333", - "x509PrivateKey": "/home/joris/accounts/euca/euca-pk.pem", - "x509Cert": "/home/joris/accounts/euca/euca-cert.pem", - "cloudCert": "/home/joris/accounts/euca/cloud-cert.pem", - "endpoint": "http://127.0.0.1/8773", - "queryId": "WkVpyXXZ77rXcdeSbds3lkXcr5Jc4GeUtkA", - "secretKey": "ir9CKRvOXXTHJXXj8VPRXX7PgxxY9DY0VLng" - } - ] - } - -The builder section can either reference by using ``file`` or ``name``. - -Reference by file: - -If you are using YAML: - -.. code-block:: yaml - - --- - builders: - - type: Eucalyptus KVM - account: - file: "/home/joris/accounts/euca-account.yml" - imageName: CentOS Core - description: CentOS Base Image - bucket: ussprodbucket - -If you are using JSON: - -.. code-block:: json - - { - "builders": [ - { - "type": "Eucalyptus KVM", - "account": { - "file": "/home/joris/accounts/euca-account.json" - }, - "imageName": "CentOS Core", - "description": "CentOS Base Image", - "bucket": "ussprodbucket" - } - ] - } - -Reference by name, note the cloud account must already be created by using ``account create``. - -If you are using YAML: - -.. code-block:: yaml - - --- - builders: - - type: Eucalyptus KVM - account: - name: My Eucalytpus Account - imageName: CentOS Core - description: CentOS Base Image - bucket: ussprodbucket - -If you are using JSON: - -.. code-block:: json - - { - "builders": [ - { - "type": "Eucalyptus KVM", - "account": { - "name": "My Eucalytpus Account" - }, - "imageName": "CentOS Core", - "description": "CentOS Base Image", - "bucket": "ussprodbucket" - } - ] - } \ No newline at end of file diff --git a/documentation/en/source/pages/templates-spec/builders/builders-flexiant.rst b/documentation/en/source/pages/templates-spec/builders/builders-flexiant.rst deleted file mode 100644 index 888f6a96..00000000 --- a/documentation/en/source/pages/templates-spec/builders/builders-flexiant.rst +++ /dev/null @@ -1,257 +0,0 @@ -.. Copyright (c) 2007-2016 UShareSoft, All rights reserved - -.. _builder-flexiant: - -Flexiant -======== - -Default builder type: ``Flexiant QCOW2 - KVM/Xen/VMware``, ``Flexiant OVA - VMware`` or ``Flexiant RAW - KVM/Xen`` - -Require Cloud Account: Yes - -`flexiant.com `_ - -The Flexiant builder provides information for building and publishing the machine image to a Flexiant cloud platform. This builder supports KVM (``Flexiant QCOW2 - KVM/Xen/VMware``), VMware (``Flexiant OVA - VMware``) or Raw (``Flexiant RAW - KVM/Xen``) based images for Flexiant. - -These builder types are the default names provided by UForge AppCenter. - -.. note:: These builder type names can be changed by your UForge administrator. To get the available builder types, please refer to :ref:`command-line-format` - -The Flexiant builder requires cloud account information to upload and register the machine image to the Flexiant platform. - -The Flexiant builder section has the following definition when using YAML: - -.. code-block:: yaml - - --- - builders: - - type: Flexiant RAW - KVM/Xen - # the rest of the definition goes here. - -If you are using JSON: - -.. code-block:: javascript - - { - "builders": [ - { - "type": "Flexiant OVA - VMware", - ...the rest of the definition goes here. - } - ] - } - -Building a Machine Image ------------------------- - -For building an image, the valid keys are: - -* ``type`` (mandatory): a string providing the machine image type to build. Default builder type for Flexiant: ``Flexiant QCOW2 - KVM/Xen/VMware``, ``Flexiant OVA - VMware`` or ``Flexiant RAW - KVM/Xen``. To get the available builder type, please refer to :ref:`command-line-format` -* ``hardwareSettings`` (mandatory): an object providing hardware settings to be used for the machine image. If an OVF machine image is being built, then the hardware settings are mandatory. The following valid keys for hardware settings are: - * ``memory`` (mandatory): an integer providing the amount of RAM to provide to an instance provisioned from the machine image (in MB). -* installation (optional): an object providing low-level installation or first boot options. These override any installation options in the :ref:`template-stack` section. The following valid keys for installation are: - * ``diskSize`` (mandatory): an integer providing the disk size of the machine image to create. Note, this overrides any disk size information in the stack. This cannot be used if an advanced partitioning table is defined in the stack. - -.. note:: When building from a scan, your yaml or json file must contain an ``installation`` section in ``builders``. This is mandatory when you create a new template, but might be missing when you build from a scan. Make sure it is present or your build will fail. - -Publishing a Machine Image --------------------------- - -To publish an image, the valid keys are: - -* ``type`` (mandatory): a string providing the machine image type to build. Default builder type for Flexiant: ``Flexiant QCOW2 - KVM/Xen/VMware``, ``Flexiant OVA - VMware`` or ``Flexiant RAW - KVM/Xen``. To get the available builder type, please refer to :ref:`command-line-format` -* ``account`` (mandatory): an object providing the Flexiant cloud account information required to publish the built machine image. -* ``virtualDatacenterName`` (mandatory): a string providing the datacenter name where to register the machine image. Note, the user must have access to this datacenter. -* ``machineImageName`` (mandatory): a string providing the name of the machine image to displayed. -* ``diskOffering`` (mandatory): a string providing the disk offering to register the machine image under. - -Flexiant Cloud Account ----------------------- - -Key: ``account`` -Used to authenticate the Flexiant platform. - -The Flexiant cloud account has the following valid keys: - -* ``type`` (mandatory): a string providing the cloud account type. Default platform type for Flexiant is ``Flexiant``. To get the available platform type, please refer to :ref:`command-line-platform` -* ``name`` (mandatory): a string providing the name of the cloud account. This name can be used in a builder section to reference the rest of the cloud account information. -* ``apiUsername`` (mandatory): a string providing your API username. To get your api username, log in to Flexiant cloud orchestrator, click on Settings > Your API Details -* ``password`` (mandatory): a string providing your Flexiant cloud orchestrator account password -* ``wsdlUrl`` (mandatory): a string providing the wsdl URL of the Flexiant cloud orchestrator, for example: https://myapi.example2.com:4442/?wsdl -* ``file`` (optional): a string providing the location of the account information. This can be a pathname (relative or absolute) or an URL. - -.. note:: In the case where ``name`` or ``file`` is used to reference a cloud account, all the other keys are no longer required in the account definition for the builder. - -Example -------- - -The following example shows a Flexiant builder with all the information to build and publish a machine image to the Flexiant. - -If you are using YAML: - -.. code-block:: yaml - - --- - builders: - - type: Flexiant RAW - KVM/Xen - account: - type: Flexiant - name: My Flexiant account - apiUsername: name@domain.com/mykey1111 - password: mypassword - wsdlUrl: myWsdlurl - hardwareSettings: - memory: 1024 - installation: - diskSize: 2000 - virtualDatacenterName: KVM (CEPH Cluster) - machineImageName: test_hammr - diskOffering: 21 GB - -If you are using JSON: - -.. code-block:: json - - { - "builders": [ - { - "type": "Flexiant RAW - KVM/Xen", - "account": { - "type": "Flexiant", - "name": "My Flexiant account", - "apiUsername": "name@domain.com/mykey1111", - "password": "mypassword", - "wsdlUrl": "myWsdlurl" - }, - "hardwareSettings": { - "memory": 1024 - }, - "installation": { - "diskSize": 2000 - }, - "virtualDatacenterName": "KVM (CEPH Cluster)", - "machineImageName": "test_hammr", - "diskOffering": "21 GB" - } - ] - } - -Referencing the Cloud Account ------------------------------ - -To help with security, the cloud account information can be referenced by the builder section. This example is the same as the previous example but with the account information in another file. Create a YAML file ``Flexiant-account.yml``. - -.. code-block:: yaml - - --- - accounts: - - type: Flexiant - name: My Flexiant account - apiUsername: name@domain.com/mykey1111 - password: mypassword - wsdlUrl: myWsdlurl - - -If you are using JSON, create a JSON file ``Flexiant-account.json``: - -.. code-block:: json - - { - "accounts": [ - { - "type": "Flexiant", - "name": "My Flexiant account", - "apiUsername": "name@domain.com/mykey1111", - "password": "mypassword", - "wsdlUrl": "myWsdlurl" - } - ] - } - -The builder section can either reference by using ``file`` or ``name``. - -Reference by file: - -If you are using YAML: - -.. code-block:: yaml - - --- - builders: - - type: Flexiant RAW - KVM/Xen - account: - file: "/path/to/flexiant-account.yml" - hardwareSettings: - memory: 1024 - installation: - diskSize: 2000 - virtualDatacenterName: KVM (CEPH Cluster) - machineImageName: test_hammr - diskOffering: 21 GB - -If you are using JSON: - -.. code-block:: json - - { - "builders": [ - { - "type": "Flexiant RAW - KVM/Xen", - "account": { - "file": "/path/to/flexiant-account.json" - }, - "hardwareSettings": { - "memory": 1024 - }, - "installation": { - "diskSize": 2000 - }, - "virtualDatacenterName": "KVM (CEPH Cluster)", - "machineImageName": "test_hammr", - "diskOffering": "21 GB" - } - ] - } - -Reference by name, note the cloud account must already be created by using ``account create``. - -If you are using YAML: - -.. code-block:: yaml - - --- - builders: - - type: Flexiant RAW - KVM/Xen - account: - name: My Flexiant Account - hardwareSettings: - memory: 1024 - installation: - diskSize: 2000 - virtualDatacenterName: KVM (CEPH Cluster) - machineImageName: test_hammr - diskOffering: 21 GB - -If you are using JSON: - -.. code-block:: json - - { - "builders": [ - { - "type": "Flexiant RAW - KVM/Xen", - "account": { - "name": "My Flexiant Account" - }, - "hardwareSettings": { - "memory": 1024 - }, - "installation": { - "diskSize": 2000 - }, - "virtualDatacenterName": "KVM (CEPH Cluster)", - "machineImageName": "test_hammr", - "diskOffering": "21 GB" - } - ] - } \ No newline at end of file diff --git a/documentation/en/source/pages/templates-spec/builders/builders-nimbula.rst b/documentation/en/source/pages/templates-spec/builders/builders-nimbula.rst deleted file mode 100644 index 35490045..00000000 --- a/documentation/en/source/pages/templates-spec/builders/builders-nimbula.rst +++ /dev/null @@ -1,253 +0,0 @@ -.. Copyright (c) 2007-2016 UShareSoft, All rights reserved - -.. _builder-nimbula: - -Nimbula -======= - -Default builder type: ``Nimbula ESX`` or ``Nimbula KVM`` - -Require Cloud Account: Yes - -The Nimbula builder provides information for building and publishing the machine image to the Nimbula cloud platform. This builder supports KVM (``Nimbula KVM``) or VMware (``Nimbula ESX``) based images for Nimbula. -These builder types are the default names provided by UForge AppCenter. - -.. note:: These builder type names can be changed by your UForge administrator. To get the available builder types, please refer to :ref:`command-line-format` - -The Nimbula builder requires cloud account information to upload and register the machine image to the Nimbula platform. -The Nimbula builder section has the following definition when using YAML: - -.. code-block:: yaml - - --- - builders: - - type: Nimbula KVM - # the rest of the definition goes here. - -If you are using JSON: - -.. code-block:: javascript - - { - "builders": [ - { - "type": "Nimbula KVM", - ...the rest of the definition goes here. - } - ] - } - -Building a Machine Image ------------------------- - -For building an image, the valid keys are: - -* ``type`` (mandatory): a string providing the machine image type to build. Default builder type for Nimbula: ``Nimbula ESX` or, ``Nimbula KVMK``. To get the available builder type, please refer to :ref:`command-line-format` -* ``hardwareSettings`` (mandatory): an object providing hardware settings to be used for the machine image. If an OVF machine image is being built, then the hardware settings are mandatory. The following valid keys for hardware settings are: - * ``memory`` (mandatory): an integer providing the amount of RAM to provide to an instance provisioned from the machine image (in MB). -* ``installation`` (optional): an object providing low-level installation or first boot options. These override any installation options in the :ref:`template-stack` section. The following valid keys for installation are: - * ``diskSize`` (mandatory): an integer providing the disk size of the machine image to create. Note, this overrides any disk size information in the stack. This cannot be used if an advanced partitioning table is defined in the stack. - -.. note:: When building from a scan, your yaml or json file must contain an ``installation`` section in ``builders``. This is mandatory when you create a new template, but might be missing when you build from a scan. Make sure it is present or your build will fail. - -Publishing a Machine Image --------------------------- - -To publish an image, the valid keys are: - -* ``type`` (mandatory): a string providing the machine image type to build. Default builder type for Nimbula: ``Nimbula ESX` or, ``Nimbula KVMK``. To get the available builder type, please refer to :ref:`command-line-format` -* ``account`` (mandatory): an object providing the Nimbula cloud account information required to publish the built machine image. -* ``description`` (mandatory): a string providing the description that will be displayed for the machine image. -* ``imageListName`` (mandatory): a string providing the list name where to register the machine image. Note that this is the full pathname, for example ``/usharesoft/administrator/myimages``. Machine images can be added to an image list to create a versioned selection of related machine images recording the versions of the image over its lifetime. An image maintainer can add newer versions of a machine image to the image list and can set the default version to be used when this image list is invoked in a launch plan to deploy VM instances -* ``imageVersion`` (mandatory): a string providing the version of the machine image being registered. - -Nimbula Cloud Account ---------------------- - -Key: ``account`` - -Used to authenticate the Nimbula platform. -The Nimbula cloud account has the following valid keys: - -* ``type`` (mandatory): a string providing the cloud account type. Default platform type for Nimbula is ``Nimbula``. To get the available platform type, please refer to :ref:`command-line-platform` -* ``file`` (optional): a string providing the location of the account information. This can be a pathname (relative or absolute) or an URL. -* ``endpoint`` (mandatory): URL endpoint of the Nimbula cloud -* ``name`` (mandatory): a string providing the name of the cloud account. This name can be used in a builder section to reference the rest of the cloud account information. -* ``password`` (mandatory): a string providing the password used to to authenticate to Nimbula Director -* ``username`` (mandatory): a string providing the user used to authenticate to Nimbula Director. This is in the form of a URI, for example ``/root/root`` - -.. note:: In the case where ``name`` or ``file`` is used to reference a cloud account, all the other keys are no longer required in the account definition for the builder. - -Example -------- - -The following example shows an Nimbula builder with all the information to build and publish a machine image to Nimbula. - -If you are using YAML: - -.. code-block:: yaml - - --- - builders: - - type: Nimbula KVM - account: - type: Nimbula - name: My Nimbula Account - endpoint: http://20.20.20.201 - username: myLogin - password: myPassWD - hardwareSettings: - memory: 1024 - installation: - diskSize: 2000 - imageListName: "/usharesoft/administrator/myimages" - imageVersion: '1' - description: CentOS Core Image - -If you are using JSON: - -.. code-block:: json - - { - "builders": [ - { - "type": "Nimbula KVM", - "account": { - "type": "Nimbula", - "name": "My Nimbula Account", - "endpoint": "http://20.20.20.201", - "username": "myLogin", - "password": "myPassWD" - }, - "hardwareSettings": { - "memory": 1024 - }, - "installation": { - "diskSize": 2000 - }, - "imageListName": "/usharesoft/administrator/myimages", - "imageVersion": "1", - "description": "CentOS Core Image" - } - ] - } - -Referencing the Cloud Account ------------------------------ - -To help with security, the cloud account information can be referenced by the builder section. This example is the same as the previous example but with the account information in another file. Create a YAML file ``nimbula-account.yml``. - -.. code-block:: yaml - - --- - accounts: - - type: Nimbula - name: My Nimbula Account - endpoint: http://20.20.20.201 - username: myLogin - password: myPassWD - - -If you are using JSON, create a JSON file ``nimbula-account.json``: - -.. code-block:: json - - { - "accounts": [ - { - "type": "Nimbula", - "name": "My Nimbula Account", - "endpoint": "http://20.20.20.201", - "username": "myLogin", - "password": "myPassWD" - } - ] - } - -The builder section can either reference by using ``file`` or ``name``. - -Reference by file: - -If you are using YAML: - -.. code-block:: yaml - - --- - builders: - - type: Nimbula KVM - account: - file: "/home/joris/accounts/nimbula-account.yml" - hardwareSettings: - memory: 1024 - installation: - diskSize: 2000 - imageListName: "/usharesoft/administrator/myimages" - imageVersion: '1' - description: CentOS Core Image - -If you are using JSON: - -.. code-block:: json - - { - "builders": [ - { - "type": "Nimbula KVM", - "account": { - "file": "/home/joris/accounts/nimbula-account.json" - }, - "hardwareSettings": { - "memory": 1024 - }, - "installation": { - "diskSize": 2000 - }, - "imageListName": "/usharesoft/administrator/myimages", - "imageVersion": "1", - "description": "CentOS Core Image" - } - ] - } - -Reference by name, note the cloud account must already be created by using ``account create``. - -If you are using YAML: - -.. code-block:: yaml - - --- - builders: - - type: Nimbula KVM - account: - name: My Nimbula Account - hardwareSettings: - memory: 1024 - installation: - diskSize: 2000 - imageListName: "/usharesoft/administrator/myimages" - imageVersion: '1' - description: CentOS Core Image - -If you are using JSON: - -.. code-block:: json - - { - "builders": [ - { - "type": "Nimbula KVM", - "account": { - "name": "My Nimbula Account" - }, - "hardwareSettings": { - "memory": 1024 - }, - "installation": { - "diskSize": 2000 - }, - "imageListName": "/usharesoft/administrator/myimages", - "imageVersion": "1", - "description": "CentOS Core Image" - } - ] - } diff --git a/documentation/en/source/pages/templates-spec/builders/overview.rst b/documentation/en/source/pages/templates-spec/builders/overview.rst index 6176e89e..a9f9bb42 100644 --- a/documentation/en/source/pages/templates-spec/builders/overview.rst +++ b/documentation/en/source/pages/templates-spec/builders/overview.rst @@ -13,7 +13,7 @@ Please refer to the specific machine image format for the mandatory and optional .. rubric:: A Word on Cloud Accounts -For "cloud" machine images, for example Amazon EC2, Azure CloudStack, OpenStack, Flexiant and Eucalyptus, the ``builder`` requires account information to the cloud environment. Information from the builder is used to correctly generate the machine image (for example AMI images for Amazon EC2 requires to have certain certificates embedded into the machine image) and to upload and register the machine image into the correct region, zone or datacenter. +For "cloud" machine images, for example Amazon EC2, Azure CloudStack and OpenStack, the ``builder`` requires account information to the cloud environment. Information from the builder is used to correctly generate the machine image (for example AMI images for Amazon EC2 requires to have certain certificates embedded into the machine image) and to upload and register the machine image into the correct region, zone or datacenter. The cloud account information can be part of the builder section, however as this includes sensitive information, hammr provides other mechanisms to include this information in the builder section. A safer way is to store this information in a separate file (JSON or YAML) and create the cloud account using ``account create``; then reference the account ``name`` in the builder. @@ -25,15 +25,11 @@ Cloud Targets .. toctree:: :titlesonly: - builders-abiquo builders-aws builders-cloudstack - builders-euca - builders-flexiant builders-gce builders-azure builders-k5 - builders-nimbula builders-openstack builders-outscale builders-suse-cloud diff --git a/examples/builders/abiquo-builder.json b/examples/builders/abiquo-builder.json deleted file mode 100644 index b9fd3d4f..00000000 --- a/examples/builders/abiquo-builder.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "builders": [ - { - "type": "abiquo", - "account": { - "type": "abiquo", - "name": "My Abiquo Account", - "hostname": "test.abiquo.com", - "username": "myLogin", - "password": "myPassWD" - }, - "hardwareSettings": { - "memory": 1024 - }, - "installation": { - "diskSize": 2000 - }, - "enterprise": "UShareSoft", - "datacenter": "London", - "productName": "CentOS Core", - "category": "OS", - "description": "CentOS Core template." - } - ] -} diff --git a/examples/builders/eucalyptus-builder.json b/examples/builders/eucalyptus-builder.json deleted file mode 100644 index 1a75a53c..00000000 --- a/examples/builders/eucalyptus-builder.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "builders": [ - { - "type": "eucalyptus-kvm", - "account": { - "type": "eucalyptus", - "name": "My Eucalyptus Account", - "accountNumber": "111122223333", - "x509PrivateKey": "/home/joris/accounts/euca/euca-pk.pem", - "x509Cert": "/home/joris/accounts/euca/euca-cert.pem", - "cloudCert": "/home/joris/accounts/euca/cloud-cert.pem", - "endpoint": "http://127.0.0.1/8773", - "queryId": "WkVpyXXZ77rXcdeSbds3lkXcr5Jc4GeUtkA", - "secretKey": "ir9CKRvOXXTHJXXj8VPRXX7PgxxY9DY0VLng" - }, - "imageName": "CentOS Core", - "description": "CentOS Base Image", - "bucket": "ussprodbucket" - } - ] -} diff --git a/examples/builders/flexiant-builder.json b/examples/builders/flexiant-builder.json deleted file mode 100644 index 534f1596..00000000 --- a/examples/builders/flexiant-builder.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "builders": [ - { - "type": "Flexiant RAW - KVM/Xen", - "account": { - "type": "Flexiant", - "name": "My Flexiant account", - "apiUsername": "name@domain.com/mykey1111", - "password": "mypassword", - "wsdlUrl": "myWsdlurl" - }, - "hardwareSettings": { - "memory": 1024 - }, - "installation": { - "diskSize": 2000 - }, - "virtualDatacenterName": "KVM (CEPH Cluster)", - "machineImageName": "test_hammr", - "diskOffering": "21 GB" - } - ] -} diff --git a/examples/builders/generate-only-builder.json b/examples/builders/generate-only-builder.json index eb46bfca..cafc5ed5 100644 --- a/examples/builders/generate-only-builder.json +++ b/examples/builders/generate-only-builder.json @@ -81,24 +81,6 @@ "diskSize" : 2000 } }, - { - "type" : "nimbula-esx", - "hardwareSettings" : { - "memory" : 1024 - }, - "installation" : { - "diskSize" : 2000 - } - }, - { - "type" : "nimbula-kvm", - "hardwareSettings" : { - "memory" : 1024 - }, - "installation" : { - "diskSize" : 2000 - } - }, { "type" : "openstack", "hardwareSettings" : { @@ -108,57 +90,6 @@ "diskSize" : 2000 } }, - { - "type" : "eucalyptus-xen", - "hardwareSettings" : { - "memory" : 1024 - }, - "installation" : { - "diskSize" : 2000 - }, - "account": { - "name": "My Eucalyptus" - } - }, - { - "type" : "eucalyptus-kvm", - "hardwareSettings" : { - "memory" : 1024 - }, - "installation" : { - "diskSize" : 2000 - }, - "account": { - "name": "My Eucalyptus" - } - }, - { - "type" : "flexiant-raw", - "hardwareSettings" : { - "memory" : 1024 - }, - "installation" : { - "diskSize" : 2000 - } - }, - { - "type" : "flexiant-ova", - "hardwareSettings" : { - "memory" : 1024 - }, - "installation" : { - "diskSize" : 2000 - } - }, - { - "type" : "flexiant-kvm", - "hardwareSettings" : { - "memory" : 1024 - }, - "installation" : { - "diskSize" : 2000 - } - }, { "type" : "cloudstack-qcow2", "hardwareSettings" : { @@ -186,15 +117,6 @@ "diskSize" : 2000 } }, - { - "type" : "abiquo", - "hardwareSettings" : { - "memory" : 1024 - }, - "installation" : { - "diskSize" : 2000 - } - }, { "type" : "azure", "hardwareSettings" : { diff --git a/examples/builders/nimbula-builder.json b/examples/builders/nimbula-builder.json deleted file mode 100644 index e134b0d7..00000000 --- a/examples/builders/nimbula-builder.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "builders": [ - { - "type": "nimbula-kvm", - "account": { - "type": "nimbula", - "name": "My Nimbula Account", - "endpoint": "http://20.20.20.201", - "username": "myLogin", - "password": "myPassWD" - }, - "hardwareSettings": { - "memory": 1024 - }, - "installation": { - "diskSize": 2000 - }, - "imageListName": "/usharesoft/administrator/myimages", - "imageVersion": "1", - "description": "CentOS Core Image" - } - ] -} diff --git a/examples/builders/publish-builder.json b/examples/builders/publish-builder.json index 0b4ee73f..3b31fdd1 100644 --- a/examples/builders/publish-builder.json +++ b/examples/builders/publish-builder.json @@ -57,71 +57,6 @@ }, "storageAccount": "testjoris", "location": "West Europe" -}, - { - "type" : "flexiant-kvm", - "hardwareSettings" : { - "memory" : 1024 - }, - "installation" : { - "diskSize" : 2000 - }, - "account": { - "name": "MyFlexiant" - }, - "imageName": "testjorisuss", - "datacenterUUID": "c8c1873f-799c-3453-b46c-f5db63116b05", - "productUUID": "61afdd81-43d9-39b5-9150-cffe9071b1b9" - }, - { - "type" : "abiquo", - "hardwareSettings" : { - "memory" : 1024 - }, - "installation" : { - "diskSize" : 2000 - }, - "account": { - "name": "MyAbiquo" - }, - "enterprise": "usharesoft", - "datacenter": "London", - "productName": "testjorisuss", - "category": "OS", - "description": "test joris uss" -}, - { - "type" : "nimbula-kvm", - "hardwareSettings" : { - "memory" : 1024 - }, - "installation" : { - "diskSize" : 2000 - }, - "account": { - "name": "MyNimbula" - }, - "imageListName": "/usharesoft/administrator/myimages", - "imageVersion": "1", - "description": "my description" -}, - { - "type" : "eucalyptus-kvm", - "hardwareSettings" : { - "memory" : 1024 - }, - "installation" : { - "diskSize" : 2000 - }, - "account": { - "name": "MyEucalptus" - }, - "imageName": "myName", - "description": "desc of my template", - "bucket": "prodWS", - "kernelId": "123456", - "ramdisk": "123456" } - ] } diff --git a/examples/cloud_accounts/abiquo-account.json b/examples/cloud_accounts/abiquo-account.json deleted file mode 100644 index beec3e97..00000000 --- a/examples/cloud_accounts/abiquo-account.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "accounts": [ - { - "type": "abiquo", - "name": "My Abiquo Account" - "hostname": "test.abiquo.com", - "username": "myLogin", - "password": "myPassWD" - } - ] -} diff --git a/examples/cloud_accounts/eucalyptus-account.json b/examples/cloud_accounts/eucalyptus-account.json deleted file mode 100644 index 72bad009..00000000 --- a/examples/cloud_accounts/eucalyptus-account.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "accounts": [ - { - "type": "eucalyptus", - "name": "My Eucalyptus Account", - "accountNumber": "111122223333", - "x509PrivateKey": "/home/joris/accounts/euca/euca-pk.pem", - "x509Cert": "/home/joris/accounts/euca/euca-cert.pem", - "cloudCert": "/home/joris/accounts/euca/cloud-cert.pem", - "endpoint": "http://127.0.0.1/8773", - "queryId": "WkVpyXXZ77rXcdeSbds3lkXcr5Jc4GeUtkA", - "secretKey": "ir9CKRvOXXTHJXXj8VPRXX7PgxxY9DY0VLng" - } - ] -} diff --git a/examples/cloud_accounts/flexiant-account.json b/examples/cloud_accounts/flexiant-account.json deleted file mode 100644 index 7308d493..00000000 --- a/examples/cloud_accounts/flexiant-account.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "accounts": [ - { - "type": "Flexiant", - "name": "My Flexiant account", - "apiUsername": "name@domain.com/mykey1111", - "password": "mypassword", - "wsdlUrl": "myWsdlurl" - } - ] -} diff --git a/examples/cloud_accounts/nimbula-account.json b/examples/cloud_accounts/nimbula-account.json deleted file mode 100644 index afa5a82d..00000000 --- a/examples/cloud_accounts/nimbula-account.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "accounts": [ - { - "type": "nimbula", - "name": "My Nimbula Account", - "endpoint": "http://20.20.20.201", - "username": "myLogin", - "password": "myPassWD" - } - ] -} diff --git a/hammr-release.sh b/hammr-release.sh new file mode 100755 index 00000000..a2541bbc --- /dev/null +++ b/hammr-release.sh @@ -0,0 +1,310 @@ +#!/bin/bash +# What is doing this script ? +# This script is automating stuff we use to do by hand to release Hammr +# He's performing in the first place some checks (run inside build-env, not existing directories, existing uforge-python-sdk version ...) to run correctly +# Then displaying a welcome message with the resume of what has been passed as arguments and some agreements regarding what he is doing and what you +# should do if he fails. + +#Used to write bold in terminal to enforce some terms +bold=$(tput bold) +normal=$(tput sgr0) +boldify () { + echo ${bold}${1}${normal} +} + +#Describe how to use the tool +usage () { + echo "Usage : " + echo "hammr-release -b -v [-p ]" + echo " -b ) The remote branch to use for building hammr" + echo " -v ) The hammr version to release" + echo " -p ) The python_sdk_version to use for building hammr, by default using the same version as hammr" + echo " Example for a 3.8.1 RC release : hammr-release -b master -v 3.8.1-RC1 -p 3.8.1-RC1" + echo " Example for an official release : hammr-release -b master -v 3.8.1 -p 3.8.1" + exit 1 +} + +#Get steps +get_step () { + case ${1} in + 1) echo "::::::::::: First step : upload to Pypi the new Hammr $HAMMR_VERSION artifact";; + 2) echo "::::::::::: Second step : commit the changes in Hammr repository";; + 3) echo "::::::::::: Third step : create a github annotated tag $HAMMR_VERSION for the release";; + 4) echo "::::::::::: Fourth step : commit in Hammr repository a new setup.py version with uforge-python-sdk>=$HAMMR_VERSION";; + 5) echo "::::::::::: Fifth step : create a pull request to merge the release branch inside $GIT_BASE_BRANCH";; + esac +} + +#Clean working directory +clean_directory () { + if [ -d $WORKING_DIRECTORY ]; then + echo "Cleaning the working directory ... " + rm -rf $WORKING_DIRECTORY + fi +} + +#In case of failure, display remaining steps +steps_remaining () { + if [ "$STEP_COMPLETED" -ge "1" ] && [ "$STEP_COMPLETED" -ne "$NB_STEPS" ]; then + echo "Please visit $WORKING_DIRECTORY to see the repository state and perform by hand the following steps : " + FROM=$((STEP_COMPLETED + 1)) + TO=$((NB_STEPS)) + for (( i=$FROM; i<=$TO; i++ )) + do + RESULT=$(get_step $i) + echo $RESULT + done + fi +} + +#Error in the release process +release_failed () { + echo " ______ _____ _____ ____ _____ " + echo " | ____| __ \| __ \ / __ \| __ \ " + echo " | |__ | |__) | |__) | | | | |__) | " + echo " | __| | _ /| _ /| | | | _ / " + echo " | |____| | \ \| | \ \| |__| | | \ \ " + echo " |______|_| \_\_| \_\\\____/|_| \_\ " + echo "" + echo "Hammr release $HAMMR_VERSION failed" + echo "${1}" + steps_remaining + exit 1 +} + +#Get the return status of the latest command and print an error if needed +verify_latest_command () { + if [ $? -ne 0 ]; then + release_failed "${1}" + fi +} + +#Add modified files in the stage and committed with the given message. +#Finally pushed to the specified branch +commit_and_push_changes () { + FILES="setup.py hammr/utils/constants.py" + git add $FILES + verify_latest_command "Cannot add $FILES in the stage for commit" + git commit -m "${1}" + verify_latest_command "Cannot commit $FILES" + git push origin $HAMMR_RELEASE_BRANCH + verify_latest_command "Cannot push the changes on the remote server" +} + +#Manage steps, variable used to specify which steps are remaining if there is a failure +STEP_COMPLETED=0 +step_completed () { + STEP_COMPLETED=${1} + echo "" + echo "" + echo "" + echo " _____ _ _ _ " + echo " / ____| | | | | | |" + echo " | | ___ _ __ ___ _ __ | | ___| |_ ___ __| |" + echo " | | / _ \| '_ \` _ \| '_ \| |/ _ \ __/ _ \/ _\` |" + echo " | |___| (_) | | | | | | |_) | | __/ || __/ (_| |" + echo " \_____\___/|_| |_| |_| .__/|_|\___|\__\___|\__,_|" + echo " | | " + echo " |_| " + echo "" +} + +#Display which step is running +display_running_step () { + STEP_TO_COMPLETE=$(($STEP_COMPLETED + 1)) + RESULT=$(get_step $STEP_TO_COMPLETE) + echo "$RESULT running ..." +} + +#Display terminated string +terminated () { + echo "" + echo "#######################################################" + echo " _____ _ _ _ " + echo "|_ _|__ _ __ _ __ ___ (_)_ __ __ _| |_ ___ __| |" + echo " | |/ _ \ '__| '_ \` _ \| | '_ \ / _\` | __/ _ \/ _\` |" + echo " | | __/ | | | | | | | | | | | (_| | || __/ (_| |" + echo " |_|\___|_| |_| |_| |_|_|_| |_|\__,_|\__\___|\__,_|" + echo "" + echo "#######################################################" + echo "" +} + +# trap ctrl-c and call ctrl_c() +trap ctrl_c INT +function ctrl_c() { + echo "" + echo "Exiting by user CTRL-C" + steps_remaining + exit 1 +} + +#Parsing arguments +while getopts :b:v:p: options; do + case $options in + b) GIT_BASE_BRANCH=${OPTARG} ;; + v) HAMMR_VERSION=${OPTARG} ;; + p) SDK_VERSION=${OPTARG} ;; + \?) printf "illegal option: -%s\n" "$OPTARG" >&2 + usage + ;; + esac +done +shift $(($OPTIND - 1)) + +#Setting sdk version with hammr version if not specified by the user +if [ ! "$SDK_VERSION" ]; then + SDK_VERSION=$HAMMR_VERSION +fi + +#Setting the directory used for the release and Hammr url +WORKING_DIRECTORY="$HOME/hammr-release-$HAMMR_VERSION" +HAMMR_REPO="usharesoft/hammr" +GIT_ADDRESS="https://github.com" +GIT_API_ADDRESS="https://api.github.com" +NB_STEPS=5 +HAMMR_RELEASE_BRANCH="release-script-$HAMMR_VERSION" + +#Verifying pre-requisite +#Mandatory arguments +if [ ! "$HAMMR_VERSION" ] || [ ! "$GIT_BASE_BRANCH" ]; then + usage +fi +#Must be inside build env +if [ $HOME != "/home/ussrelease" ]; then + release_failed "The release script automation must be executed inside build-env container" +fi +#Must have a file with pypi credentials +if [ ! -f "$HOME/.pypirc" ]; then + release_failed "The PyPI UShareSoft credentials file shoud be present in $HOME/.pypirc" +fi +#The directory used for release must not exists on the filesystem +if [ -d "$WORKING_DIRECTORY" ]; then + release_failed "The directory \""$WORKING_DIRECTORY"\", used for the release, must not exists on the filesystem" +fi +# Verify uforge-python-sdk version is available on Pypi +PYPI_URL="https://pypi.org/project" +STATUS=$(curl -o /dev/null --silent --head --write-out '%{http_code}' "$PYPI_URL/uforge_python_sdk/$SDK_VERSION/") +if [ $STATUS -ne 200 ] && [ $STATUS -ne 301 ]; then + release_failed "uforge_python_sdk $SDK_VERSION is not available on $PYPI_URL" +fi +#Verify hammr version we are releasing is not on Pypi +STATUS=$(curl -o /dev/null --silent --head --write-out '%{http_code}' "$PYPI_URL/hammr/$HAMMR_VERSION/") +if [ $STATUS -eq 200 ]; then + release_failed "hammr $HAMMR_VERSION is already available on $PYPI_URL" +fi + +#Welcome message +HAMMR_VERSION_BOLD=$(boldify "$HAMMR_VERSION") +GIT_BASE_BRANCH_BOLD=$(boldify "$GIT_BASE_BRANCH") +SDK_VERSION_BOLD=$(boldify "$SDK_VERSION") + +echo "" +echo "#############################################" +echo " __ __ _ " +echo " \ \ / / | | " +echo " \ \ /\ / /__| | ___ ___ _ __ ___ ___ " +echo " \ \/ \/ / _ \ |/ __/ _ \| '_ \` _ \ / _ \\" +echo " \ /\ / __/ | (_| (_) | | | | | | __/" +echo " \/ \/ \___|_|\___\___/|_| |_| |_|\___|" +echo "" +echo "#############################################" +echo "" +echo "Hammr release version : $HAMMR_VERSION_BOLD" +echo "Hammr remote branch : $GIT_BASE_BRANCH_BOLD" +echo "uforge-python-sdk version : $SDK_VERSION_BOLD" +echo "working directory : $WORKING_DIRECTORY" +echo "" +echo "" +echo "This release is composed of $NB_STEPS steps that should complete successfully." +echo "" +for (( i=1; i<=$NB_STEPS; i++ )) +do + RESULT=$(get_step $i) + echo $RESULT +done +echo "" +echo "If one step is completed but not the others, you should complete by hand the process to remain in a stable state." +echo "" + +#Ask for agreement to perform the release +echo "Do you really want to build Hammr $HAMMR_VERSION_BOLD from branch $GIT_BASE_BRANCH_BOLD (on repo $GIT_ADDRESS/$HAMMR_REPO) with uforge-python-sdk $SDK_VERSION_BOLD ? Y/n" +read AGREE +if [ -n "$AGREE" ]; then + if [ "$AGREE" != "y" ] && [ "$AGREE" != "Y" ]; then + echo "Release abandonned" + exit 1 + fi +fi + +display_running_step + +#Clone hammr with only the branch specified by the user +git clone $GIT_ADDRESS/$HAMMR_REPO --branch $GIT_BASE_BRANCH --single-branch $WORKING_DIRECTORY +verify_latest_command "Cannot clone hammr repository" + +#Move inside workspace +cd $WORKING_DIRECTORY +verify_latest_command "Cannot change directory, maybe an issue with $WORKING_DIRECTORY creation ... " + +#Create a new branch because push on master are prohibited ... so we are doing it inside a branch and then merge it inside master +git checkout -b $HAMMR_RELEASE_BRANCH +verify_latest_command "Cannot checkout branch" + +#Now we change the version of Hammr and SDK +sed -i "s/'uforge_python_sdk.*'/'uforge_python_sdk==$SDK_VERSION'/g" setup.py +sed -i "s/VERSION=.*/VERSION=\"$HAMMR_VERSION\"/g" ./hammr/utils/constants.py + +# Then we build and push the artifact to Pypi +python setup.py clean bdist_wheel sdist bdist_egg bdist_wininst --plat-name=win32 +verify_latest_command "Cannot build hammr artifact ... " + + +#Upload on pypi +twine upload -r pypi-official dist/* +if [ $? -ne 0 ]; then + release_failed "Cannot upload hammr artifact ... " +fi + +step_completed 1 +display_running_step + +#Finally, we can commit what we have done +#need to create a branch for PR, cannot push in master +commit_and_push_changes "Hammr release new version $HAMMR_VERSION" + +step_completed 2 +display_running_step + +#Then we create a tag and push it to the server +git tag -a "$HAMMR_VERSION" -m "Hammr release new version $HAMMR_VERSION" +git push origin "$HAMMR_VERSION" + +step_completed 3 +display_running_step + +#ie : we are using >= to enable the CI in github to work with .dev packages for pull request +sed -i "s/'uforge_python_sdk.*'/'uforge_python_sdk>=$SDK_VERSION'/g" setup.py +commit_and_push_changes "Hammr release $HAMMR_VERSION done, prepare next version." + +step_completed 4 +display_running_step + +#Final step the pull request +echo "Username for $GIT_API_ADDRESS :" +read USERNAME +STATUS=$(curl -o /dev/null --silent --write-out '%{http_code}' --user "$USERNAME" --request POST --data '{"title":"Hammr release new version '$HAMMR_VERSION'","body":"Hammr release new version '$HAMMR_VERSION'","head":"'$HAMMR_RELEASE_BRANCH'","base":"'$GIT_BASE_BRANCH'"}' $GIT_API_ADDRESS/repos/$HAMMR_REPO/pulls) +if [ $STATUS -ne 201 ]; then + release_failed "Cannot create the pull request to integrate $HAMMR_RELEASE_BRANCH into $GIT_BASE_BRANCH" +fi + +step_completed 5 + +clean_directory + +terminated + +echo "Tag created on github : $HAMMR_VERSION" +echo "Please draft a new release at $GIT_ADDRESS/$HAMMR_REPO/releases/new" +echo "Hammr $HAMMR_VERSION should be available at https://pypi.org/project/hammr/" +exit 0 diff --git a/hammr/commands/image/image.py b/hammr/commands/image/image.py index 9d7ddbd2..4efd436a 100644 --- a/hammr/commands/image/image.py +++ b/hammr/commands/image/image.py @@ -64,7 +64,7 @@ def do_list(self, args): else: printer.out("Images:") table = Texttable(800) - table.set_cols_dtype(["t", "t", "t", "t", "t", "t", "t", "c", "t"]) + table.set_cols_dtype(["t", "t", "t", "t", "t", "t", "t", "t", "t"]) table.header( ["Id", "Name", "Version", "Rev.", "Format", "Created", "Size", "Compressed", "Generation Status"]) images = generics_utils.order_list_object_by(images, "name") @@ -294,7 +294,7 @@ def do_delete(self, args): printer.out("No images available") else: table = Texttable(800) - table.set_cols_dtype(["t", "t", "t", "t", "t", "t", "t", "c", "t"]) + table.set_cols_dtype(["t", "t", "t", "t", "t", "t", "t", "t", "t"]) table.header(["Id", "Name", "Version", "Rev.", "Format", "Created", "Size", "Compressed", "Status"]) deleteImage = None for image in images: @@ -348,7 +348,7 @@ def do_cancel(self, args): printer.out("No images available") else: table = Texttable(800) - table.set_cols_dtype(["t", "t", "t", "t", "t", "t", "t", "c", "t"]) + table.set_cols_dtype(["t", "t", "t", "t", "t", "t", "t", "t", "t"]) table.header(["Id", "Name", "Version", "Rev.", "Format", "Created", "Size", "Compressed", "Status"]) cancelImage = None for image in images: diff --git a/hammr/utils/account_utils.py b/hammr/utils/account_utils.py index b8af9b7c..227db4e2 100644 --- a/hammr/utils/account_utils.py +++ b/hammr/utils/account_utils.py @@ -225,148 +225,6 @@ def azure_classic(account): return myCredAccount - -def eucalyptus(account): - myCredAccount = CredAccountEws() - # doing field verification - if not "secretKey" in account: - printer.out("secretKey in eucalyptus account not found", printer.ERROR) - return - if not "queryId" in account: - printer.out("queryId in eucalyptus account not found", printer.ERROR) - return - if not "endpoint" in account: - printer.out("endpoint in eucalyptus account not found", printer.ERROR) - return - if not "cloudCert" in account: - printer.out("cloudCert in eucalyptus account not found", printer.ERROR) - return - if not "x509Cert" in account: - printer.out("x509Cert in eucalyptus account not found", printer.ERROR) - return - if not "x509PrivateKey" in account: - printer.out("x509PrivateKey in azure eucalyptus not found", printer.ERROR) - return - if not "accountNumber" in account: - printer.out("accountNumber for eucalyptus account not found", printer.ERROR) - return - if not "name" in account: - printer.out("name for eucalyptus account not found", printer.ERROR) - return - - myCredAccount.accountNumber = account["accountNumber"] - myCredAccount.name = account["name"] - myCredAccount.hostname = account["endpoint"] - myCredAccount.secretAccessKeyID = account["secretKey"] - myCredAccount.accessKeyID = account["queryId"] - - myCertificates = certificates() - myCredAccount.certificates = myCertificates - - try: - myCertificate = certificate() - with open(account["x509Cert"], "r") as myfile: - myCertificate.certStr = myfile.read() - myCertificate.type_ = "x509" - myCertificate.name = ntpath.basename(account["x509Cert"]) - myCertificates.add_certificate(myCertificate) - myCertificate = certificate() - with open(account["x509PrivateKey"], "r") as myfile: - myCertificate.certStr = myfile.read() - myCertificate.type_ = "ec2PrivateKey" - myCertificate.name = ntpath.basename(account["x509PrivateKey"]) - myCertificates.add_certificate(myCertificate) - myCertificate = certificate() - with open(account["cloudCert"], "r") as myfile: - myCertificate.certStr = myfile.read() - myCertificate.type_ = "eucCert" - myCertificate.name = ntpath.basename(account["cloudCert"]) - myCertificates.add_certificate(myCertificate) - - - except IOError as e: - printer.out("File error: " + str(e), printer.ERROR) - return - - return myCredAccount - - -def abiquo(account): - myCredAccount = CredAccountAbiquo() - # doing field verification - if not "password" in account: - printer.out("password in abiquo account not found", printer.ERROR) - return - if not "username" in account: - printer.out("username in abiquo account not found", printer.ERROR) - return - if not "hostname" in account: - printer.out("hostname for abiquo account not found", printer.ERROR) - return - if not "name" in account: - printer.out("name for abiquo account not found", printer.ERROR) - return - - myCredAccount.login = account["username"] - myCredAccount.password = account["password"] - myCredAccount.hostname = account["hostname"] - myCredAccount.name = account["name"] - return myCredAccount - - -def nimbula(account): - myCredAccount = CredAccountNimbula() - # doing field verification - if not "password" in account: - printer.out("password in nimbula account not found", printer.ERROR) - return - if not "username" in account: - printer.out("username in nimbula account not found", printer.ERROR) - return - if not "endpoint" in account: - printer.out("endpoint for nimbula account not found", printer.ERROR) - return - if not "name" in account: - printer.out("name for nimbula account not found", printer.ERROR) - return - - myCredAccount.login = account["username"] - myCredAccount.password = account["password"] - myCredAccount.serverUrl = account["endpoint"] - myCredAccount.name = account["name"] - return myCredAccount - - -def flexiant(account): - myCredAccount = CredAccountFlexiant() - # doing field verification - if not "apiUsername" in account: - printer.out("apiUsername in flexiant account not found", printer.ERROR) - return - if not "password" in account: - printer.out("password in flexiant account not found", printer.ERROR) - return - if not "wsdlUrl" in account: - printer.out("wsdlURL for flexiant account not found", printer.ERROR) - return - if not "name" in account: - printer.out("name for flexiant account not found", printer.ERROR) - return - - myCredAccount.apiUsername = account["apiUsername"] - myCredAccount.password = account["password"] - myCredAccount.wsdlUrl = account["wsdlUrl"] - myCredAccount.name = account["name"] - - try: - myCredAccount.userUUID = (myCredAccount.apiUsername).split('/')[1] - except: - printer.out(account["apiUsername"] + " is not a valid Flexiant username", printer.ERROR) - return - - return myCredAccount - - def vclouddirector(account): myCredAccount = CredAccountVCloudDirector() # doing field verification diff --git a/hammr/utils/constants.py b/hammr/utils/constants.py index 4759b48d..853a106b 100644 --- a/hammr/utils/constants.py +++ b/hammr/utils/constants.py @@ -18,8 +18,7 @@ import os import tempfile -VERSION="3.7.8" - +VERSION="3.8.0.7" TMP_WORKING_DIR=tempfile.gettempdir() + os.sep + "hammr-" + str(os.getpid()) HTTP_TIMEOUT=120 diff --git a/hammr/utils/generate_utils.py b/hammr/utils/generate_utils.py index 37648329..ffd4d0aa 100644 --- a/hammr/utils/generate_utils.py +++ b/hammr/utils/generate_utils.py @@ -30,22 +30,6 @@ def generate_vcd(image, builder, installProfile, api, login): return image, installProfile -def generate_nimbula(image, builder, installProfile, api, login): - installProfile = get_memory_amount(builder, installProfile, True) - if installProfile == 2: - return None, None, None - image.compress = True - return image, installProfile - - -def generate_nimbulaesx(image, builder, installProfile, api, login): - return generate_nimbula(image, builder, installProfile, api, login) - - -def generate_nimbulakvm(image, builder, installProfile, api, login): - return generate_nimbula(image, builder, installProfile, api, login) - - def generate_openstackqcow2(image, builder, installProfile, api, login): image.compress = False return image, installProfile @@ -70,65 +54,6 @@ def generate_susecloud(image, builder, installProfile, api, login): image.compress = False return image, installProfile - -def generate_eucalyptus(image, builder, installProfile, api, login): - if not "account" in builder: - printer.out("Account not found in builder", printer.ERROR) - return None, None, None - - accounts = api.Users(login).Accounts.Getall() - if accounts is None or not accounts.get_credAccount(): - printer.out("No accounts available", printer.ERROR) - return None, None, None - else: - for account in accounts.get_credAccount(): - if account.name == builder["account"]["name"]: - image.credAccount = account - break - - if "disableRootLogin" in builder: - myrootUser = osUser() - if builder["disableRootLogin"] == "true": - val = True - elif builder["disableRootLogin"] == "false": - val = False - else: - printer.out("Unknown value for 'disableRootLogin' in builder [ami]", printer.ERROR) - return None, None, None - myrootUser.disablePasswordLogin = val - installProfile.rootUser = myrootUser - - image.compress = False - return image, installProfile - - -def generate_eucalyptusxen(image, builder, installProfile, api, login): - return generate_eucalyptus(image, builder, installProfile, api, login) - - -def generate_eucalyptuskvm(image, builder, installProfile, api, login): - return generate_eucalyptus(image, builder, installProfile, api, login) - - -def generate_flexiant(image, builder, installProfile, api, login): - installProfile = get_memory_amount(builder, installProfile, True) - # Compress is mandatory - image.compress = True - return image, installProfile - - -def generate_flexiantraw(image, builder, installProfile, api, login): - return generate_flexiant(image, builder, installProfile, api, login) - - -def generate_flexiantova(image, builder, installProfile, api, login): - return generate_flexiant(image, builder, installProfile, api, login) - - -def generate_flexiantkvm(image, builder, installProfile, api, login): - return generate_flexiant(image, builder, installProfile, api, login) - - def generate_cloudstackqcow2(image, builder, installProfile, api, login): installProfile = get_memory_amount(builder, installProfile, True) if installProfile == 2: @@ -152,17 +77,6 @@ def generate_cloudstackova(image, builder, installProfile, api, login): image.compress = True return image, installProfile - -def generate_abiquo(image, builder, installProfile, api, login): - installProfile = get_memory_amount(builder, installProfile, True) - if installProfile == 2: - return None, None, None - if "hwType" in builder["hardwareSettings"]: - installProfile.hwType = builder["hardwareSettings"]["hwType"] - image.compress = False - return image, installProfile - - def generate_azure(image, builder, installProfile, api, login): image.compress = False return image, installProfile diff --git a/hammr/utils/publish_utils.py b/hammr/utils/publish_utils.py index d081d3eb..0a5b512b 100644 --- a/hammr/utils/publish_utils.py +++ b/hammr/utils/publish_utils.py @@ -17,24 +17,25 @@ from uforge.objects.uforge import * -def publish_vcd(pimage, builder): +def publish_vcd(builder): + pimage = PublishImageVCloudDirector() + # doing field verification - if not "orgName" in builder: - printer.out("orgName in vcd builder not found", printer.ERROR) + if not "displayName" in builder: + printer.out("displayName in vcd builder not found", printer.ERROR) return if not "catalogName" in builder: printer.out("catalogName in vcd builder not found", printer.ERROR) return - if not "imageName" in builder: - printer.out("imageName in vcd builder not found", printer.ERROR) + if not "vdcName" in builder: + printer.out("vdcName in vcd builder not found", printer.ERROR) return - pimage.credAccount.organizationName = builder["orgName"] - pimage.credAccount.catalogId = builder["catalogName"] - pimage.credAccount.displayName = builder["imageName"] + pimage.displayName = builder["displayName"] + pimage.catalogName = builder["catalogName"] + pimage.vdcName = builder["vdcName"] return pimage - def publish_vcenter(builder): pimage = PublishImageVSphere() @@ -91,23 +92,30 @@ def publish_cloudstack_ova(pimage, builder): return publish_cloudstack(pimage, builder) -def publish_susecloud(pimage, builder): +def publish_susecloud(builder): + pimage = PublishImageSuseCloud() + # doing field verification - if not "imageName" in builder: - printer.out("imageName in susecloud builder not found", printer.ERROR) + if not "keystoneDomain" in builder: + printer.out("keystoneDomain in susecloud builder not found", printer.ERROR) return - if not "tenant" in builder: - printer.out("tenant in susecloud builder not found", printer.ERROR) + if not "keystoneProject" in builder: + printer.out("keystoneProject in susecloud builder not found", printer.ERROR) + return + if not "displayName" in builder: + printer.out("displayName in susecloud builder not found", printer.ERROR) + return + if not "tenantName" in builder: + printer.out("tenantName in susecloud builder not found", printer.ERROR) return - if "description" in builder: - pimage.credAccount.description = builder["description"] - pimage.credAccount.displayName = builder["imageName"] - pimage.credAccount.tenantName = builder["tenant"] + pimage.keystoneDomain = builder["keystoneDomain"] + pimage.keystoneProject = builder["keystoneProject"] + pimage.displayName = builder["displayName"] + pimage.tenantName = builder["tenantName"] + if "publicImage" in builder: - pimage.credAccount.publicImage = True if (builder["publicImage"] == "true") else False - # if "paraVirtualMode" in builder: - # pimage.credAccount. = True if (builder["paraVirtualMode"]=="true") else False + pimage.publicImage = True if (builder["publicImage"] == "true") else False return pimage @@ -220,125 +228,9 @@ def publish_azure_arm(builder): return pimage +def publish_google(builder): + pimage = PublishImageGoogle() -def publish_flexiant(builder): - pimage = PublishImageFlexiant() - - # doing field verification - if not "diskOffering" in builder: - printer.out("diskOffering in flexiant builder not found", printer.ERROR) - return - if not "virtualDatacenterName" in builder: - printer.out("virtualDatacenterName in flexiant builder not found", printer.ERROR) - return - if not "machineImageName" in builder: - printer.out("machineImageName in flexiant builder not found", printer.ERROR) - return - - pimage.diskOffering = builder["diskOffering"] - pimage.virtualDatacenterName = builder["virtualDatacenterName"] - pimage.machineImageName = builder["machineImageName"] - - return pimage - - -def publish_flexiant_kvm(pimage, builder): - return publish_flexiant(pimage, builder) - - -def publish_flexiant_ova(pimage, builder): - return publish_flexiant(pimage, builder) - - -def publish_flexiantraw(builder): - return publish_flexiant(builder) - - -def publish_abiquo(pimage, builder): - # doing field verification - if not "enterprise" in builder: - printer.out("enterprise in abiquo builder not found", printer.ERROR) - return - if not "datacenter" in builder: - printer.out("datacenter in abiquo builder not found", printer.ERROR) - return - if not "productName" in builder: - printer.out("productName in abiquo builder not found", printer.ERROR) - return - if not "category" in builder: - printer.out("category in abiquo builder not found", printer.ERROR) - return - if not "description" in builder: - printer.out("description in abiquo builder not found", printer.ERROR) - return - - pimage.credAccount.datacenterName = builder["datacenter"] - pimage.credAccount.displayName = builder["productName"] - pimage.credAccount.category = builder["category"] - pimage.credAccount.organizationName = builder["enterprise"] - pimage.credAccount.description = builder["description"] - - return pimage - - -def publish_nimbula(pimage, builder): - # doing field verification - if not "imageListName" in builder: - printer.out("imageListName in nimbula builder not found", printer.ERROR) - return - if not "imageVersion" in builder: - printer.out("imageVersion in nimbula builder not found", printer.ERROR) - return - if not "description" in builder: - printer.out("description in nimbula builder not found", printer.ERROR) - return - - pimage.credAccount.imageVersion = builder["imageVersion"] - pimage.credAccount.description = builder["description"] - pimage.credAccount.listName = builder["imageListName"] - - return pimage - - -def publish_nimbula_kvm(pimage, builder): - return publish_nimbula(pimage, builder) - - -def publish_nimbula_esx(pimage, builder): - return publish_nimbula(pimage, builder) - - -def publish_eucalyptus(pimage, builder): - # doing field verification - if not "imageName" in builder: - printer.out("imageName in Eucalyptus builder not found", printer.ERROR) - return - if not "description" in builder: - printer.out("description in Eucalyptus builder not found", printer.ERROR) - return - if not "bucket" in builder: - printer.out("bucket in Eucalyptus builder not found", printer.ERROR) - return - - pimage.credAccount.displayName = builder["imageName"] - pimage.credAccount.bucket = builder["bucket"] - pimage.credAccount.description = builder["description"] - if "ramdisk" in builder and "kernelId" in builder: - pimage.credAccount.ramdiskId = builder["ramdisk"] - pimage.credAccount.kernelId = builder["kernelId"] - - return pimage - - -def publish_eucalyptus_kvm(pimage, builder): - return publish_eucalyptus(pimage, builder) - - -def publish_eucalyptus_xen(pimage, builder): - return publish_eucalyptus(pimage, builder) - - -def publish_gce(pimage, builder): # doing field verification if not "computeZone" in builder: printer.out("computeZone in GCE builder not found", printer.ERROR) @@ -360,14 +252,14 @@ def publish_gce(pimage, builder): return if "description" in builder: - pimage.credAccount.description = builder["description"] + pimage.description = builder["description"] - pimage.credAccount.bucket = builder["bucket"] - pimage.credAccount.tenantName = builder["projectId"] - pimage.credAccount.category = builder["storageClass"] - pimage.credAccount.displayName = builder["diskNamePrefix"] - pimage.credAccount.zoneName = builder["computeZone"] - pimage.publishLocation = builder["bucketLocation"] + pimage.bucket = builder["bucket"] + pimage.bucketLocation = builder["bucketLocation"] + pimage.projectId = builder["projectId"] + pimage.storageClass = builder["storageClass"] + pimage.diskNamePrefix = builder["diskNamePrefix"] + pimage.zoneName = builder["computeZone"] return pimage diff --git a/setup.py b/setup.py index b10bad4e..e02ee44b 100644 --- a/setup.py +++ b/setup.py @@ -22,10 +22,11 @@ # Declare your packages' dependencies here, for eg: -# Always put an '==' dependency with uforge_python_sdk -requires=['uforge_python_sdk==3.7.8', +# Always put an '==' dependency with uforge_python_sdk during the release +# During dev we can keep >= in order to get nightly version of sdk for the CI +requires=['uforge_python_sdk==3.8.0.7', 'httplib2==0.9', - 'texttable>=0.8.1', + 'texttable==0.8.1', 'progressbar==2.3', 'argparse', 'paramiko==1.12', @@ -35,7 +36,7 @@ 'termcolor==1.1.0', 'junit-xml==1.3', 'xmlrunner==1.7.7', - 'ussclicore==1.0.9'] + 'ussclicore==1.0.10'] test_requires=['mock'] @@ -51,11 +52,11 @@ def run(self): os.system('rm -vrf '+ROOT_DIR+'/build '+ROOT_DIR+'/dist '+ROOT_DIR+'/*.pyc '+ROOT_DIR+'/*.egg-info') os.system('find '+ROOT_DIR+' -iname "*.pyc" -exec rm {} +') -setup ( +setup ( install_requires=requires, tests_require = test_requires, - + # Fill in these to make your Egg ready for upload to # PyPI name = 'hammr', @@ -81,7 +82,7 @@ def run(self): 'Programming Language :: Python :: 2.6', 'Programming Language :: Python :: 2.7', ), - + # ... custom build command cmdclass={ 'clean': CleanCommand, @@ -89,5 +90,5 @@ def run(self): #long_description= 'Long description of the package', scripts = ['bin/hammr', 'bin/hammr.bat'], - + ) diff --git a/tests/unit/utils/test_publish_utils.py b/tests/unit/utils/test_publish_utils.py index aab440d8..bc90e27b 100644 --- a/tests/unit/utils/test_publish_utils.py +++ b/tests/unit/utils/test_publish_utils.py @@ -244,4 +244,53 @@ def build_azure_classic_builder(self, storageAccount, region): builder = {} if storageAccount is not None: builder["storageAccount"] = storageAccount if region is not None: builder["region"] = region - return builder \ No newline at end of file + return builder + + +class TestPublishGoogle(TestCase): + def test_publish_google_should_return_publish_image_when_valid_entries(self): + # given + builder = self.build_google_builder("computeZone", "bucketLocation", "bucket", "projectId", "storageClass", "diskNamePrefix") + print(builder) + + # when + pimage = publish_google(builder) + + # then + self.assertEqual(pimage.zoneName, builder["computeZone"]) + self.assertEqual(pimage.bucketLocation, builder["bucketLocation"]) + self.assertEqual(pimage.bucket, builder["bucket"]) + self.assertEqual(pimage.projectId, builder["projectId"]) + self.assertEqual(pimage.storageClass, builder["storageClass"]) + self.assertEqual(pimage.diskNamePrefix, builder["diskNamePrefix"]) + + def test_publish_google_should_return_none_when_missing_bucket(self): + # given + builder = self.build_google_builder("computeZone", "bucketLocation", None, "projectId", "storageClass", "diskNamePrefix") + + # when + pimage = publish_google(builder) + + # then + self.assertEqual(pimage, None) + + def test_publish_google_should_return_none_when_missing_project_id(self): + # given + builder = self.build_google_builder("computeZone", "bucketLocation", "bucket", None, "storageClass", "diskNamePrefix") + + # when + pimage = publish_google(builder) + + # then + self.assertEqual(pimage, None) + + def build_google_builder(self, compute_zone, bucket_location, bucket, project_id, storage_class, disk_name_prefix): + builder = {} + if compute_zone is not None: builder["computeZone"] = compute_zone + if bucket_location is not None: builder["bucketLocation"] = bucket_location + if bucket is not None: builder["bucket"] = bucket + if project_id is not None: builder["projectId"] = project_id + if storage_class is not None: builder["storageClass"] = storage_class + if disk_name_prefix is not None: builder["diskNamePrefix"] = disk_name_prefix + + return builder