src/tests/cli/t_pkg_intent.py
author Shawn Walker <Shawn.Walker@Sun.COM>
Tue, 31 Mar 2009 02:27:07 -0500
changeset 996 31d152a5212b
parent 941 e7bff46da54e
child 1087 293c0aa5f32e
permissions -rw-r--r--
7582 pkg set-publisher --no-refresh will delete catalogs 7587 catalog refreshes should occur according to refresh_seconds of repository 7686 clients traceback when attempting to set disabled publisher as preferred 7699 -H option is undocumented for pkg list 7732 packagemanager always performs full refresh
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
941
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents: 938
diff changeset
    42
API_VERSION = 12
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
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
    81
            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
    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
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
   179
                api_obj.info(plist, False, frozenset([api.PackageInfo.IDENTITY,
938
eeb932b9b44e 7336 putback for 5871 missed a few vestiges of authority
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 926
diff changeset
   180
                    api.PackageInfo.STATE, api.PackageInfo.PREF_PUBLISHER]))
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
   181
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
   182
                entries = self.get_intent_entries()
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
   183
                self.assert_(entries == [])
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
   184
                
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
   185
                api_obj.info(plist, False,
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
                    frozenset([api.PackageInfo.DEPENDENCIES]))
858
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   187
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   188
                entries = self.get_intent_entries()
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   189
                # Verify that evaluation and processing entries are present
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   190
                # for info.
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   191
                self.assert_(self.intent_entry_exists(entries, {
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   192
                    "operation": "info",
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   193
                    "reason": "info",
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   194
                    "initial_target": plist[0],
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   195
                }))
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   196
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   197
        def test_1_install_uninstall(self):
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   198
                """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
   199
                sends the expected intent information."""
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   200
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   201
                durl = self.dc.get_depot_url()
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   202
                plist = self.pkgsend_bulk(durl, self.foo10)
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   203
                self.image_create(durl)
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   204
                progresstracker = progress.NullProgressTracker()
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
                # Test install.
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   207
                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
   208
                    progresstracker, lambda x: False, PKG_CLIENT_NAME)
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   209
                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
   210
                self.__do_install(api_obj, ["foo"])
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   211
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   212
                # Test uninstall.
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   213
                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
   214
                self.__do_uninstall(api_obj, ["foo"])
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   215
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   216
                entries = self.get_intent_entries()
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   217
                # Verify that evaluation and processing entries are present
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   218
                # for install.
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   219
                self.assert_(self.intent_entry_exists(entries, {
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   220
                    "operation": "install",
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   221
                    "reason": "evaluate",
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   222
                    "initial_target": plist[0],
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   223
                }))
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
                self.assert_(self.intent_entry_exists(entries, {
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   226
                    "operation": "install",
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   227
                    "reason": "process",
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   228
                    "initial_target": plist[0],
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   229
                }))
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   230
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   231
                # 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
   232
                # 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
   233
                # 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
   234
                # intent information for efficiency.
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": "uninstall",
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   237
                    "prior_version": str(fmri.PkgFmri(plist[0]).version),
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   238
                    "reason": "evaluate",
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   239
                    "initial_target": plist[0],
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   240
                }) == False)
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   241
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   242
                # 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
   243
                self.assert_(self.intent_entry_exists(entries, {
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   244
                    "operation": "uninstall",
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   245
                    "prior_version": str(fmri.PkgFmri(plist[0]).version),
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   246
                    "reason": "process",
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   247
                    "initial_target": plist[0],
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   248
                }))
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   249
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   250
        def test_2_upgrade(self):
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   251
                """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
   252
                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
   253
                expected intent information."""
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   254
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   255
                durl = self.dc.get_depot_url()
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   256
                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
   257
                self.image_create(durl)
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   258
                progresstracker = progress.NullProgressTracker()
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
                # Test install.
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   261
                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
   262
                    progresstracker, lambda x: True, PKG_CLIENT_NAME)
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   263
                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
   264
                self.__do_install(api_obj, ["[email protected]"])
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   265
                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
   266
                self.__do_install(api_obj, ["[email protected]"])
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   267
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   268
                # Test uninstall.
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   269
                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
   270
                self.__do_uninstall(api_obj, ["foo"])
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   271
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   272
                entries = self.get_intent_entries()
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   273
                # Verify that evaluation and processing entries are present
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   274
                # for install.
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   275
                self.assert_(self.intent_entry_exists(entries, {
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   276
                    "operation": "install",
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   277
                    "reason": "evaluate",
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   278
                    "initial_target": plist[0],
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   279
                }))
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   280
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   281
                self.assert_(self.intent_entry_exists(entries, {
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   282
                    "operation": "install",
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   283
                    "reason": "evaluate",
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   284
                    "prior_version": str(fmri.PkgFmri(plist[0]).version),
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   285
                    "initial_target": plist[1],
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   286
                }))
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   287
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   288
                self.assert_(self.intent_entry_exists(entries, {
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   289
                    "operation": "install",
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   290
                    "reason": "process",
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   291
                    "initial_target": plist[0],
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   292
                }))
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   293
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   294
                self.assert_(self.intent_entry_exists(entries, {
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   295
                    "operation": "install",
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   296
                    "reason": "process",
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   297
                    "prior_version": str(fmri.PkgFmri(plist[0]).version),
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   298
                    "initial_target": plist[1],
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
                # 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
   302
                # 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
   303
                # 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
   304
                # intent information for efficiency.
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   305
                self.assert_(self.intent_entry_exists(entries, {
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   306
                    "operation": "uninstall",
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   307
                    "reason": "evaluate",
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   308
                    "prior_version": str(fmri.PkgFmri(plist[1]).version),
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   309
                    "initial_target": plist[1],
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   310
                }) == False)
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   311
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   312
                self.assert_(self.intent_entry_exists(entries, {
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   313
                    "operation": "uninstall",
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   314
                    "reason": "process",
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   315
                    "prior_version": str(fmri.PkgFmri(plist[1]).version),
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   316
                    "initial_target": plist[1],
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   317
                }))
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   318
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   319
        def test_3_dependencies(self):
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   320
                """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
   321
                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
   322
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   323
                durl = self.dc.get_depot_url()
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   324
                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
   325
                self.image_create(durl)
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   326
                progresstracker = progress.NullProgressTracker()
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   327
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   328
                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
   329
                    progresstracker, lambda x: True, PKG_CLIENT_NAME)
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   330
                self.__do_install(api_obj, ["[email protected]"])
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   331
                self.__do_uninstall(api_obj, ["bar", "foo"])
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
                # 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
   334
                entries = self.get_intent_entries()
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   335
                self.assert_(self.intent_entry_exists(entries, {
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   336
                    "operation": "install",
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   337
                    "reason": "process",
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   338
                    "initial_target": plist[1],
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   339
                }))
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   340
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   341
                self.assert_(self.intent_entry_exists(entries, {
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   342
                    "operation": "install",
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   343
                    "needed_by": plist[1],
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   344
                    "reason": "process",
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   345
                    "initial_target": plist[1],
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   346
                    "target": plist[0],
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   347
                }))
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   348
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   349
        def test_4_image_upgrade(self):
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   350
                """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
   351
                image upgrade."""
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   352
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   353
                plist = []
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   354
                durl = self.dc.get_depot_url()
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   355
                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
   356
                    self.bar10))
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   357
                self.image_create(durl)
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   358
                progresstracker = progress.NullProgressTracker()
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   359
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   360
                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
   361
                    progresstracker, lambda x: True, PKG_CLIENT_NAME)
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   362
                self.__do_install(api_obj, ["[email protected]"])
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
                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
   365
996
31d152a5212b 7582 pkg set-publisher --no-refresh will delete catalogs
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 941
diff changeset
   366
                api_obj.refresh(immediate=True)
858
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   367
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   368
                api_obj.reset()
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   369
                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
   370
                api_obj.prepare()
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   371
                api_obj.execute_plan()
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   372
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   373
                # 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
   374
                entries = self.get_intent_entries()
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   375
                # Verify that foo10 was installed when upgrading to foo12.
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   376
                self.assert_(self.intent_entry_exists(entries, {
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   377
                    "operation": "image-update",
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   378
                    "reason": "process",
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   379
                    "prior_version": str(fmri.PkgFmri(plist[0]).version),
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   380
                    "initial_target": plist[3],
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   381
                }))
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   382
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   383
                # 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
   384
                self.assert_(self.intent_entry_exists(entries, {
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   385
                    "operation": "image-update",
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   386
                    "reason": "process",
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   387
                    "prior_version": str(fmri.PkgFmri(plist[2]).version),
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   388
                    "initial_target": plist[4],
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   389
                }))
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   390
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   391
        def test_5_recursive_uninstall(self):
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   392
                """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
   393
                information."""
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   394
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   395
                durl = self.dc.get_depot_url()
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   396
                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
   397
                self.image_create(durl)
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   398
                progresstracker = progress.NullProgressTracker()
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   399
                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
   400
                    progresstracker, lambda x: True, PKG_CLIENT_NAME)
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   401
                self.__do_install(api_obj, ["[email protected]"])
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   402
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   403
                # 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
   404
                self.__do_uninstall(api_obj, ["foo"], True)
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   405
                                       
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   406
                entries = self.get_intent_entries()
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   407
                # Verify that foo10 was uninstalled.
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   408
                self.assert_(self.intent_entry_exists(entries, {
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   409
                    "operation": "uninstall",
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   410
                    "reason": "process",
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   411
                    "initial_target": plist[0],
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   412
                    "prior_version": str(fmri.PkgFmri(plist[0]).version),
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   413
                }))
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
                # Verify that bar10 was uninstalled because of foo10.
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   416
                self.assert_(self.intent_entry_exists(entries, {
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   417
                    "operation": "uninstall",
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   418
                    "needed_by": plist[0],
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   419
                    "reason": "process",
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   420
                    "initial_target": plist[0],
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   421
                    "target": plist[2],
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   422
                    "prior_version": str(fmri.PkgFmri(plist[2]).version),
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   423
                }))
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   424
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   425
        def test_6_deep_dependencies(self):
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   426
                """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
   427
                dependency chain sends the expected intent information."""
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   428
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   429
                durl = self.dc.get_depot_url()
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   430
                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
   431
                    self.baz10)
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   432
                self.image_create(durl)
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   433
                progresstracker = progress.NullProgressTracker()
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   434
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   435
                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
   436
                    progresstracker, lambda x: True, PKG_CLIENT_NAME)
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   437
                self.__do_install(api_obj, ["baz"])
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   438
                self.__do_uninstall(api_obj, ["foo"], True)
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   439
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   440
                # 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
   441
                entries = self.get_intent_entries()
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   442
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   443
                #
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   444
                # Verify the install entries.
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   445
                #
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   446
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   447
                # Verify baz is the initial target.
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   448
                self.assert_(self.intent_entry_exists(entries, {
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   449
                    "operation": "install",
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   450
                    "reason": "process",
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   451
                    "initial_target": plist[2],
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   452
                }))
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   453
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   454
                # Verify baz is the initial target, bar is needed_by baz, and
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   455
                # bar is the target.
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   456
                self.assert_(self.intent_entry_exists(entries, {
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   457
                    "operation": "install",
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   458
                    "needed_by": plist[2],
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   459
                    "reason": "process",
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   460
                    "initial_target": plist[2],
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   461
                    "target": plist[1],
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   462
                }))
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   463
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   464
                # Verify baz is the initial target, foo is needed_by bar, and
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   465
                # foo is the target.
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   466
                self.assert_(self.intent_entry_exists(entries, {
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   467
                    "operation": "install",
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   468
                    "needed_by": plist[1],
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   469
                    "reason": "process",
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   470
                    "initial_target": plist[2],
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   471
                    "target": plist[0],
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   472
                }))
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   473
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   474
                #
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   475
                # Verify the uninstall entries.
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   476
                #
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   477
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   478
                # Verify foo is the initial target.
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   479
                self.assert_(self.intent_entry_exists(entries, {
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   480
                    "operation": "uninstall",
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   481
                    "reason": "process",
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   482
                    "initial_target": plist[0],
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   483
                    "prior_version": str(fmri.PkgFmri(plist[0]).version),
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   484
                }))
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   485
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   486
                # 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
   487
                # foo is the target.
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   488
                self.assert_(self.intent_entry_exists(entries, {
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   489
                    "operation": "uninstall",
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   490
                    "needed_by": plist[0],
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   491
                    "reason": "process",
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   492
                    "initial_target": plist[0],
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   493
                    "target": plist[1],
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   494
                    "prior_version": str(fmri.PkgFmri(plist[1]).version),
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   495
                }))
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   496
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   497
                # 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
   498
                # baz is the target.
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   499
                self.assert_(self.intent_entry_exists(entries, {
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   500
                    "operation": "uninstall",
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   501
                    "needed_by": plist[1],
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   502
                    "reason": "process",
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   503
                    "initial_target": plist[0],
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   504
                    "target": plist[2],
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   505
                    "prior_version": str(fmri.PkgFmri(plist[2]).version),
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   506
                }))
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   507
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   508
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   509
if __name__ == "__main__":
c8f3fcec3301 6245 intent information is not properly sent
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
diff changeset
   510
        unittest.main()