src/tests/cli/t_pkg_intent.py
author Shawn Walker <srw@sun.com>
Fri, 23 Oct 2009 17:43:37 -0500
changeset 1431 62b6033670e4
parent 1352 5c92c9d342ef
child 1461 fdf40c8c6765
permissions -rw-r--r--
10416 server catalog v1 support desired 243 need localized descriptions, other metadata at catalog level 2424 Need to use UTC consistently everywhere 3092 messaging api/framework needed for pkg clients (cli, gui, etc.) 7063 "pkg list -a -s" needs performance improvement 7163 manifests are modified by client before being written to disk 8217 package fmri should be added to manifest during publishing 9061 importer should not refresh indexes 9446 traceback for cfg_cache operations if read-only filesystem 10415 client catalog v1 support desired 11094 Client transport for catalog v1 11523 only permit FMRIs from same publisher for network repositories 11831 server api version incompatible templates can cause traceback 11832 depot needs ability to seed / alter repository configuration 11954 importer shows zero packages processed unless debug enabled 12006 merge utility should have a test suite
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
858
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
     1
#!/usr/bin/python2.4
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
     2
#
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
     3
# CDDL HEADER START
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
     4
#
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
     5
# The contents of this file are subject to the terms of the
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
     6
# Common Development and Distribution License (the "License").
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
     7
# You may not use this file except in compliance with the License.
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
     8
#
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
     9
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
    10
# or http://www.opensolaris.org/os/licensing.
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
    11
# See the License for the specific language governing permissions
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
    12
# and limitations under the License.
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
    13
#
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
    14
# When distributing Covered Code, include this CDDL HEADER in each
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
    15
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
    16
# If applicable, add the following below this CDDL HEADER, with the
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
    17
# fields enclosed by brackets "[]" replaced with your own identifying
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
    18
# information: Portions Copyright [yyyy] [name of copyright owner]
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
    19
#
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
    20
# CDDL HEADER END
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
    21
#
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
    22
926
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 917
diff changeset
    23
#
858
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
    24
# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
    25
# Use is subject to license terms.
926
6ee411c9026a 5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 917
diff changeset
    26
#
858
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
    27
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
    28
import testutils
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
    29
if __name__ == "__main__":
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
    30
        testutils.setup_environment("../../../proto")
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
    31
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
    32
import os
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
    33
import time
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
    34
import sys
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
    35
import unittest
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
    36
from stat import *
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
    37
import pkg.fmri as fmri
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
    38
import pkg.client.api as api
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
    39
import pkg.client.api_errors as api_errors
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
    40
import pkg.client.progress as progress
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
    41
1352
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1271
diff changeset
    42
API_VERSION = 21
858
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
    43
PKG_CLIENT_NAME = "pkg"
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
    44
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
    45
class TestPkgIntent(testutils.SingleDepotTestCase):
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
    46
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
    47
        foo10 = """
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
    48
            open [email protected],5.11-0
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
    49
            close """
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
    50
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
    51
        foo11 = """
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
    52
            open [email protected],5.11-0
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
    53
            add dir mode=0755 owner=root group=bin path=/lib
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
    54
            add file /tmp/libc.so.1 mode=0555 owner=root group=bin path=/lib/libc.so.1 timestamp="20080731T024051Z"
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
    55
            close """
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
    56
        foo11_timestamp = 1217472051
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
    57
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
    58
        foo12 = """
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
    59
            open [email protected],5.11-0
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
    60
            add file /tmp/libc.so.1 mode=0555 owner=root group=bin path=/lib/libc.so.1
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
    61
            close """
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
    62
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
    63
        bar10 = """
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
    64
            open [email protected],5.11-0
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
    65
            add depend type=require fmri=pkg:/[email protected]
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
    66
            add dir mode=0755 owner=root group=bin path=/bin
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
    67
            add file /tmp/cat mode=0555 owner=root group=bin path=/bin/cat
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
    68
            close """
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
    69
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
    70
        bar11 = """
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
    71
            open [email protected],5.11-0
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
    72
            add depend type=require fmri=pkg:/[email protected]
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
    73
            add dir mode=0755 owner=root group=bin path=/bin
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
    74
            add file /tmp/cat mode=0555 owner=root group=bin path=/bin/cat
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
    75
            close """
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
    76
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
    77
        bar12 = """
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
    78
            open [email protected],5.11-0
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
    79
            add depend type=require fmri=pkg:/[email protected]
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
    80
            add dir mode=0755 owner=root group=bin path=/bin
1431
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1352
diff changeset
    81
            add file /tmp/cat mode=0555 owner=root group=bin path=/bin/cat
858
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
    82
            close """
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
    83
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
    84
        baz10 = """
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
    85
            open [email protected],5.11-0
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
    86
            add depend type=require fmri=pkg:/[email protected]
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
    87
            add dir mode=0755 owner=root group=bin path=/bin
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
    88
            add file /tmp/baz mode=0555 owner=root group=bin path=/bin/baz
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
    89
            close """
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
    90
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
    91
        misc_files = [ "/tmp/libc.so.1", "/tmp/cat", "/tmp/baz" ]
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
    92
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
    93
        def setUp(self):
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
    94
                testutils.SingleDepotTestCase.setUp(self,
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
    95
                    debug_features=["headers"])
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
    96
                for p in self.misc_files:
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
    97
                        f = open(p, "w")
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
    98
                        # write the name of the file into the file, so that
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
    99
                        # all files have differing contents
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   100
                        f.write(p)
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   101
                        f.close
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   102
                        self.debug("wrote %s" % p)
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   103
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   104
        def tearDown(self):
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   105
                testutils.SingleDepotTestCase.tearDown(self)
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   106
                for p in self.misc_files:
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   107
                        os.remove(p)
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   108
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   109
        def get_intent_entries(self):
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   110
                """Scan logpath looking for request header log entries for
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   111
                X-IPkg-Intent.  Returns a list of dicts each representing
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   112
                an intent entry."""
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   113
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   114
                hdr = "X-IPKG-INTENT:"
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   115
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   116
                entries = []
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   117
                for i in sorted(self.dcs.keys()):
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   118
                        dc = self.dcs[i]
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   119
                        logpath = dc.get_logpath()
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   120
                        self.debug("check for intent entries in %s" % logpath)
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   121
                        logfile = open(logpath, "r")
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   122
                        for line in logfile.readlines():
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   123
                                spos = line.find(hdr)
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   124
                                if spos > -1:
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   125
                                        spos += len(hdr)
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   126
                                        l = line[spos:].strip()
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   127
                                        l = l.strip("()")
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   128
                                        d = {}
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   129
                                        for e in l.split(";"):
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   130
                                                k, v = e.split("=")
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   131
                                                d[k] = v
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   132
                                        if d:
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   133
                                                entries.append(d)
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   134
                return entries
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   135
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   136
        def intent_entry_exists(self, entries, expected):
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   137
                """Returns a boolean value indicating whether the expected
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   138
                intent entry was found."""
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   139
                for entry in entries:
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   140
                        if entry == expected:
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   141
                                return True
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   142
                self.debug("Intent log entries:\n%s" % (
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   143
                    "\n".join(str(e) for e in entries)))
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   144
                self.debug("Unable to match:\n%s" % expected)
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   145
                return False
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   146
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   147
        @staticmethod
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   148
        def __do_install(api_obj, fmris, filters=None, noexecute=False):
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   149
                if not filters:
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   150
                        filters = []
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   151
                api_obj.reset()
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   152
                api_obj.plan_install(fmris, filters, noexecute=noexecute)
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   153
                if not noexecute:
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   154
                        api_obj.prepare()
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   155
                        api_obj.execute_plan()
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   156
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   157
        @staticmethod
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   158
        def __do_uninstall(api_obj, fmris, recursive_removal=False,
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   159
            noexecute=False):
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   160
                api_obj.reset()
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   161
                api_obj.plan_uninstall(fmris, recursive_removal,
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   162
                    noexecute=noexecute)
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   163
                if not noexecute:
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   164
                        api_obj.prepare()
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   165
                        api_obj.execute_plan()
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   166
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   167
        def test_0_info(self):
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   168
                """Verify that informational operations send the expected
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   169
                intent information."""
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   170
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   171
                durl = self.dc.get_depot_url()
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   172
                plist = self.pkgsend_bulk(durl, self.foo10)
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   173
                self.image_create(durl)
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   174
                progresstracker = progress.NullProgressTracker()
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   175
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   176
                api_obj = api.ImageInterface(self.get_img_path(), API_VERSION,
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   177
                    progresstracker, lambda x: False, PKG_CLIENT_NAME)
917
eed22f430a9f 6902 api.info needs a "fast" flag or a way to pass a set of the information required
Brock Pytlik <bpytlik@sun.com>
parents: 858
diff changeset
   178
1431
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1352
diff changeset
   179
                info_needed = api.PackageInfo.ALL_OPTIONS - \
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1352
diff changeset
   180
                    frozenset([api.PackageInfo.LICENSES,
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1352
diff changeset
   181
                    api.PackageInfo.SIZE]) - \
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1352
diff changeset
   182
                    (api.PackageInfo.ACTION_OPTIONS - \
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1352
diff changeset
   183
                    frozenset([api.PackageInfo.DEPENDENCIES]))
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1352
diff changeset
   184
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1352
diff changeset
   185
                api_obj.info(plist, False, info_needed)
917
eed22f430a9f 6902 api.info needs a "fast" flag or a way to pass a set of the information required
Brock Pytlik <bpytlik@sun.com>
parents: 858
diff changeset
   186
eed22f430a9f 6902 api.info needs a "fast" flag or a way to pass a set of the information required
Brock Pytlik <bpytlik@sun.com>
parents: 858
diff changeset
   187
                entries = self.get_intent_entries()
1431
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1352
diff changeset
   188
                self.assertEqual(entries, [])
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1352
diff changeset
   189
917
eed22f430a9f 6902 api.info needs a "fast" flag or a way to pass a set of the information required
Brock Pytlik <bpytlik@sun.com>
parents: 858
diff changeset
   190
                api_obj.info(plist, False,
1431
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1352
diff changeset
   191
                    info_needed | api.PackageInfo.ACTION_OPTIONS)
858
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   192
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   193
                entries = self.get_intent_entries()
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   194
                # Verify that evaluation and processing entries are present
1431
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1352
diff changeset
   195
                # for info.  This will only happen if the client actually
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1352
diff changeset
   196
                # has to contact the repository to get information not found
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1352
diff changeset
   197
                # in the catalog.
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1352
diff changeset
   198
                target = fmri.PkgFmri(plist[0]).get_fmri(anarchy=True,
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1352
diff changeset
   199
                    include_scheme=False)
858
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   200
                self.assert_(self.intent_entry_exists(entries, {
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   201
                    "operation": "info",
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   202
                    "reason": "info",
1431
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1352
diff changeset
   203
                    "initial_target": target,
858
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   204
                }))
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   205
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   206
        def test_1_install_uninstall(self):
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   207
                """Verify that the install and uninstall of a single package
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   208
                sends the expected intent information."""
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   209
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   210
                durl = self.dc.get_depot_url()
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   211
                plist = self.pkgsend_bulk(durl, self.foo10)
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   212
                self.image_create(durl)
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   213
                progresstracker = progress.NullProgressTracker()
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   214
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   215
                # Test install.
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   216
                api_obj = api.ImageInterface(self.get_img_path(), API_VERSION,
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   217
                    progresstracker, lambda x: False, PKG_CLIENT_NAME)
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   218
                self.__do_install(api_obj, ["foo"], noexecute=True)
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   219
                self.__do_install(api_obj, ["foo"])
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   220
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   221
                # Test uninstall.
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   222
                self.__do_uninstall(api_obj, ["foo"], noexecute=True)
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   223
                self.__do_uninstall(api_obj, ["foo"])
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   224
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   225
                entries = self.get_intent_entries()
1431
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1352
diff changeset
   226
                # Verify that entries are present for install.
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1352
diff changeset
   227
                target = fmri.PkgFmri(plist[0]).get_fmri(anarchy=True,
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1352
diff changeset
   228
                    include_scheme=False)
858
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   229
                self.assert_(self.intent_entry_exists(entries, {
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   230
                    "operation": "install",
1431
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1352
diff changeset
   231
                    "reason": "info",
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1352
diff changeset
   232
                    "initial_target": target,
858
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   233
                }))
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   234
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   235
                self.assert_(self.intent_entry_exists(entries, {
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   236
                    "operation": "install",
1431
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1352
diff changeset
   237
                    "reason": "info",
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1352
diff changeset
   238
                    "initial_target": target,
858
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   239
                }))
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   240
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   241
                # Verify that evaluation entries are not present for uninstall.
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   242
                # Image operations that are for evaluation only and do not
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   243
                # require retrieving manifest information will not send any
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   244
                # intent information for efficiency.
1431
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1352
diff changeset
   245
                target_ver = str(fmri.PkgFmri(target).version)
858
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   246
                self.assert_(self.intent_entry_exists(entries, {
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   247
                    "operation": "uninstall",
1431
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1352
diff changeset
   248
                    "prior_version": target_ver,
858
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   249
                    "reason": "evaluate",
1431
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1352
diff changeset
   250
                    "initial_target": target,
858
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   251
                }) == False)
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   252
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   253
                # Verify that processing entries are present for uninstall.
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   254
                self.assert_(self.intent_entry_exists(entries, {
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   255
                    "operation": "uninstall",
1431
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1352
diff changeset
   256
                    "prior_version": target_ver,
858
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   257
                    "reason": "process",
1431
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1352
diff changeset
   258
                    "initial_target": target,
858
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   259
                }))
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   260
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   261
        def test_2_upgrade(self):
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   262
                """Verify the the install of a single package, and then an
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   263
                upgrade (install of newer version) of that package sends the
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   264
                expected intent information."""
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   265
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   266
                durl = self.dc.get_depot_url()
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   267
                plist = self.pkgsend_bulk(durl, self.foo10 + self.foo11)
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   268
                self.image_create(durl)
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   269
                progresstracker = progress.NullProgressTracker()
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   270
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   271
                # Test install.
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   272
                api_obj = api.ImageInterface(self.get_img_path(), API_VERSION,
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   273
                    progresstracker, lambda x: True, PKG_CLIENT_NAME)
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   274
                self.__do_install(api_obj, ["[email protected]"], noexecute=True)
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   275
                self.__do_install(api_obj, ["[email protected]"])
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   276
                self.__do_install(api_obj, ["[email protected]"], noexecute=True)
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   277
                self.__do_install(api_obj, ["[email protected]"])
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   278
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   279
                # Test uninstall.
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   280
                self.__do_uninstall(api_obj, ["foo"], noexecute=True)
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   281
                self.__do_uninstall(api_obj, ["foo"])
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   282
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   283
                entries = self.get_intent_entries()
1431
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1352
diff changeset
   284
                # Verify entries are present for install.
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1352
diff changeset
   285
                target0 = fmri.PkgFmri(plist[0]).get_fmri(anarchy=True,
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1352
diff changeset
   286
                    include_scheme=False)
858
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   287
                self.assert_(self.intent_entry_exists(entries, {
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   288
                    "operation": "install",
1431
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1352
diff changeset
   289
                    "reason": "info",
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1352
diff changeset
   290
                    "initial_target": target0,
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1352
diff changeset
   291
                }))
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1352
diff changeset
   292
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1352
diff changeset
   293
                target1 = fmri.PkgFmri(plist[1]).get_fmri(anarchy=True,
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1352
diff changeset
   294
                    include_scheme=False)
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1352
diff changeset
   295
                self.assert_(self.intent_entry_exists(entries, {
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1352
diff changeset
   296
                    "operation": "install",
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1352
diff changeset
   297
                    "reason": "info",
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1352
diff changeset
   298
                    "initial_target": target1,
858
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   299
                }))
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   300
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   301
                self.assert_(self.intent_entry_exists(entries, {
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   302
                    "operation": "install",
1431
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1352
diff changeset
   303
                    "reason": "info",
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1352
diff changeset
   304
                    "initial_target": target0,
858
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   305
                }))
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   306
1431
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1352
diff changeset
   307
                version0 = str(fmri.PkgFmri(target0).version)
858
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   308
                self.assert_(self.intent_entry_exists(entries, {
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   309
                    "operation": "install",
1431
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1352
diff changeset
   310
                    "reason": "info",
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1352
diff changeset
   311
                    "initial_target": target1,
858
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   312
                }))
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   313
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   314
                # Verify that evaluation entries are not present for uninstall.
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   315
                # Image operations that are for evaluation only and do not
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   316
                # require retrieving manifest information will not send any
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   317
                # intent information for efficiency.
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   318
                self.assert_(self.intent_entry_exists(entries, {
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   319
                    "operation": "uninstall",
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   320
                    "reason": "evaluate",
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   321
                    "prior_version": str(fmri.PkgFmri(plist[1]).version),
1431
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1352
diff changeset
   322
                    "initial_target": target1,
858
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   323
                }) == False)
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   324
1431
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1352
diff changeset
   325
                version1 = str(fmri.PkgFmri(target1).version)
858
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   326
                self.assert_(self.intent_entry_exists(entries, {
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   327
                    "operation": "uninstall",
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   328
                    "reason": "process",
1431
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1352
diff changeset
   329
                    "prior_version": version1,
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1352
diff changeset
   330
                    "initial_target": target1,
858
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   331
                }))
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   332
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   333
        def test_3_dependencies(self):
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   334
                """Verify that an install or uninstall of a single package with
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   335
                a single dependency sends the expected intent information."""
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   336
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   337
                durl = self.dc.get_depot_url()
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   338
                plist = self.pkgsend_bulk(durl, self.foo10 + self.bar10)
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   339
                self.image_create(durl)
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   340
                progresstracker = progress.NullProgressTracker()
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   341
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   342
                api_obj = api.ImageInterface(self.get_img_path(), API_VERSION,
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   343
                    progresstracker, lambda x: True, PKG_CLIENT_NAME)
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   344
                self.__do_install(api_obj, ["[email protected]"])
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   345
                self.__do_uninstall(api_obj, ["bar", "foo"])
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   346
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   347
                # Only testing for process; no need to re-test for evaluate.
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   348
                entries = self.get_intent_entries()
1431
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1352
diff changeset
   349
                target1 = fmri.PkgFmri(plist[1]).get_fmri(anarchy=True,
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1352
diff changeset
   350
                    include_scheme=False)
858
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   351
                self.assert_(self.intent_entry_exists(entries, {
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   352
                    "operation": "install",
1431
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1352
diff changeset
   353
                    "reason": "info",
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1352
diff changeset
   354
                    "initial_target": target1,
858
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   355
                }))
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   356
1431
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1352
diff changeset
   357
                target0 = fmri.PkgFmri(plist[0]).get_fmri(anarchy=True,
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1352
diff changeset
   358
                    include_scheme=False)
858
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   359
                self.assert_(self.intent_entry_exists(entries, {
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   360
                    "operation": "install",
1431
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1352
diff changeset
   361
                    "reason": "info",
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1352
diff changeset
   362
                    "initial_target": target0,
858
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   363
                }))
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   364
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   365
        def test_4_image_upgrade(self):
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   366
                """Verify that the correct intent information is sent during an
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   367
                image upgrade."""
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   368
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   369
                plist = []
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   370
                durl = self.dc.get_depot_url()
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   371
                plist.extend(self.pkgsend_bulk(durl, self.foo10 + self.foo11 + \
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   372
                    self.bar10))
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   373
                self.image_create(durl)
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   374
                progresstracker = progress.NullProgressTracker()
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   375
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   376
                api_obj = api.ImageInterface(self.get_img_path(), API_VERSION,
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   377
                    progresstracker, lambda x: True, PKG_CLIENT_NAME)
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   378
                self.__do_install(api_obj, ["[email protected]"])
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   379
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   380
                plist.extend(self.pkgsend_bulk(durl, self.foo12 + self.bar11))
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   381
996
31d152a5212b 7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 941
diff changeset
   382
                api_obj.refresh(immediate=True)
858
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   383
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   384
                api_obj.reset()
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   385
                api_obj.plan_update_all(sys.argv[0])
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   386
                api_obj.prepare()
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   387
                api_obj.execute_plan()
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   388
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   389
                # Only testing for process; no need to re-test for evaluate.
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   390
                entries = self.get_intent_entries()
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   391
                # Verify that foo10 was installed when upgrading to foo12.
1431
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1352
diff changeset
   392
                version0 = str(fmri.PkgFmri(plist[0]).version)
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1352
diff changeset
   393
                target3 = fmri.PkgFmri(plist[3]).get_fmri(anarchy=True,
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1352
diff changeset
   394
                    include_scheme=False)
858
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   395
                self.assert_(self.intent_entry_exists(entries, {
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   396
                    "operation": "image-update",
1431
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1352
diff changeset
   397
                    "reason": "info",
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1352
diff changeset
   398
                    "initial_target": target3,
858
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   399
                }))
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   400
1431
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1352
diff changeset
   401
                version2 = str(fmri.PkgFmri(plist[2]).version)
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1352
diff changeset
   402
                target4 = fmri.PkgFmri(plist[4]).get_fmri(anarchy=True,
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1352
diff changeset
   403
                    include_scheme=False)
858
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   404
                # Verify that bar10 was installed when upgrading to bar11.
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   405
                self.assert_(self.intent_entry_exists(entries, {
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   406
                    "operation": "image-update",
1431
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1352
diff changeset
   407
                    "reason": "info",
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1352
diff changeset
   408
                    "initial_target": target4,
858
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   409
                }))
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   410
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   411
        def test_5_recursive_uninstall(self):
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   412
                """Verify that a recursive uninstall sends the expected intent
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   413
                information."""
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   414
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   415
                durl = self.dc.get_depot_url()
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   416
                plist = self.pkgsend_bulk(durl, self.foo10 + self.foo11 + self.bar10)
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   417
                self.image_create(durl)
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   418
                progresstracker = progress.NullProgressTracker()
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   419
                api_obj = api.ImageInterface(self.get_img_path(), API_VERSION,
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   420
                    progresstracker, lambda x: True, PKG_CLIENT_NAME)
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   421
                self.__do_install(api_obj, ["[email protected]"])
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   422
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   423
                # Only testing for process; no need to re-test for evaluate.
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   424
                self.__do_uninstall(api_obj, ["foo"], True)
1431
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1352
diff changeset
   425
858
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   426
                entries = self.get_intent_entries()
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   427
                # Verify that foo10 was uninstalled.
1431
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1352
diff changeset
   428
                target0 = fmri.PkgFmri(plist[0]).get_fmri(anarchy=True,
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1352
diff changeset
   429
                    include_scheme=False)
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1352
diff changeset
   430
                version0 = str(fmri.PkgFmri(target0).version)
858
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   431
                self.assert_(self.intent_entry_exists(entries, {
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   432
                    "operation": "uninstall",
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   433
                    "reason": "process",
1431
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1352
diff changeset
   434
                    "initial_target": target0,
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1352
diff changeset
   435
                    "prior_version": version0,
858
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   436
                }))
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   437
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   438
                # Verify that bar10 was uninstalled because of foo10.
1431
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1352
diff changeset
   439
                target2 = fmri.PkgFmri(plist[2]).get_fmri(anarchy=True,
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1352
diff changeset
   440
                    include_scheme=False)
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1352
diff changeset
   441
                version2 = str(fmri.PkgFmri(target2).version)
858
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   442
                self.assert_(self.intent_entry_exists(entries, {
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   443
                    "operation": "uninstall",
1431
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1352
diff changeset
   444
                    "needed_by": target0,
858
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   445
                    "reason": "process",
1431
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1352
diff changeset
   446
                    "initial_target": target0,
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1352
diff changeset
   447
                    "target": target2,
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1352
diff changeset
   448
                    "prior_version": version2,
858
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   449
                }))
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   450
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   451
        def test_6_deep_dependencies(self):
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   452
                """Verify that an install or uninstall of a package with a
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   453
                dependency chain sends the expected intent information."""
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   454
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   455
                durl = self.dc.get_depot_url()
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   456
                plist = self.pkgsend_bulk(durl, self.foo10 + self.bar10 + \
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   457
                    self.baz10)
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   458
                self.image_create(durl)
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   459
                progresstracker = progress.NullProgressTracker()
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   460
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   461
                api_obj = api.ImageInterface(self.get_img_path(), API_VERSION,
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   462
                    progresstracker, lambda x: True, PKG_CLIENT_NAME)
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   463
                self.__do_install(api_obj, ["baz"])
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   464
                self.__do_uninstall(api_obj, ["foo"], True)
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   465
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   466
                # Only testing for process; no need to re-test for evaluate.
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   467
                entries = self.get_intent_entries()
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   468
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   469
                #
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   470
                # Verify the install entries.
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   471
                #
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   472
1431
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1352
diff changeset
   473
                # Verify baz is logged.
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1352
diff changeset
   474
                target2 = fmri.PkgFmri(plist[2]).get_fmri(anarchy=True,
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1352
diff changeset
   475
                    include_scheme=False)
858
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   476
                self.assert_(self.intent_entry_exists(entries, {
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   477
                    "operation": "install",
1431
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1352
diff changeset
   478
                    "reason": "info",
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1352
diff changeset
   479
                    "initial_target": target2,
858
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   480
                }))
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   481
1431
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1352
diff changeset
   482
                # Verify bar is logged.
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1352
diff changeset
   483
                target1 = fmri.PkgFmri(plist[1]).get_fmri(anarchy=True,
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1352
diff changeset
   484
                    include_scheme=False)
858
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   485
                self.assert_(self.intent_entry_exists(entries, {
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   486
                    "operation": "install",
1431
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1352
diff changeset
   487
                    "reason": "info",
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1352
diff changeset
   488
                    "initial_target": target1,
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1352
diff changeset
   489
                }))
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1352
diff changeset
   490
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1352
diff changeset
   491
                # Verify foo is logged.
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1352
diff changeset
   492
                target0 = fmri.PkgFmri(plist[0]).get_fmri(anarchy=True,
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1352
diff changeset
   493
                    include_scheme=False)
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1352
diff changeset
   494
                self.assert_(self.intent_entry_exists(entries, {
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1352
diff changeset
   495
                    "operation": "install",
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1352
diff changeset
   496
                    "reason": "info",
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1352
diff changeset
   497
                    "initial_target": target0,
858
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   498
                }))
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   499
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   500
                #
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   501
                # Verify the uninstall entries.
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   502
                #
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   503
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   504
                # Verify foo is the initial target.
1431
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1352
diff changeset
   505
                version0 = str(fmri.PkgFmri(target0).version)
858
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   506
                self.assert_(self.intent_entry_exists(entries, {
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   507
                    "operation": "uninstall",
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   508
                    "reason": "process",
1431
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1352
diff changeset
   509
                    "initial_target": target0,
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1352
diff changeset
   510
                    "prior_version": version0,
858
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   511
                }))
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   512
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   513
                # Verify foo is the initial target, bar is needed_by foo, and
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   514
                # foo is the target.
1431
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1352
diff changeset
   515
                version1 = str(fmri.PkgFmri(target1).version)
858
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   516
                self.assert_(self.intent_entry_exists(entries, {
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   517
                    "operation": "uninstall",
1431
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1352
diff changeset
   518
                    "needed_by": target0,
858
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   519
                    "reason": "process",
1431
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1352
diff changeset
   520
                    "initial_target": target0,
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1352
diff changeset
   521
                    "target": target1,
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1352
diff changeset
   522
                    "prior_version": version1,
858
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   523
                }))
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   524
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   525
                # Verify foo is the initial target, baz is needed_by bar, and
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   526
                # baz is the target.
1431
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1352
diff changeset
   527
                version2 = str(fmri.PkgFmri(target2).version)
858
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   528
                self.assert_(self.intent_entry_exists(entries, {
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   529
                    "operation": "uninstall",
1431
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1352
diff changeset
   530
                    "needed_by": target1,
858
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   531
                    "reason": "process",
1431
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1352
diff changeset
   532
                    "initial_target": target0,
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1352
diff changeset
   533
                    "target": target2,
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1352
diff changeset
   534
                    "prior_version": version2,
858
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   535
                }))
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   536
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   537
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   538
if __name__ == "__main__":
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   539
        unittest.main()