[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Spacewalk-list] Internal server error changing kickstart script order



Running 2.7.  Add a new kickstart script (specifying a snippet), try to change order, get an internal server error.  catalina.out shows the following:
2017-11-21 08:50:35,755 [TP-Processor12] WARN  org.hibernate.util.JDBCExceptionReporter - SQL Error: 0, SQLState: 23505
2017-11-21 08:50:35,756 [TP-Processor12] ERROR org.hibernate.util.JDBCExceptionReporter - ERROR: duplicate key value violates unique constraint "rhn_ksscript_ksid_pos_uq"
2017-11-21 08:50:35,760 [TP-Processor12] ERROR com.redhat.rhn.frontend.servlets.SessionFilter - Error during transaction. Rolling back
org.hibernate.exception.ConstraintViolationException: could not update: [com.redhat.rhn.domain.kickstart.KickstartScript#50]

Ran spacewalk-sql -i to debug kickstart script ordering:
rhnschema=# select * from RHNKICKSTARTSCRIPT where kickstart_id = 8;
(snipped certain columns)
 id  |       script_name        | kickstart_id | position | script_type | chroot | error_on_fail | raw_script | interpreter |                       data
-----+--------------------------+--------------+----------+-------------+--------+---------------+------------+-------------+---------------------------
  48 | Import GPG Keys Pre      |            8 |        1 | pre         | Y      | N             | N          | /bin/bash   | $SNIPPET('spacewalk/2/import-gpg-keys-el7')
  50 | Eject CD                 |            8 |        3 | post        | Y      | N             | Y          | /bin/bash   | eject\012
  94 | Select install disk      |            8 |        4 | pre         | Y      | Y             | N          | /bin/bash   | $SNIPPET('spacewalk/2/select-install-disk')
 120 | Install Packages         |            8 |        5 | post        | Y      | N             | N          | /bin/bash   | $SNIPPET('spacewalk/2/install-pkgs-rhel7')
  99 | save-install-disk-config |            8 |        2 | post        | Y      | N             | N          | /bin/bash   | $SNIPPET('spacewalk/2/save-install-disk-config')

Just added #120 and it defaulted to position 5.  If I move Eject CD below it and hit Submit, I get the traceback.  If I update #50 to position 8 using SQL, it reorders properly.

Here's a list of all my kickstart scripts and their positions, etc.
rhnschema=# select id,script_name, kickstart_id,position,script_type from RHNKICKSTARTSCRIPT order by kickstart_id,position;
 id  |          script_name           | kickstart_id | position | script_type
-----+--------------------------------+--------------+----------+-------------
   9 | Fix Crontab                    |            2 |        1 | post
   3 | Local Group Creation           |            2 |        2 | post
   4 | User Home directory creation   |            2 |        3 | post
   2 | Local User Account Creation    |            2 |        4 | post
  73 | Import GPG Keys                |            2 |        5 | post
  24 | Complete Installers PostScript |            2 |        8 | post
  98 | Update RHEL                    |            2 |        9 | post
  48 | Import GPG Keys Pre            |            8 |        1 | pre
  99 | save-install-disk-config       |            8 |        2 | post
  94 | Select install disk            |            8 |        4 | pre
 120 | Install Packages               |            8 |        5 | post
  50 | Eject CD                       |            8 |        8 | post
 101 | Import GPG Keys Pre            |           17 |        1 | pre
 102 | save-install-disk-config       |           17 |        2 | post
 103 | Select install disk            |           17 |        4 | pre
 121 | Install Packages               |           17 |        5 | post
 100 | Eject CD                       |           17 |        8 | post
 104 | Import GPG Keys Pre            |           18 |        1 | pre
 105 | save-install-disk-config       |           18 |        2 | post
 106 | Select install disk            |           18 |        4 | pre
 122 | Install Packages               |           18 |        5 | post
 107 | Eject CD                       |           18 |        8 | post
 108 | Import GPG Keys Pre            |           19 |        1 | pre
 111 | save-install-disk-config       |           19 |        2 | post
 110 | Select install disk            |           19 |        4 | pre
 123 | Install Packages               |           19 |        5 | post
 109 | Eject CD                       |           19 |        8 | post

And here is the current table description:
rhnschema=# \d RHNKICKSTARTSCRIPT;
                    Table "public.rhnkickstartscript"
    Column     |           Type           |          Modifiers
---------------+--------------------------+------------------------------
 id            | numeric                  | not null
 script_name   | character varying(40)    |
 kickstart_id  | numeric                  | not null
 position      | numeric                  | not null
 script_type   | character varying(4)     | not null
 chroot        | character(1)             | not null default 'Y'::bpchar
 error_on_fail | character(1)             | not null default 'N'::bpchar
 raw_script    | character(1)             | not null default 'Y'::bpchar
 interpreter   | character varying(80)    |
 data          | bytea                    |
 created       | timestamp with time zone | not null default now()
 modified      | timestamp with time zone | not null default now()
Indexes:
    "rhn_ksscript_id_pk" PRIMARY KEY, btree (id)
    "rhn_ksscript_ksid_pos_uq" UNIQUE, btree (kickstart_id, "position")
    "rhn_ksscript_id_idx" btree (id)
    "rhn_ksscript_ksid_pos_idx" btree (kickstart_id, "position")
Check constraints:
    "rhn_ksscript_chroot_ck" CHECK (chroot = ANY (ARRAY['Y'::bpchar, 'N'::bpchar]))
    "rhn_ksscript_erroronfail_ck" CHECK (error_on_fail = ANY (ARRAY['Y'::bpchar, 'N'::bpchar]))
    "rhn_ksscript_rawscript_ck" CHECK (raw_script = ANY (ARRAY['Y'::bpchar, 'N'::bpchar]))
    "rhn_ksscript_st_ck" CHECK (script_type::text = ANY (ARRAY['pre'::character varying, 'post'::character varying]::text[]))
    "vn_rhnkickstartscript_interpreter" CHECK (interpreter::text <> ''::text)
    "vn_rhnkickstartscript_script_name" CHECK (script_name::text <> ''::text)
    "vn_rhnkickstartscript_script_type" CHECK (script_type::text <> ''::text)
Foreign-key constraints:
    "rhn_ksscript_ksid_fk" FOREIGN KEY (kickstart_id) REFERENCES rhnksdata(id) ON DELETE CASCADE
Triggers:
    rhn_ksscript_mod_trig BEFORE INSERT OR UPDATE ON rhnkickstartscript FOR EACH ROW EXECUTE PROCEDURE rhn_ksscript_mod_trig_fun()

Any ideas what might be wrong with my setup?

Thank you.

/Brian/

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]