Exemple #1
0
    def setup(self):
        data = self.init()

        if self.is_tag('package'):
            self.python.setup()
            self.python.setup_package(**self.package)

        if self.is_tag('conf'):
            # setup conf files
            is_updated = filer.template(
                '/etc/heat/heat.conf',
                src='{0}/heat.conf.j2'.format(data['version']),
                data=data,
            )

        if self.is_tag('data') and env.host == env.hosts[0]:
            utils.oscmd('/opt/heat/bin/heat-keystone-setup-domain \
                            --stack-user-domain-name {0} \
                            --stack-domain-admin {1} \
                            --stack-domain-admin-password {2}'.format(
                self.data['stack_user_domain_name'],
                self.data['stack_domain_admin'],
                self.data['stack_domain_admin_password']))

            sudo('{0}/bin/heat-manage db_sync'.format(self.prefix))

        if self.is_tag('conf', 'service'):
            self.enable_services().start_services(pty=False)
            if is_updated:
                self.restart_services(pty=False)
Exemple #2
0
    def basic(self):
        data = self.init()

        if env.host != env.hosts[0]:
            return

        keystone = Keystone()
        keystone.create_user(data["user"], data["password"], [["admin", "admin"]], False)

        glance = Glance()
        image_id = glance.create_image(data["image"]["name"], data["image"]["src_url"])

        net_id = utils.oscmd(
            "neutron net-list | grep ' {0} ' | awk '{{print $2}}'".format(env.cluster["neutron"]["test_net"])
        )

        nova = Nova()
        nova.create_flavor("test-flavor", 62, 2, 1)

        test_stack = {"image_id": image_id, "net_id": net_id, "flavor": "test-flavor"}

        filer.template("/tmp/stack-nova.yml", src="stack/stack-nova.yml", data=test_stack)
        filer.template("/tmp/autoscale.yml", src="stack/autoscale.yml", data=test_stack)

        with api.warn_only():
            result = utils.oscmd("heat stack-list | grep stack-nova")
            if result.return_code == 0:
                utils.oscmd("heat stack-delete -y stack-nova")
                time.sleep(3)
            utils.oscmd("heat stack-create -f /tmp/stack-nova.yml stack-nova")
 def cmd(self, cmd, use_admin_token=True):
     self.init()
     # create users, roles, services
     if use_admin_token:
         endpoint = '{0}/v2.0'.format(self.data['admin_endpoint'])
         with api.shell_env(
                 OS_SERVICE_TOKEN=self.data['admin_token'],
                 OS_SERVICE_ENDPOINT=endpoint,
                 OS_TOKEN=self.data['admin_token'],
                 OS_URL=endpoint,
                 ):
             return run('openstack {0}'.format(cmd))
     else:
         return utils.oscmd('openstack {0}'.format(cmd))
Exemple #4
0
 def cmd(self, cmd):
     self.init()
     return utils.oscmd('glance {0}'.format(cmd))
 def cmd(self, cmd):
     self.init()
     return utils.oscmd('designate {0}'.format(cmd))
Exemple #6
0
 def cmd(self, cmd):
     self.init()
     return utils.oscmd('swift {0}'.format(cmd))
 def cmd(self, cmd):
     self.init()
     return utils.oscmd('ironic {0}'.format(cmd))
Exemple #8
0
 def cmd(self, cmd):
     return utils.oscmd('heat {0}'.format(cmd))
Exemple #9
0
 def cmd(self, cmd):
     self.init()
     return utils.oscmd('manila {0}'.format(cmd))
Exemple #10
0
 def cmd(self, cmd):
     return utils.oscmd("cinder {0}".format(cmd))
 def cmd(self, cmd):
     return utils.oscmd('ceilometer {0}'.format(cmd))
Exemple #12
0
 def cmd(self, cmd):
     return utils.oscmd('aodh {0}'.format(cmd))
Exemple #13
0
 def cmd(self, cmd):
     return utils.oscmd('neutron {0}'.format(cmd))