Problema
No Oracle Fleet Patching and Provisioning (FPP), quando provisionamos uma GoldImage em um Cluster ou servidor Standalone usando o comando “rhpctl add workingcopy”, essa instalação é catalogada no repostório do FPP e marcada como uma instalação gerenciada.
Quando precisamos remover essa instalação com o comando “rhpctl delete workingcopy”, o FPP acessa o servidor de destino, executa o processo de “deinstall” do binário e no final remove a entrada no seu catálogo.
Se tentarmos executar o comando de deletar uma workingcopy enquanto o servidor de destino estiver inacessível, o FPP apresenta um erro de conexão SSH, e não remove o registro da workincopy em seu catálogo, mesmo usando a opção -force:
[grid@fppserver ~]$ rhpctl delete workingcopy -workingcopy wc_lab04_db11gR2 -force -root Enter user "root" password: fppserver.dibiei.com: Audit ID: 125 PRCZ-2009 : Failed to execute command "/bin/uname" as root within 120 seconds on nodes "lab04" PRCZ-2006 : Unable to establish SSH connection to node "lab04" to execute command "/bin/uname" java.net.NoRouteToHostException: No route to host (Host unreachable)
Neste caso, o que fazer se o servidor em questão foi descomossionado e não voltará a ficar disponível ?
Solução
Para este cenário, podemos usar a opção -metadataonly. Como o nome sugere, com essa opção o FPP irá excluir apenas os metadados referente a workingcopy, ou seja, a referência dele no repositório local:
[grid@fppserver ~]$ rhpctl delete workingcopy -workingcopy wc_lab04_db11gR2 -metadataonly fppserver.dibiei.com: Audit ID: 127
Também, com essa opção não é necessário informar o usuário ou credencial de acesso ao Targetnode, porque o FPP não tentará acessá-lo.
Um outro cenário que essa opção pode ser utilizada é se o binário no servidor de destino foi desinstalado manualmente, de forma limpa, por qualquer motivo. Não use essa opção se o servidor de destino em questão estiver inacessível por motivo temporário e você desejar continuar usando FPP nele normalmente quando o voltar a ficar online.
PRCG-1033 : Invalid command-line option: -metadataonly
Essa opção -metadataonly, assim como -jobtag, foi adicionada ao FPP em algum RU entre 19.13 e 19.19, não sei exatamente qual. Quando usei essa opção pela primeira vez, foi em um ambiente produtivo que já estava com GI 19.21, mas neste exemplo aqui eu tentei usar em um ambiente de teste antigo que estava com GI 19.12, onde apresentou o erro abaixo:
[grid@fppserver ~]$ rhpctl delete workingcopy -workingcopy wc_lab04_db11gR2 -metadataonly PRCG-1033 : Invalid command-line option: -metadataonly
No comando de ajuda não existia a opção:
[grid@fppserver ~]$ rhpctl delete workingcopy -h
Delete a working copy.
Usage: rhpctl delete workingcopy -workingcopy <workingcopy_name>
[-notify
[-cc <users_list>]]
[-force]
[[-targetnode <node_name>] -root |
-cred <cred_name> |
-sudouser <sudo_user_name> -sudopath <sudo_binary_path> |
-auth <plugin_name>
[-arg1 <name1>:<value1>
[-arg2 <name2>:<value2>...]]]
[-useractiondata <user_action_data>]
[-schedule <timer_value>]
-workingcopy <workingcopy_name> Name of the working copy
-notify Send email notification
-cc <users_list> List of users to whom email notifications will be sent, in addition to owner of working copy
-force To forcibly delete the database working copy
-targetnode <node_name> Name of a node in a remote cluster with no Rapid Home Provisioning Client
-cred <cred_name> Credential name to associate the user/password credentials to access a remote node
-root Use root credentials to access the remote node
-sudouser <username> perform super user operations as sudo user name
-sudopath <sudo_binary_path> location of sudo binary
-auth <plugin_name> [<plugin_args>] Use an authentication plugin to access the remote node
-useractiondata <user_action_data> Value to be passed to useractiondata parameter of useraction script
-schedule { <timer_value> | NOW } Preferred time to execute the operation. If an absolute timer_value is specified, it should be in ISO-8601 format. For example: 2016-12-21T19:13:17+05. If offset is specified as the timer value, it should be in the format +dd:mm:yy:hh:mm:ss. For example: +02:22:22. If NOW is specified, job will be scheduled immediately.
Após aplicar o GI RU 19.21 no servidor do FPP, a opção apareceu como esperado (e funcionou):
[grid@fppserver ~]$ rhpctl delete workingcopy -h
Delete a working copy.
Usage: rhpctl delete workingcopy -workingcopy <workingcopy_name>
[-notify
[-cc <users_list>]]
[-force]
[[-targetnode <node_name>] -root |
-cred <cred_name> |
-sudouser <sudo_user_name> -sudopath <sudo_binary_path> |
-auth <plugin_name>
[-arg1 <name1>:<value1>
[-arg2 <name2>:<value2>...]]]
[-useractiondata <user_action_data>]
[-schedule <timer_value>]
-workingcopy <workingcopy_name> Name of the working copy
-notify Send email notification
-cc <users_list> List of users to whom email notifications will be sent, in addition to owner of working copy
-force To forcibly delete the database working copy
-targetnode <node_name> Name of a node in a remote cluster with no Rapid Home Provisioning Client
-cred <cred_name> Credential name to associate the user/password credentials to access a remote node
-root Use root credentials to access the remote node
-sudouser <username> perform super user operations as sudo user name
-sudopath <sudo_binary_path> location of sudo binary
-auth <plugin_name> [<plugin_args>] Use an authentication plugin to access the remote node
-useractiondata <user_action_data> Value to be passed to useractiondata parameter of useraction script
-schedule { <timer_value> | NOW | PAUSE }
Preferred time to execute the operation. If an absolute timer_value is specified, it should be in ISO-8601 format. For example: 2016-12-21T19:13:17+05. If offset is specified as the timer value, it should be in the format +dd:mm:yy:hh:mm:ss. For example: +02:22:22. If NOW is specified, job will be scheduled immediately. If PAUSE is specified, job will be initiated with status PAUSED and user needs to be resumed to execute it
-jobtag <job_tag> Associate a tag with the job
-metadataonly delete metadata only