Ejemplo n.º 1
0
 def test_1001_remove_all_vapp_access(self):
     logged_in_org = self.client.get_org()
     org = Org(self.client, resource=logged_in_org)
     vdc_resource = org.get_vdc(self.config['vcd']['vdc'])
     vdc = VDC(self.client, resource=vdc_resource)
     vapp_resource = vdc.get_vapp(self.config['vcd']['vapp'])
     vapp = VApp(self.client, resource=vapp_resource)
     control_access = vapp.remove_access_settings(remove_all=True)
     self.assertFalse(hasattr(control_access, 'AccessSettings'))
Ejemplo n.º 2
0
 def test_1001_remove_all_vapp_access(self):
     logged_in_org = self.client.get_org()
     org = Org(self.client, resource=logged_in_org)
     vdc_resource = org.get_vdc(self.config['vcd']['vdc'])
     vdc = VDC(self.client, resource=vdc_resource)
     vapp_resource = vdc.get_vapp(self.config['vcd']['vapp'])
     vapp = VApp(self.client, resource=vapp_resource)
     control_access = vapp.remove_access_settings(remove_all=True)
     self.assertFalse(hasattr(control_access, 'AccessSettings'))
Ejemplo n.º 3
0
def remove(ctx, vapp_name, access_list, all):
    try:
        if all:
            click.confirm(
                'Do you want to remove all access settings from the vapp '
                '\'%s\'' % vapp_name,
                abort=True)

        client = ctx.obj['client']
        vdc_href = ctx.obj['profiles'].get('vdc_href')
        vdc = VDC(client, href=vdc_href)
        vapp = VApp(client, resource=vdc.get_vapp(vapp_name))

        vapp.remove_access_settings(
            access_settings_list=acl_str_to_list_of_dict(access_list),
            remove_all=all)
        stdout('Access settings removed from vapp \'%s\'.' % vapp_name, ctx)
    except Exception as e:
        stderr(e, ctx)
Ejemplo n.º 4
0
def remove(ctx, vapp_name, access_list, all):
    try:
        if all:
            click.confirm(
                'Do you want to remove all access settings from the vapp '
                '\'%s\'' % vapp_name,
                abort=True)
        restore_session(ctx, vdc_required=True)
        client = ctx.obj['client']
        vdc_href = ctx.obj['profiles'].get('vdc_href')
        vdc = VDC(client, href=vdc_href)
        vapp = VApp(client, resource=vdc.get_vapp(vapp_name))

        vapp.remove_access_settings(
            access_settings_list=acl_str_to_list_of_dict(access_list),
            remove_all=all)
        stdout('Access settings removed from vapp \'%s\'.' % vapp_name, ctx)
    except Exception as e:
        stderr(e, ctx)
Ejemplo n.º 5
0
 def test_1004_remove_vapp_access(self):
     logged_in_org = self.client.get_org()
     org = Org(self.client, resource=logged_in_org)
     vdc_resource = org.get_vdc(self.config['vcd']['vdc'])
     vdc = VDC(self.client, resource=vdc_resource)
     vapp_resource = vdc.get_vapp(self.config['vcd']['vapp'])
     vapp = VApp(self.client, resource=vapp_resource)
     control_access = vapp.remove_access_settings(
         access_settings_list=[
             {'name': self.config['vcd']['access_user'], 'type': 'user'}
         ])
     assert len(control_access.AccessSettings.AccessSetting) == 1