Browse files

OS-1645 after svccfg import is killed, subsequent import fails

reviewed by Robert Mustacchi
  • Loading branch information...
1 parent d5af9db commit 2f44506866ead591c3ad2bb137b5645f26bf37c8 @jjelinek jjelinek committed Oct 26, 2012
Showing with 8 additions and 1 deletion.
  1. +8 −1 usr/src/cmd/svc/svccfg/svccfg_libscf.c
View
9 usr/src/cmd/svc/svccfg/svccfg_libscf.c
@@ -21,7 +21,7 @@
/*
* Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2011, Joyent, Inc. All rights reserved.
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
* Copyright 2012 Milan Jurik. All rights reserved.
*/
@@ -7027,6 +7027,7 @@ lscf_service_import(void *v, void *pvt)
int fresh = 0;
scf_snaplevel_t *running;
int have_ge = 0;
+ boolean_t retried = B_FALSE;
const char * const ts_deleted = gettext("Temporary service svc:/%s "
"was deleted unexpectedly.\n");
@@ -7082,6 +7083,7 @@ lscf_service_import(void *v, void *pvt)
return (UU_WALK_ERROR);
}
+retry:
if (scf_scope_add_service(imp_scope, imp_tsname, imp_tsvc) != 0) {
switch (scf_error()) {
case SCF_ERROR_CONNECTION_BROKEN:
@@ -7091,6 +7093,11 @@ lscf_service_import(void *v, void *pvt)
return (stash_scferror(lcbdata));
case SCF_ERROR_EXISTS:
+ if (!retried) {
+ lscf_delete(imp_tsname, 0);
+ retried = B_TRUE;
+ goto retry;
+ }
warn(gettext(
"Temporary service \"%s\" must be deleted before "
"this manifest can be imported.\n"), imp_tsname);

0 comments on commit 2f44506

Please sign in to comment.