summaryrefslogtreecommitdiff
path: root/source4/setup
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2010-06-13 15:32:41 +0200
committerJelmer Vernooij <jelmer@samba.org>2010-06-13 18:19:03 +0200
commitd9d0d54475c1bf78ce1c45f139097cd30029ccaa (patch)
tree3d0002fba6f8bc30cdd31de4d35ebce0c69b4b72 /source4/setup
parent3552ad3ab13a97c28925713dcea01d1e01df8868 (diff)
downloadsamba-d9d0d54475c1bf78ce1c45f139097cd30029ccaa.tar.gz
samba-d9d0d54475c1bf78ce1c45f139097cd30029ccaa.tar.bz2
samba-d9d0d54475c1bf78ce1c45f139097cd30029ccaa.zip
upgradeprovision: Use logging infrastructure.
Diffstat (limited to 'source4/setup')
-rwxr-xr-xsource4/setup/upgrade_from_s318
1 files changed, 11 insertions, 7 deletions
diff --git a/source4/setup/upgrade_from_s3 b/source4/setup/upgrade_from_s3
index adae0169fe..cdc59dc9eb 100755
--- a/source4/setup/upgrade_from_s3
+++ b/source4/setup/upgrade_from_s3
@@ -16,6 +16,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
+import logging
import optparse
import os, sys
@@ -45,16 +46,19 @@ parser.add_option("--targetdir", type="string", metavar="DIR",
opts, args = parser.parse_args()
-def message(text):
- """Print a message if quiet is not set."""
- if not opts.quiet:
- print text
+
+logger = logging.getLogger("upgrade")
+logger.addHandler(logging.StreamHandler(sys.stdout))
+if opts.quiet:
+ logger.setLevel(logging.WARNING)
+else:
+ logger.setLevel(logging.INFO)
if len(args) < 1:
parser.print_usage()
sys.exit(1)
-message("Reading Samba3 databases and smb.conf")
+logger.info("Reading Samba3 databases and smb.conf")
libdir = args[0]
if not os.path.isdir(libdir):
@@ -68,7 +72,7 @@ else:
samba3 = Samba3(libdir, smbconf)
-message("Provisioning")
+logger.info("Provisioning")
setup_dir = opts.setupdir
if setup_dir is None:
@@ -78,6 +82,6 @@ lp = sambaopts.get_loadparm()
smbconf = lp.configfile
creds = credopts.get_credentials(lp)
-upgrade_provision(samba3, setup_dir, message, credentials=creds,
+upgrade_provision(samba3, setup_dir, logger, credentials=creds,
session_info=system_session(), smbconf=smbconf,
targetdir=opts.targetdir)